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

Add failed state and test second deploy #8090

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
added last test
  • Loading branch information
wouterdb committed Sep 13, 2024
commit dc3665cf652dcad9c4f2ac5a60d08b2da0b27e81
15 changes: 12 additions & 3 deletions tests/agent_server/deploy/e2e/test_scheduler_e2e_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import logging

import pytest

from agent_server.deploy.e2e.util import wait_full_success
from inmanta import const
from inmanta.deploy.state import DeploymentResult
Expand Down Expand Up @@ -125,6 +123,17 @@ async def make_version(is_different=False):
await resource_action_consistency_check()
await check_server_state_vs_scheduler_state(client, environment, scheduler)

# check states
result = await client.resource_list(environment, deploy_summary=True)
assert result.code == 200
summary = result.result["metadata"]["deploy_summary"]
# {'by_state': {'available': 3, 'cancelled': 0, 'deployed': 12, 'deploying': 0, 'failed': 0, 'skipped': 0,
# 'skipped_for_undefined': 0, 'unavailable': 0, 'undefined': 0}, 'total': 15}
print(summary)
assert 10 == summary["by_state"]["deployed"]
assert 1 == summary["by_state"]["failed"]
assert 4 == summary["by_state"]["skipped"]

version1, resources = await make_version(True)
await clienthelper.put_version_simple(version=version1, resources=resources)

Expand All @@ -143,6 +152,7 @@ async def make_version(is_different=False):

await wait_full_success(client, environment)


async def check_server_state_vs_scheduler_state(client, environment, scheduler):
result = await client.resource_list(environment, deploy_summary=True)
assert result.code == 200
Expand All @@ -160,7 +170,6 @@ async def check_server_state_vs_scheduler_state(client, environment, scheduler):
assert state_correspondence[status] == state.deployment_result



async def check_scheduler_state(resources, scheduler):
# State consistency check
for resource in resources:
Expand Down