Skip to content

fix(test): wait for config-changed hook after juju.config() in set_app_runner_amount - #810

Draft
yanksyoon wants to merge 29 commits into
mainfrom
fix/integration-test-config-race
Draft

fix(test): wait for config-changed hook after juju.config() in set_app_runner_amount#810
yanksyoon wants to merge 29 commits into
mainfrom
fix/integration-test-config-race

Conversation

@yanksyoon

Copy link
Copy Markdown
Member

Problem

test_check_runner in test_charm_runner.py fails with Timeout waiting for 2 runner(s) to be ready. Investigation on the debug tmate session revealed:

  • The service config file had base_virtual_machines: 0 throughout the test
  • Service logs showed desired=0 current=0 every reconcile cycle
  • Only one config-changed hook fired (at 15:34:20), none after the test called juju.config()
  • jubilant.Juju.config() is fire-and-forget — it returns before the hook fires

The test polls check-runners while the service is still running with the previous base_virtual_machines value.

Fix

Three changes in two files:

  1. Verify config was applied — read back the config after juju.config() and assert
  2. Wait for model settlejuju.wait(all_active) after config change so the hook completes
  3. Pre-poll grace period — 30s sleep before first check-runners poll in wait_for_runner_ready

Testing

  • Unit tests: 214 passed
  • Integration: [monitoring CI]

cbartz and others added 22 commits July 16, 2026 13:38
Add a script that deletes dangling servers, keypairs, images and
test security groups left by integration tests, plus a 6-hourly
workflow on the private-endpoint runner.
Drop the scheduled cleanup workflow. Force-cancelled runs leave
resources behind; the next integration suite now deletes CI-named
OpenStack leftovers older than 6h before creating new ones.
Public cleanup entry point first; private helpers below. Module-level
imports in conftest instead of inline.
Keypairs often lack created_at; treating unknown age as stale risked
deleting in-progress CI resources. Skip those instead.
Wait for server delete before SGs, keep OpenStack teardown inside the
connection context, best-effort start-up reaping, and tighten
test-id regexes to the 8-char CI ids we generate.
Align OpenStack teardown/orphan helpers with existing integration
suite call conventions.
Keep suite call style consistent; openstacksdk accepts the name
positionally as used elsewhere in this repository.
Drop wait= on image delete (not supported), materialize list_servers,
and log orphan cleanup failures with exc_info.
--use-existing-app-suffix is for local runs that keep long-lived
resources; do not reap them at suite start.
Single source of truth for test resource names (charm naming.py,
manager factories). Orphan cleanup consumes those matchers, no longer
redefines regexes, deletes SGs, or uses future annotations. Only
servers/images/keypairs that round-trips create are reaped.
Replace fuzzy shorthand (manager-IT, CI-named) with explicit references
to github-runner-manager vs charm integration suites and what they create.
Drop matching algorithms and implementation notes from interface
comments; the code already encodes those details.
Longer prefixes first is for readability, not early-exit matching.
Charm app suffixes always start with a lowercase letter; keep manager
test-runner- ids free to begin with a digit.
Exact name filters miss runner VMs named test-<suffix>-N. Also soften
naming module wording around suite scope and random suffixes.
Catch only ResourceNotFound and ConflictException instead of broad
Exception. Unexpected failures (auth, bugs) now propagate. Inline the
try/except at each resource loop instead of a shared helper.
Satisfies flake8 complexity (C901) and docstring (DCO010) rules.
…n arg

- Extract suite teardown from openstack_connection_fixture to reduce
  flake8 complexity below 10.
- Add Args/Returns docstring sections to satisfy DCO020/DCO030.
- Remove unused connection param from _delete_resource helper.
jubilant.Juju.config() is fire-and-forget — it sets the config and returns
before the config-changed hook fires. The test then polls check-runners
while the service is still running with the previous base_virtual_machines
value, causing a timeout waiting for runners.

Three changes:
1. Verify config was applied by reading back after juju.config()
2. Wait for model to settle (juju.wait(all_active)) after config change
   so the config-changed hook completes and the service restarts with the
   new base_virtual_machines value
3. Add a 30s pre-poll grace period in wait_for_runner_ready to give the
   service time to start creating runners before the first check
@yanksyoon

Copy link
Copy Markdown
Member Author

Re-enabled tmate debug for the integration test jobs to inspect the runner and OpenStack VM state during failures.

Base automatically changed from ci/openstack-ci-resource-cleanup to main August 1, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants