Skip to content

Commit

Permalink
fix: merge integration tests into single file
Browse files Browse the repository at this point in the history
  • Loading branch information
nsklikas committed Oct 19, 2023
1 parent ef24ae6 commit 89c15db
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 122 deletions.
40 changes: 40 additions & 0 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,43 @@ async def test_build_and_deploy(ops_test: OpsTest, charm, test_charm):
"openfga-requires", "0", ops_test.model.units
)
assert "running with store" in openfga_requires_unit.workload_status_message


@pytest.mark.abort_on_fail
async def test_upgrade_running_application(ops_test: OpsTest, charm):
"""Deploy latest published charm and upgrade it with charm-under-test.
Assert on the application status and health check endpoint after upgrade/refresh took place.
"""
# Starting upgrade/refresh
logger.debug("starting upgrade test")

# Build and deploy charm from local source folder
logger.debug("building local charm")

charm = await ops_test.build_charm(".")
resources = {"openfga-image": METADATA["resources"]["openfga-image"]["upstream-source"]}

# Deploy the charm and wait for active/idle status
logger.debug("refreshing running application with the new local charm")

await ops_test.model.applications[APP_NAME].refresh(
path=charm,
resources=resources,
)

async with ops_test.fast_forward():
await ops_test.model.wait_for_idle(
apps=[APP_NAME],
status="active",
timeout=60,
)

assert ops_test.model.applications[APP_NAME].status == "active"

upgraded_openfga_unit = await utils.get_unit_by_name(APP_NAME, "0", ops_test.model.units)

health = await upgraded_openfga_unit.run("curl -s http://localhost:8080/healthz")
await health.wait()
assert health.results.get("return-code") == 0
assert health.results.get("stdout").strip() == '{"status":"SERVING"}'
122 changes: 0 additions & 122 deletions tests/integration/test_upgrade.py

This file was deleted.

0 comments on commit 89c15db

Please sign in to comment.