Added DescribeJobDefinitions
This commit is contained in:
parent
558f246115
commit
0ca3fcc7a2
4 changed files with 262 additions and 24 deletions
|
|
@ -447,3 +447,127 @@ def test_register_task_definition():
|
|||
resp.should.contain('revision')
|
||||
|
||||
assert resp['jobDefinitionArn'].endswith('{0}:{1}'.format(resp['jobDefinitionName'], resp['revision']))
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ecs
|
||||
@mock_iam
|
||||
@mock_batch
|
||||
def test_reregister_task_definition():
|
||||
# Reregistering task with the same name bumps the revision number
|
||||
ec2_client, iam_client, ecs_client, batch_client = _get_clients()
|
||||
vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client)
|
||||
|
||||
resp1 = batch_client.register_job_definition(
|
||||
jobDefinitionName='sleep10',
|
||||
type='container',
|
||||
containerProperties={
|
||||
'image': 'busybox',
|
||||
'vcpus': 1,
|
||||
'memory': 128,
|
||||
'command': ['sleep', '10']
|
||||
}
|
||||
)
|
||||
|
||||
resp1.should.contain('jobDefinitionArn')
|
||||
resp1.should.contain('jobDefinitionName')
|
||||
resp1.should.contain('revision')
|
||||
|
||||
assert resp1['jobDefinitionArn'].endswith('{0}:{1}'.format(resp1['jobDefinitionName'], resp1['revision']))
|
||||
resp1['revision'].should.equal(1)
|
||||
|
||||
resp2 = batch_client.register_job_definition(
|
||||
jobDefinitionName='sleep10',
|
||||
type='container',
|
||||
containerProperties={
|
||||
'image': 'busybox',
|
||||
'vcpus': 1,
|
||||
'memory': 68,
|
||||
'command': ['sleep', '10']
|
||||
}
|
||||
)
|
||||
resp2['revision'].should.equal(2)
|
||||
|
||||
resp2['jobDefinitionArn'].should_not.equal(resp1['jobDefinitionArn'])
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ecs
|
||||
@mock_iam
|
||||
@mock_batch
|
||||
def test_delete_task_definition():
|
||||
ec2_client, iam_client, ecs_client, batch_client = _get_clients()
|
||||
vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client)
|
||||
|
||||
resp = batch_client.register_job_definition(
|
||||
jobDefinitionName='sleep10',
|
||||
type='container',
|
||||
containerProperties={
|
||||
'image': 'busybox',
|
||||
'vcpus': 1,
|
||||
'memory': 128,
|
||||
'command': ['sleep', '10']
|
||||
}
|
||||
)
|
||||
|
||||
batch_client.deregister_job_definition(jobDefinition=resp['jobDefinitionArn'])
|
||||
|
||||
resp = batch_client.describe_job_definitions()
|
||||
len(resp['jobDefinitions']).should.equal(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ecs
|
||||
@mock_iam
|
||||
@mock_batch
|
||||
def test_describe_task_definition():
|
||||
ec2_client, iam_client, ecs_client, batch_client = _get_clients()
|
||||
vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client)
|
||||
|
||||
resp = batch_client.register_job_definition(
|
||||
jobDefinitionName='sleep10',
|
||||
type='container',
|
||||
containerProperties={
|
||||
'image': 'busybox',
|
||||
'vcpus': 1,
|
||||
'memory': 128,
|
||||
'command': ['sleep', '10']
|
||||
}
|
||||
)
|
||||
arn1 = resp['jobDefinitionArn']
|
||||
resp = batch_client.register_job_definition(
|
||||
jobDefinitionName='sleep10',
|
||||
type='container',
|
||||
containerProperties={
|
||||
'image': 'busybox',
|
||||
'vcpus': 1,
|
||||
'memory': 64,
|
||||
'command': ['sleep', '10']
|
||||
}
|
||||
)
|
||||
arn2 = resp['jobDefinitionArn']
|
||||
resp = batch_client.register_job_definition(
|
||||
jobDefinitionName='test1',
|
||||
type='container',
|
||||
containerProperties={
|
||||
'image': 'busybox',
|
||||
'vcpus': 1,
|
||||
'memory': 64,
|
||||
'command': ['sleep', '10']
|
||||
}
|
||||
)
|
||||
arn3 = resp['jobDefinitionArn']
|
||||
|
||||
resp = batch_client.describe_job_definitions(
|
||||
jobDefinitionName='sleep10'
|
||||
)
|
||||
len(resp['jobDefinitions']).should.equal(2)
|
||||
|
||||
resp = batch_client.describe_job_definitions()
|
||||
len(resp['jobDefinitions']).should.equal(3)
|
||||
|
||||
resp = batch_client.describe_job_definitions(
|
||||
jobDefinitions=['sleep10', 'test1']
|
||||
)
|
||||
len(resp['jobDefinitions']).should.equal(3)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue