Commit Graph

96 Commits

Author SHA1 Message Date
Bert Blommers
0677f69211
ECS: run_task() now validates the provided launch-type (#6161) 2023-04-02 11:44:10 +00:00
Bert Blommers
3a430780f7
Terraform - Update to latest commit (#5982) 2023-02-25 19:24:03 -01:00
Bert Blommers
ef1fab008a
ECS: Various improvements (#5880) 2023-01-29 22:47:50 -01:00
Bert Blommers
3a023f0fe1
ECS: list_services() now throws correct error when providing unknown cluster (#5865) 2023-01-22 15:07:52 -01:00
shanishiri
cf0bcbce91
Support tags in ECS start_task and describe_tasks (#5817) 2023-01-11 18:28:07 -01:00
Chih-Hsuan Yen
15d3cdb794
Techdebt: replace mock with unittest.mock (#5775) 2022-12-15 11:17:50 -01:00
Bert Blommers
1a8ddc0f2b
Techdebt: Replace string-format with f-strings (for tests dirs) (#5678) 2022-11-17 21:41:08 -01:00
rafcio19
29829e2eaa
ECS: add eni to a task (#5520) 2022-10-03 21:31:18 +00:00
Bert Blommers
3d913f8f15
MultiAccount support (#5192) 2022-08-13 09:49:43 +00:00
Oleksandr Anosov
6ae0aa5272
Add ability to list ECS services by launch type (#5138) 2022-05-16 13:15:34 -07:00
Bert Blommers
1a5c18878c
ECS - support for CapacityProviders (#4977) 2022-03-29 14:19:09 +00:00
Bert Blommers
29d01c35bc
Update Black + formatting (#4926) 2022-03-10 13:39:59 -01:00
Peter Baumgartner
8bbfe9c151
ecs.run_task count default to 1 (#3268) 2022-02-28 11:38:45 -01:00
Bert Blommers
291aa83137
ECS - LongARN is enabled by default (#4762) 2022-01-18 19:53:31 -01:00
Bert Blommers
307104417b
ECS:run_task - persist launchType (#4733) 2021-12-31 15:55:48 -01:00
Bert Blommers
695a3ca3d3
ECS - create_cluster with tags (#4654) 2021-12-04 21:05:05 -01:00
Dominik Schubert
1993e3f4ec
ECS - Fix tag/untag for with multiple services in cluster (#4649) 2021-12-03 13:46:24 -01:00
Bert Blommers
3d6ffcc74d
ECS: delete/list/put_account_setting (#4456) 2021-10-21 22:00:32 +00:00
Bert Blommers
7f0ef4a0cc
ECS - Enable option to use new ARN format (#4450) 2021-10-21 10:05:10 +00:00
Bert Blommers
14a69c7524
Techdebt: Enable pylint rules (#4432) 2021-10-18 19:44:29 +00:00
Paul Roberts
da6c5f667b
Fix error when AWS::ECS::Service does not include a DesiredCount (#4292)
Co-authored-by: Paul Roberts <paroberts@guidewire.com>
2021-09-15 21:05:53 +00:00
William Richard
d8be72e483
Add the abilitiy to set ECS task definition task role and execution role arns (#3869) 2021-04-21 18:56:09 +01:00
William Richard
0f4f01bb7b
Add the status field to ECS task definitions (#3723)
Also I found extra tests for describe_task_definition and deregister_task_definition that were not being run,
so I changed their names so they are found by pytest and made them pass.  I also added checks to them for the new
status field.
2021-02-24 13:26:26 +00:00
Luigi Tagliamonte
442fcd4e51
add tags support to ECS tasks (#3715)
* add tags support to ECS tasks

* lint

* lint

* fmt

* fmt with same version

Co-authored-by: ltagliamonte <ltagliamonte@users.noreply.github.com>
2021-02-21 10:11:34 +00:00
Anton Grübel
0211e9d78d
Add failures output to ecs.describe_services (#3641)
* Add failures output to ecs.describe_services

* Fix autoscaling tests
2021-02-01 12:19:46 +00:00
William Richard
5c4b68c5ea
Add support for the force argument for ecs.delete_service (#3631)
This argument allows you to delete a service even when its DesiredCount is non-zero.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.delete_service
2021-01-31 10:09:52 +00:00
Bert Blommers
77dd35e3b8
Use known ImageID in internal tests (#3555) 2021-01-13 09:02:11 +00:00
Jordan Sanders
6dfd64ff3c
More accurately mock ECS RegisterTaskDefinition (#3584)
The mocked response for ECS RegisterTaskDefinition has drifted from what
actually returns when run against a real ECS endpoint. I created a
minimal task definition for both EC2:

```
>>> ecs.register_task_definition(
      family="moto",
      containerDefinitions=[
          {
              "name": "hello_world",
              "image": "hello-world:latest",
              "memory": 400
           }
       ]
  )["taskDefinition"]

{'taskDefinitionArn': 'arn:aws:ecs:us-east-1:************:task-definition/moto:1',
 'containerDefinitions': [{'name': 'hello_world',
   'image': 'hello-world:latest',
   'cpu': 0,
   'memory': 400,
   'portMappings': [],
   'essential': True,
   'environment': [],
   'mountPoints': [],
   'volumesFrom': []}],
 'family': 'moto',
 'revision': 1,
 'volumes': [],
 'status': 'ACTIVE',
 'placementConstraints': [],
 'compatibilities': ['EC2']}
```

and FARGATE:
```
>>> ecs.register_task_definition(
      family="moto",
      containerDefinitions=[
          {
              "name": "hello_world",
              "image": "hello-world:latest",
              "memory": 400
           }
       ],
       requiresCompatibilities=["FARGATE"],
       networkMode="awsvpc",
       cpu="256",
       memory="512"
  )["taskDefinition"]

{'taskDefinitionArn': 'arn:aws:ecs:us-east-1:************:task-definition/moto:2',
 'containerDefinitions': [{'name': 'hello_world',
   'image': 'hello-world:latest',
   'cpu': 0,
   'memory': 400,
   'portMappings': [],
   'essential': True,
   'environment': [],
   'mountPoints': [],
   'volumesFrom': []}],
 'family': 'moto',
 'networkMode': 'awsvpc',
 'revision': 2,
 'volumes': [],
 'status': 'ACTIVE',
 'requiresAttributes': [{'name': 'com.amazonaws.ecs.capability.docker-remote-api.1.18'},
  {'name': 'ecs.capability.task-eni'}],
 'placementConstraints': [],
 'compatibilities': ['EC2', 'FARGATE'],
 'requiresCompatibilities': ['FARGATE'],
 'cpu': '256',
 'memory': '512'}
```

This change adds several default keys to the task based on those two
real responses and the AWS documentation:
https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RegisterTaskDefinition.html

The mock still doesn't match the real response exactly but it's much
closer than it was before.
2021-01-09 14:07:35 +00:00
Anton Grübel
f4418185d1
Add launchType parameter to ECS (#3578) 2021-01-08 17:14:40 +00:00
Jordan Sanders
b4e961148f
Pass the default ECS cluster and raise accurate exceptions (#3522)
* Pass the "default" cluster

* Mock ECS exceptions more accurately

Moto's mock ECS has drifted fairly far from the actual ECS API in terms
of which exceptions it throws. This change begins to bring mock ECS's
exceptions in line with actual ECS exceptions. Most notably:

- Several custom exceptions have been replaced with their real ECS
exception. For example, "{0} is not a cluster" has been replaced with
ClusterNotFoundException
- Tests have been added to verify (most of) these exceptions work
correctly. The test coverage was a little spotty to begin with.
- The new exceptions plus the change to pass the "default" cluster
exposed a lot of places where mock ECS was behaving incorrectly. For
example, the ListTasks action is always scoped to a single cluster in
ECS but it listed tasks for all clusters in the mock. I've minimally
updated the tests to make them pass, but there's lots of opportunity to
refactor both this method's test and its implementation.

This does not provide full coverage of exceptions. In general, I ran
these operations against actual ECS resources and cross-referenced the
documentation to figure out what actual exceptions should be thrown and
what the messages should be. Consequently, I didn't update any
exceptions that took more than trivial amount of time to reproduce with
real resources.
2020-12-08 12:55:49 +00:00
Bert Blommers
273ca63d59 Linting 2020-11-11 15:55:37 +00:00
Matěj Cepl
5697ff87a8 Back to Black 2020-11-10 14:12:38 +01:00
Matěj Cepl
ea489bce6c Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
Matěj Cepl
77dc60ea97 Port test suite from nose to pytest.
This just eliminates all errors on the tests collection. Elimination of
failures is left to the next commit.
2020-11-10 08:23:44 +01:00
Brian Pandola
ea19466c38
Fix missing properties when ecs:TaskDefinition created via CloudFormation (#3378)
There's a larger problem here that needs a more generalized solution,
but this solves the immediate issue with a minimum amount of code.

Closes #3171
2020-10-12 20:53:30 +01:00
Brian Pandola
c54f182ca1
Implement additional filters for ecs.ListTasks (#3376)
Closes #1785
2020-10-10 20:02:08 +01:00
Anton Grübel
349b9a990d
Add registeredAt to ecs container instance (#3358) 2020-10-05 15:39:59 +01:00
Bert Blommers
0ab21f62a8 Linting 2020-09-13 19:42:38 +01:00
Bert Blommers
db1d7123f6 List dependencies for services - add integration test to verify 2020-09-13 16:08:23 +01:00
Peter Baumgartner
94c676b9cf
include=["TAGS"] for describe_task_definition (#3265)
* include=["TAGS"] for describe_task_definition

* Different approach

* describe_services tags and tests
2020-09-01 10:24:08 +01:00
Steve Pulec
41427a78b6
Merge pull request #3147 from bblommers/enhancement/3139
ECS - UpdateService - Allow service ARN to be passed in
2020-07-26 15:31:12 -05:00
Aaron Hill
1e5b8acac6
Implementation: ECS Task Sets (#3152)
* initial implementation of taskSets.  Fixed a bug with ECS Service where task_definition was a required parameter.

* Added update_task_set and tests.  DRYed up ClusterNotFoundException. General cleanup.

* Added support for filtering tags on include parameter to describe_task_sets.  Added additional tests.

* Fix copy/pasta in ClusterNotFoundException

* styling updates

* Added TODO for delete_task_set force parameter

* Updated multiple function and constructor calls to use named variables.  Updated tests to reference variables instead of hardcoded strings.

* Run black for formatting

* Updated create_service function call to use named variables
2020-07-21 07:17:37 +01:00
Bert Blommers
f69688b064 ECS - UpdateService - Allow Service ARNs 2020-07-17 12:50:06 +01:00
Rifqi Al Fatih
f23f706825 Implement placement constraints model 2020-05-02 18:47:59 +02:00
Theodore Wong
0163eb6a9d Changed mock_ecs to support ecs.run_task calls with a default cluster 2020-04-07 15:32:44 -07:00
Asher Foa
d9d055c75d Fix more typos. 2020-01-23 10:15:02 -08:00
Don Kuntz
fd1fdde1bf
Allow black to reformat correctly 2020-01-09 23:45:14 -06:00
Don Kuntz
2cb3f327de
Store 'networkMode' in ECS Task Definitions instead of just throwing it away 2020-01-09 23:00:33 -06:00
Alex Tareshawty
df2279d39c Add familyPrefix option to ecs:ListTaskDefinitions
AWS defines this option as:
```
--family-prefix (string)
  The full family name with which to filter the ListTaskDefinitions
  results. Specifying a familyPrefix limits the listed task
  defini-tions to task definition revisions that belong to that
  family.
```

This option behaves differently than ecs:ListTaskDefinitionFamilies.
Instead of doing a comparison like `startswith`, it does a full string
comparison by matching the entire task definition family to the prefix.
For example, let's say there exists a task definition with the family
`super-cool-task-def`.

ListTaskDefinitionFamilies would look like this:

```
aws ecs list-task-definition-families --family-prefix super-cool
{
    "families": [
      "super-cool-task-def"
    ]
}
```

ListTaskDefinitions would look like this:

```
aws ecs list-task-definitions --family-prefix super-cool
{
    "taskDefinitionArns": []
}
```
2019-11-26 09:40:01 -05:00
Steve Pulec
a9fe5d462c More linting. 2019-11-22 09:39:07 -05:00