ECS - Fix tag/untag for with multiple services in cluster (#4649)

This commit is contained in:
Dominik Schubert 2021-12-03 15:46:24 +01:00 committed by GitHub
parent c6815c1a4b
commit 1993e3f4ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 5 deletions

View File

@ -2766,26 +2766,50 @@ def test_ecs_service_tag_resource():
}
],
)
response = client.create_service(
create_response2 = client.create_service(
cluster="test_ecs_cluster",
serviceName="test_ecs_service_2",
taskDefinition="test_ecs_task",
desiredCount=1,
)
create_response = client.create_service(
cluster="test_ecs_cluster",
serviceName="test_ecs_service",
taskDefinition="test_ecs_task",
desiredCount=2,
)
client.tag_resource(
resourceArn=response["service"]["serviceArn"],
resourceArn=create_response["service"]["serviceArn"],
tags=[
{"key": "createdBy", "value": "moto-unittest"},
{"key": "foo", "value": "bar"},
],
)
client.tag_resource(
resourceArn=create_response2["service"]["serviceArn"],
tags=[
{"key": "createdBy-2", "value": "moto-unittest-2"},
{"key": "foo-2", "value": "bar-2"},
],
)
response = client.list_tags_for_resource(
resourceArn=response["service"]["serviceArn"]
resourceArn=create_response["service"]["serviceArn"]
)
type(response["tags"]).should.be(list)
response["tags"].should.equal(
[{"key": "createdBy", "value": "moto-unittest"}, {"key": "foo", "value": "bar"}]
)
response2 = client.list_tags_for_resource(
resourceArn=create_response2["service"]["serviceArn"]
)
type(response2["tags"]).should.be(list)
response2["tags"].should.equal(
[
{"key": "createdBy-2", "value": "moto-unittest-2"},
{"key": "foo-2", "value": "bar-2"},
]
)
@mock_ecs