Merge pull request #1697 from spulec/ecs-tasks

Improve ECS update_service and describing tasks.
This commit is contained in:
Steve Pulec 2018-06-24 20:39:16 -04:00 committed by GitHub
commit bb6da93891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 4 deletions

View file

@ -2,6 +2,7 @@ from __future__ import unicode_literals
from copy import deepcopy
from botocore.exceptions import ClientError
import boto3
import sure # noqa
import json
@ -450,6 +451,21 @@ def test_update_service():
response['service']['desiredCount'].should.equal(0)
@mock_ecs
def test_update_missing_service():
client = boto3.client('ecs', region_name='us-east-1')
_ = client.create_cluster(
clusterName='test_ecs_cluster'
)
client.update_service.when.called_with(
cluster='test_ecs_cluster',
service='test_ecs_service',
taskDefinition='test_ecs_task',
desiredCount=0
).should.throw(ClientError)
@mock_ecs
def test_delete_service():
client = boto3.client('ecs', region_name='us-east-1')
@ -1054,6 +1070,13 @@ def test_describe_tasks():
set([response['tasks'][0]['taskArn'], response['tasks']
[1]['taskArn']]).should.equal(set(tasks_arns))
# Test we can pass task ids instead of ARNs
response = client.describe_tasks(
cluster='test_ecs_cluster',
tasks=[tasks_arns[0].split("/")[-1]]
)
len(response['tasks']).should.equal(1)
@mock_ecs
def describe_task_definition():