Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECS update_service with desiredCount does not affect runningCount #7664

Closed
yairsappir opened this issue May 2, 2024 · 1 comment · Fixed by #7714
Closed

ECS update_service with desiredCount does not affect runningCount #7664

yairsappir opened this issue May 2, 2024 · 1 comment · Fixed by #7714
Labels

Comments

@yairsappir
Copy link

yairsappir commented May 2, 2024

Hi,

When calling update_service with desiredCount=x, it doesn't affect the runningCount property of the service.

Steps to reproduce (snippet borrowed from test_ecs_boto3:

client = boto3.client("ecs", region_name=ECS_REGION)
client.create_cluster(clusterName="test_ecs_cluster")
client.register_task_definition(
    family="test_ecs_task",
    containerDefinitions=[
        {
            "name": "hello_world",
            "image": "docker/hello-world:latest",
            "cpu": 1024,
            "memory": 400,
            "essential": True,
            "environment": [
                {"name": "AWS_ACCESS_KEY_ID", "value": "SOME_ACCESS_KEY"}
            ],
            "logConfiguration": {"logDriver": "json-file"},
        }
    ],
)
response = client.create_service(
    cluster="test_ecs_cluster",
    serviceName="test_ecs_service",
    taskDefinition="test_ecs_task",
    desiredCount=2,
)
client.update_service(cluster="test_ecs_cluster", service="test_ecs_service", desiredCount=0)
running_count = ecs_client.describe_services(cluster="test_ecs_cluster", services=["test_ecs_service"])['services'][0]['runningCount']
assert 0 == running_count # this fails

Expected behavior would be that when calling update_service and changing the desiredCount, the runningCount should change accordingly.

Note:
The environment variable MOTO_ECS_SERVICE_RUNNING only sets the initial runningCount value, which is ok.

@rafcio19
Copy link
Contributor

rafcio19 commented May 3, 2024

@bblommers I can take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants