Lints.
This commit is contained in:
parent
1433f28846
commit
f37bad0e00
260 changed files with 6363 additions and 3766 deletions
|
|
@ -20,7 +20,8 @@ def test_create_cluster():
|
|||
clusterName='test_ecs_cluster'
|
||||
)
|
||||
response['cluster']['clusterName'].should.equal('test_ecs_cluster')
|
||||
response['cluster']['clusterArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['cluster']['clusterArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['cluster']['status'].should.equal('ACTIVE')
|
||||
response['cluster']['registeredContainerInstancesCount'].should.equal(0)
|
||||
response['cluster']['runningTasksCount'].should.equal(0)
|
||||
|
|
@ -38,8 +39,10 @@ def test_list_clusters():
|
|||
clusterName='test_cluster1'
|
||||
)
|
||||
response = client.list_clusters()
|
||||
response['clusterArns'].should.contain('arn:aws:ecs:us-east-1:012345678910:cluster/test_cluster0')
|
||||
response['clusterArns'].should.contain('arn:aws:ecs:us-east-1:012345678910:cluster/test_cluster1')
|
||||
response['clusterArns'].should.contain(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_cluster0')
|
||||
response['clusterArns'].should.contain(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_cluster1')
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -50,7 +53,8 @@ def test_delete_cluster():
|
|||
)
|
||||
response = client.delete_cluster(cluster='test_ecs_cluster')
|
||||
response['cluster']['clusterName'].should.equal('test_ecs_cluster')
|
||||
response['cluster']['clusterArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['cluster']['clusterArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['cluster']['status'].should.equal('ACTIVE')
|
||||
response['cluster']['registeredContainerInstancesCount'].should.equal(0)
|
||||
response['cluster']['runningTasksCount'].should.equal(0)
|
||||
|
|
@ -82,15 +86,24 @@ def test_register_task_definition():
|
|||
]
|
||||
)
|
||||
type(response['taskDefinition']).should.be(dict)
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['taskDefinition']['containerDefinitions'][0]['name'].should.equal('hello_world')
|
||||
response['taskDefinition']['containerDefinitions'][0]['image'].should.equal('docker/hello-world:latest')
|
||||
response['taskDefinition']['containerDefinitions'][0]['cpu'].should.equal(1024)
|
||||
response['taskDefinition']['containerDefinitions'][0]['memory'].should.equal(400)
|
||||
response['taskDefinition']['containerDefinitions'][0]['essential'].should.equal(True)
|
||||
response['taskDefinition']['containerDefinitions'][0]['environment'][0]['name'].should.equal('AWS_ACCESS_KEY_ID')
|
||||
response['taskDefinition']['containerDefinitions'][0]['environment'][0]['value'].should.equal('SOME_ACCESS_KEY')
|
||||
response['taskDefinition']['containerDefinitions'][0]['logConfiguration']['logDriver'].should.equal('json-file')
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['name'].should.equal('hello_world')
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'image'].should.equal('docker/hello-world:latest')
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['cpu'].should.equal(1024)
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['memory'].should.equal(400)
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['essential'].should.equal(True)
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'environment'][0]['name'].should.equal('AWS_ACCESS_KEY_ID')
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'environment'][0]['value'].should.equal('SOME_ACCESS_KEY')
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'logConfiguration']['logDriver'].should.equal('json-file')
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -132,8 +145,10 @@ def test_list_task_definitions():
|
|||
)
|
||||
response = client.list_task_definitions()
|
||||
len(response['taskDefinitionArns']).should.equal(2)
|
||||
response['taskDefinitionArns'][0].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['taskDefinitionArns'][1].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:2')
|
||||
response['taskDefinitionArns'][0].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['taskDefinitionArns'][1].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:2')
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -191,10 +206,13 @@ def test_describe_task_definition():
|
|||
]
|
||||
)
|
||||
response = client.describe_task_definition(taskDefinition='test_ecs_task')
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:3')
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:3')
|
||||
|
||||
response = client.describe_task_definition(taskDefinition='test_ecs_task:2')
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:2')
|
||||
response = client.describe_task_definition(
|
||||
taskDefinition='test_ecs_task:2')
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:2')
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -221,15 +239,24 @@ def test_deregister_task_definition():
|
|||
taskDefinition='test_ecs_task:1'
|
||||
)
|
||||
type(response['taskDefinition']).should.be(dict)
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['taskDefinition']['containerDefinitions'][0]['name'].should.equal('hello_world')
|
||||
response['taskDefinition']['containerDefinitions'][0]['image'].should.equal('docker/hello-world:latest')
|
||||
response['taskDefinition']['containerDefinitions'][0]['cpu'].should.equal(1024)
|
||||
response['taskDefinition']['containerDefinitions'][0]['memory'].should.equal(400)
|
||||
response['taskDefinition']['containerDefinitions'][0]['essential'].should.equal(True)
|
||||
response['taskDefinition']['containerDefinitions'][0]['environment'][0]['name'].should.equal('AWS_ACCESS_KEY_ID')
|
||||
response['taskDefinition']['containerDefinitions'][0]['environment'][0]['value'].should.equal('SOME_ACCESS_KEY')
|
||||
response['taskDefinition']['containerDefinitions'][0]['logConfiguration']['logDriver'].should.equal('json-file')
|
||||
response['taskDefinition']['taskDefinitionArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['name'].should.equal('hello_world')
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'image'].should.equal('docker/hello-world:latest')
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['cpu'].should.equal(1024)
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['memory'].should.equal(400)
|
||||
response['taskDefinition']['containerDefinitions'][
|
||||
0]['essential'].should.equal(True)
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'environment'][0]['name'].should.equal('AWS_ACCESS_KEY_ID')
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'environment'][0]['value'].should.equal('SOME_ACCESS_KEY')
|
||||
response['taskDefinition']['containerDefinitions'][0][
|
||||
'logConfiguration']['logDriver'].should.equal('json-file')
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -261,16 +288,19 @@ def test_create_service():
|
|||
taskDefinition='test_ecs_task',
|
||||
desiredCount=2
|
||||
)
|
||||
response['service']['clusterArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['service']['clusterArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['service']['desiredCount'].should.equal(2)
|
||||
len(response['service']['events']).should.equal(0)
|
||||
len(response['service']['loadBalancers']).should.equal(0)
|
||||
response['service']['pendingCount'].should.equal(0)
|
||||
response['service']['runningCount'].should.equal(0)
|
||||
response['service']['serviceArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service')
|
||||
response['service']['serviceArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service')
|
||||
response['service']['serviceName'].should.equal('test_ecs_service')
|
||||
response['service']['status'].should.equal('ACTIVE')
|
||||
response['service']['taskDefinition'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['service']['taskDefinition'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -312,8 +342,10 @@ def test_list_services():
|
|||
cluster='test_ecs_cluster'
|
||||
)
|
||||
len(response['serviceArns']).should.equal(2)
|
||||
response['serviceArns'][0].should.equal('arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service1')
|
||||
response['serviceArns'][1].should.equal('arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service2')
|
||||
response['serviceArns'][0].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service1')
|
||||
response['serviceArns'][1].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service2')
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -359,12 +391,15 @@ def test_describe_services():
|
|||
)
|
||||
response = client.describe_services(
|
||||
cluster='test_ecs_cluster',
|
||||
services=['test_ecs_service1', 'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service2']
|
||||
services=['test_ecs_service1',
|
||||
'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service2']
|
||||
)
|
||||
len(response['services']).should.equal(2)
|
||||
response['services'][0]['serviceArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service1')
|
||||
response['services'][0]['serviceArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service1')
|
||||
response['services'][0]['serviceName'].should.equal('test_ecs_service1')
|
||||
response['services'][1]['serviceArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service2')
|
||||
response['services'][1]['serviceArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service2')
|
||||
response['services'][1]['serviceName'].should.equal('test_ecs_service2')
|
||||
|
||||
|
||||
|
|
@ -446,16 +481,20 @@ def test_delete_service():
|
|||
cluster='test_ecs_cluster',
|
||||
service='test_ecs_service'
|
||||
)
|
||||
response['service']['clusterArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['service']['clusterArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['service']['desiredCount'].should.equal(0)
|
||||
len(response['service']['events']).should.equal(0)
|
||||
len(response['service']['loadBalancers']).should.equal(0)
|
||||
response['service']['pendingCount'].should.equal(0)
|
||||
response['service']['runningCount'].should.equal(0)
|
||||
response['service']['serviceArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service')
|
||||
response['service']['serviceArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:service/test_ecs_service')
|
||||
response['service']['serviceName'].should.equal('test_ecs_service')
|
||||
response['service']['status'].should.equal('ACTIVE')
|
||||
response['service']['taskDefinition'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['service']['taskDefinition'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ecs
|
||||
|
|
@ -484,18 +523,23 @@ def test_register_container_instance():
|
|||
instanceIdentityDocument=instance_id_document
|
||||
)
|
||||
|
||||
response['containerInstance']['ec2InstanceId'].should.equal(test_instance.id)
|
||||
response['containerInstance'][
|
||||
'ec2InstanceId'].should.equal(test_instance.id)
|
||||
full_arn = response['containerInstance']['containerInstanceArn']
|
||||
arn_part = full_arn.split('/')
|
||||
arn_part[0].should.equal('arn:aws:ecs:us-east-1:012345678910:container-instance')
|
||||
arn_part[0].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:container-instance')
|
||||
arn_part[1].should.equal(str(UUID(arn_part[1])))
|
||||
response['containerInstance']['status'].should.equal('ACTIVE')
|
||||
len(response['containerInstance']['registeredResources']).should.equal(0)
|
||||
len(response['containerInstance']['remainingResources']).should.equal(0)
|
||||
response['containerInstance']['agentConnected'].should.equal(True)
|
||||
response['containerInstance']['versionInfo']['agentVersion'].should.equal('1.0.0')
|
||||
response['containerInstance']['versionInfo']['agentHash'].should.equal('4023248')
|
||||
response['containerInstance']['versionInfo']['dockerVersion'].should.equal('DockerVersion: 1.5.0')
|
||||
response['containerInstance']['versionInfo'][
|
||||
'agentVersion'].should.equal('1.0.0')
|
||||
response['containerInstance']['versionInfo'][
|
||||
'agentHash'].should.equal('4023248')
|
||||
response['containerInstance']['versionInfo'][
|
||||
'dockerVersion'].should.equal('DockerVersion: 1.5.0')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
|
|
@ -526,7 +570,8 @@ def test_list_container_instances():
|
|||
cluster=test_cluster_name,
|
||||
instanceIdentityDocument=instance_id_document)
|
||||
|
||||
test_instance_arns.append(response['containerInstance']['containerInstanceArn'])
|
||||
test_instance_arns.append(response['containerInstance'][
|
||||
'containerInstanceArn'])
|
||||
|
||||
response = ecs_client.list_container_instances(cluster=test_cluster_name)
|
||||
|
||||
|
|
@ -563,13 +608,17 @@ def test_describe_container_instances():
|
|||
cluster=test_cluster_name,
|
||||
instanceIdentityDocument=instance_id_document)
|
||||
|
||||
test_instance_arns.append(response['containerInstance']['containerInstanceArn'])
|
||||
test_instance_arns.append(response['containerInstance'][
|
||||
'containerInstanceArn'])
|
||||
|
||||
test_instance_ids = list(map((lambda x: x.split('/')[1]), test_instance_arns))
|
||||
response = ecs_client.describe_container_instances(cluster=test_cluster_name, containerInstances=test_instance_ids)
|
||||
test_instance_ids = list(
|
||||
map((lambda x: x.split('/')[1]), test_instance_arns))
|
||||
response = ecs_client.describe_container_instances(
|
||||
cluster=test_cluster_name, containerInstances=test_instance_ids)
|
||||
len(response['failures']).should.equal(0)
|
||||
len(response['containerInstances']).should.equal(instance_to_create)
|
||||
response_arns = [ci['containerInstanceArn'] for ci in response['containerInstances']]
|
||||
response_arns = [ci['containerInstanceArn']
|
||||
for ci in response['containerInstances']]
|
||||
for arn in test_instance_arns:
|
||||
response_arns.should.contain(arn)
|
||||
|
||||
|
|
@ -626,10 +675,14 @@ def test_run_task():
|
|||
startedBy='moto'
|
||||
)
|
||||
len(response['tasks']).should.equal(2)
|
||||
response['tasks'][0]['taskArn'].should.contain('arn:aws:ecs:us-east-1:012345678910:task/')
|
||||
response['tasks'][0]['clusterArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['tasks'][0]['taskDefinitionArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['tasks'][0]['containerInstanceArn'].should.contain('arn:aws:ecs:us-east-1:012345678910:container-instance/')
|
||||
response['tasks'][0]['taskArn'].should.contain(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task/')
|
||||
response['tasks'][0]['clusterArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['tasks'][0]['taskDefinitionArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['tasks'][0]['containerInstanceArn'].should.contain(
|
||||
'arn:aws:ecs:us-east-1:012345678910:container-instance/')
|
||||
response['tasks'][0]['overrides'].should.equal({})
|
||||
response['tasks'][0]['lastStatus'].should.equal("RUNNING")
|
||||
response['tasks'][0]['desiredStatus'].should.equal("RUNNING")
|
||||
|
|
@ -664,8 +717,10 @@ def test_start_task():
|
|||
instanceIdentityDocument=instance_id_document
|
||||
)
|
||||
|
||||
container_instances = client.list_container_instances(cluster=test_cluster_name)
|
||||
container_instance_id = container_instances['containerInstanceArns'][0].split('/')[-1]
|
||||
container_instances = client.list_container_instances(
|
||||
cluster=test_cluster_name)
|
||||
container_instance_id = container_instances[
|
||||
'containerInstanceArns'][0].split('/')[-1]
|
||||
|
||||
_ = client.register_task_definition(
|
||||
family='test_ecs_task',
|
||||
|
|
@ -694,10 +749,14 @@ def test_start_task():
|
|||
)
|
||||
|
||||
len(response['tasks']).should.equal(1)
|
||||
response['tasks'][0]['taskArn'].should.contain('arn:aws:ecs:us-east-1:012345678910:task/')
|
||||
response['tasks'][0]['clusterArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['tasks'][0]['taskDefinitionArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['tasks'][0]['containerInstanceArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:container-instance/{0}'.format(container_instance_id))
|
||||
response['tasks'][0]['taskArn'].should.contain(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task/')
|
||||
response['tasks'][0]['clusterArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:cluster/test_ecs_cluster')
|
||||
response['tasks'][0]['taskDefinitionArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task:1')
|
||||
response['tasks'][0]['containerInstanceArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:container-instance/{0}'.format(container_instance_id))
|
||||
response['tasks'][0]['overrides'].should.equal({})
|
||||
response['tasks'][0]['lastStatus'].should.equal("RUNNING")
|
||||
response['tasks'][0]['desiredStatus'].should.equal("RUNNING")
|
||||
|
|
@ -732,8 +791,10 @@ def test_list_tasks():
|
|||
instanceIdentityDocument=instance_id_document
|
||||
)
|
||||
|
||||
container_instances = client.list_container_instances(cluster=test_cluster_name)
|
||||
container_instance_id = container_instances['containerInstanceArns'][0].split('/')[-1]
|
||||
container_instances = client.list_container_instances(
|
||||
cluster=test_cluster_name)
|
||||
container_instance_id = container_instances[
|
||||
'containerInstanceArns'][0].split('/')[-1]
|
||||
|
||||
_ = client.register_task_definition(
|
||||
family='test_ecs_task',
|
||||
|
|
@ -770,7 +831,8 @@ def test_list_tasks():
|
|||
)
|
||||
|
||||
assert len(client.list_tasks()['taskArns']).should.equal(2)
|
||||
assert len(client.list_tasks(cluster='test_ecs_cluster')['taskArns']).should.equal(2)
|
||||
assert len(client.list_tasks(cluster='test_ecs_cluster')
|
||||
['taskArns']).should.equal(2)
|
||||
assert len(client.list_tasks(startedBy='foo')['taskArns']).should.equal(1)
|
||||
|
||||
|
||||
|
|
@ -819,7 +881,7 @@ def test_describe_tasks():
|
|||
]
|
||||
)
|
||||
tasks_arns = [
|
||||
task['taskArn'] for task in client.run_task(
|
||||
task['taskArn'] for task in client.run_task(
|
||||
cluster='test_ecs_cluster',
|
||||
overrides={},
|
||||
taskDefinition='test_ecs_task',
|
||||
|
|
@ -833,7 +895,8 @@ def test_describe_tasks():
|
|||
)
|
||||
|
||||
len(response['tasks']).should.equal(2)
|
||||
set([response['tasks'][0]['taskArn'], response['tasks'][1]['taskArn']]).should.equal(set(tasks_arns))
|
||||
set([response['tasks'][0]['taskArn'], response['tasks']
|
||||
[1]['taskArn']]).should.equal(set(tasks_arns))
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -858,9 +921,11 @@ def describe_task_definition():
|
|||
family = task_definition['family']
|
||||
task = client.describe_task_definition(taskDefinition=family)
|
||||
task['containerDefinitions'][0].should.equal(container_definition)
|
||||
task['taskDefinitionArn'].should.equal('arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task2:1')
|
||||
task['taskDefinitionArn'].should.equal(
|
||||
'arn:aws:ecs:us-east-1:012345678910:task-definition/test_ecs_task2:1')
|
||||
task['volumes'].should.equal([])
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ecs
|
||||
def test_stop_task():
|
||||
|
|
@ -918,7 +983,8 @@ def test_stop_task():
|
|||
reason='moto testing'
|
||||
)
|
||||
|
||||
stop_response['task']['taskArn'].should.equal(run_response['tasks'][0].get('taskArn'))
|
||||
stop_response['task']['taskArn'].should.equal(
|
||||
run_response['tasks'][0].get('taskArn'))
|
||||
stop_response['task']['lastStatus'].should.equal('STOPPED')
|
||||
stop_response['task']['desiredStatus'].should.equal('STOPPED')
|
||||
stop_response['task']['stoppedReason'].should.equal('moto testing')
|
||||
|
|
@ -967,7 +1033,8 @@ def test_update_cluster_name_through_cloudformation_should_trigger_a_replacement
|
|||
}
|
||||
}
|
||||
template2 = deepcopy(template1)
|
||||
template2['Resources']['testCluster']['Properties']['ClusterName'] = 'testcluster2'
|
||||
template2['Resources']['testCluster'][
|
||||
'Properties']['ClusterName'] = 'testcluster2'
|
||||
template1_json = json.dumps(template1)
|
||||
cfn_conn = boto3.client('cloudformation', region_name='us-west-1')
|
||||
stack_resp = cfn_conn.create_stack(
|
||||
|
|
@ -994,18 +1061,18 @@ def test_create_task_definition_through_cloudformation():
|
|||
"Description": "ECS Cluster Test CloudFormation",
|
||||
"Resources": {
|
||||
"testTaskDefinition": {
|
||||
"Type" : "AWS::ECS::TaskDefinition",
|
||||
"Properties" : {
|
||||
"ContainerDefinitions" : [
|
||||
"Type": "AWS::ECS::TaskDefinition",
|
||||
"Properties": {
|
||||
"ContainerDefinitions": [
|
||||
{
|
||||
"Name": "ecs-sample",
|
||||
"Image":"amazon/amazon-ecs-sample",
|
||||
"Image": "amazon/amazon-ecs-sample",
|
||||
"Cpu": "200",
|
||||
"Memory": "500",
|
||||
"Essential": "true"
|
||||
}
|
||||
],
|
||||
"Volumes" : [],
|
||||
"Volumes": [],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1030,19 +1097,19 @@ def test_update_task_definition_family_through_cloudformation_should_trigger_a_r
|
|||
"Description": "ECS Cluster Test CloudFormation",
|
||||
"Resources": {
|
||||
"testTaskDefinition": {
|
||||
"Type" : "AWS::ECS::TaskDefinition",
|
||||
"Properties" : {
|
||||
"Type": "AWS::ECS::TaskDefinition",
|
||||
"Properties": {
|
||||
"Family": "testTaskDefinition1",
|
||||
"ContainerDefinitions" : [
|
||||
"ContainerDefinitions": [
|
||||
{
|
||||
"Name": "ecs-sample",
|
||||
"Image":"amazon/amazon-ecs-sample",
|
||||
"Image": "amazon/amazon-ecs-sample",
|
||||
"Cpu": "200",
|
||||
"Memory": "500",
|
||||
"Essential": "true"
|
||||
}
|
||||
],
|
||||
"Volumes" : [],
|
||||
"Volumes": [],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1055,7 +1122,8 @@ def test_update_task_definition_family_through_cloudformation_should_trigger_a_r
|
|||
)
|
||||
|
||||
template2 = deepcopy(template1)
|
||||
template2['Resources']['testTaskDefinition']['Properties']['Family'] = 'testTaskDefinition2'
|
||||
template2['Resources']['testTaskDefinition'][
|
||||
'Properties']['Family'] = 'testTaskDefinition2'
|
||||
template2_json = json.dumps(template2)
|
||||
cfn_conn.update_stack(
|
||||
StackName="test_stack",
|
||||
|
|
@ -1065,7 +1133,8 @@ def test_update_task_definition_family_through_cloudformation_should_trigger_a_r
|
|||
ecs_conn = boto3.client('ecs', region_name='us-west-1')
|
||||
resp = ecs_conn.list_task_definitions(familyPrefix='testTaskDefinition')
|
||||
len(resp['taskDefinitionArns']).should.equal(1)
|
||||
resp['taskDefinitionArns'][0].endswith('testTaskDefinition2:1').should.be.true
|
||||
resp['taskDefinitionArns'][0].endswith(
|
||||
'testTaskDefinition2:1').should.be.true
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -1082,18 +1151,18 @@ def test_create_service_through_cloudformation():
|
|||
}
|
||||
},
|
||||
"testTaskDefinition": {
|
||||
"Type" : "AWS::ECS::TaskDefinition",
|
||||
"Properties" : {
|
||||
"ContainerDefinitions" : [
|
||||
"Type": "AWS::ECS::TaskDefinition",
|
||||
"Properties": {
|
||||
"ContainerDefinitions": [
|
||||
{
|
||||
"Name": "ecs-sample",
|
||||
"Image":"amazon/amazon-ecs-sample",
|
||||
"Image": "amazon/amazon-ecs-sample",
|
||||
"Cpu": "200",
|
||||
"Memory": "500",
|
||||
"Essential": "true"
|
||||
}
|
||||
],
|
||||
"Volumes" : [],
|
||||
"Volumes": [],
|
||||
}
|
||||
},
|
||||
"testService": {
|
||||
|
|
@ -1132,18 +1201,18 @@ def test_update_service_through_cloudformation_should_trigger_replacement():
|
|||
}
|
||||
},
|
||||
"testTaskDefinition": {
|
||||
"Type" : "AWS::ECS::TaskDefinition",
|
||||
"Properties" : {
|
||||
"ContainerDefinitions" : [
|
||||
"Type": "AWS::ECS::TaskDefinition",
|
||||
"Properties": {
|
||||
"ContainerDefinitions": [
|
||||
{
|
||||
"Name": "ecs-sample",
|
||||
"Image":"amazon/amazon-ecs-sample",
|
||||
"Image": "amazon/amazon-ecs-sample",
|
||||
"Cpu": "200",
|
||||
"Memory": "500",
|
||||
"Essential": "true"
|
||||
}
|
||||
],
|
||||
"Volumes" : [],
|
||||
"Volumes": [],
|
||||
}
|
||||
},
|
||||
"testService": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue