Commit Graph

110 Commits

Author SHA1 Message Date
Akira Noda
90bdd72555
Admin: Using ruff format instead of black (#7502) 2024-03-21 19:17:29 -01:00
Miki Watanabe
9aef6944da
ECS: Fix container memory validation (#7280) 2024-02-05 20:16:58 -01:00
Bert Blommers
a7f3b367b4 Introduce mock_aws() (#7194) 2024-01-27 19:38:09 +00:00
tungol
55c589072f
Admin: sorting imports with ruff (#7075) 2023-11-30 14:55:51 -01:00
Bert Blommers
d6377ff905
Techdebt: Improve some type annotations (#7072) 2023-11-28 21:01:56 -01:00
Bert Blommers
ed56ffd484
ECS: Tagging is now supported for Tasks (#7029) 2023-11-15 21:23:41 -01:00
rafcio19
6ef17eee2a
ECS: fix container definition validation (#7007) 2023-11-10 08:35:30 -01:00
Bert Blommers
90e8bb1313
Techdebt: Improve/fix exception handling in tests (#7011) 2023-11-09 22:17:46 -01:00
Edgar Ramírez Mondragón
39b9c2f121
Implement state transitions for ECS tasks (#6857) 2023-09-27 14:56:34 +00:00
cm-iwata
2ada07ff44
ECS: add pidMode validation for FARGATE (#6825) 2023-09-19 12:39:14 +00:00
Bert Blommers
bc29ae2fc3
Techdebt: Update TF tests (#6661) 2023-08-21 20:33:16 +00:00
Bert Blommers
9da27b76ef
Techdebt: Replace sure with regular assertions in ECS (#6533) 2023-07-18 15:33:16 +00:00
rafcio19
60065b3cf8
ECS: allow ecs service to transition to arbitrary running task count (#6289) 2023-05-11 17:38:29 +00:00
Bert Blommers
3e21ddd606
ECS: Fix a bug where a cluster cannot be tagged after creation (#6226) 2023-04-18 13:54:08 +00:00
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