Skip to content

Delete leaked minion keys at teardown in integration test fixtures (#69728)#69729

Open
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-69728-integration-key-leak
Open

Delete leaked minion keys at teardown in integration test fixtures (#69728)#69729
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-69728-integration-key-leak

Conversation

@ggiesen

@ggiesen ggiesen commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Implements option 1 from #69728: the startup_states and salt-call ownership integration test fixtures now delete their extra minions' accepted keys from the shared session master at teardown.

Both modules start additional minions with with factory.started(): yield factory, which stops the minion process but leaves its accepted key on the master. Later tests in the same pytest session that target * -- the netapi integration tests -- key-match those dead minions, producing the failure pair seen on most 3006.x PR runs ("Rocky Linux 9 integration tcp/zeromq"):

AssertionError: assert ['minion-T1psGj', 'minion-T1psGj-empty-string', 'minion-T1psGj-highstate',
                        'minion-T1psGj-sls', 'minion-T1psGj-top', 'non-root-minion-YWdURX',
                        'sub-minion-7ENuRT'] == ['minion-T1psGj', 'sub-minion-7ENuRT']

plus TimeoutError: Operation timed out after 30 seconds on the synchronous variants waiting for returns from minions that no longer exist. Nightly runs never see it because test sharding separates the leaking modules from the netapi assertions.

What issues does this PR fix or reference?

Fixes #69728

Previous Behavior

Extra minions' keys accumulated on the session master; netapi *-targeting tests failed with inflated minion lists and 30 s timeouts on most PR runs, while nightly stayed green.

New Behavior

Each fixture removes its minion's key (salt-key -d <id> -y via the master factory) once the minion is stopped, restoring the isolation the netapi assertions rely on. The cleanup call semantics were validated against a live salt-factories master (planted an accepted key file, ran the exact call, key removed, exit code 0). The tests themselves are unchanged -- only teardown is added.

This keeps the netapi tests' strict * assertions intact. Hardening those tests against foreign keys (option 2 in the issue) can still be done separately if desired.

Merge requirements satisfied?

  • Changelog

Test-only change; the affected tests are exercised by the same CI jobs this PR aims to stabilize.

Commits signed with GPG?

No

The startup_states and salt_call ownership test modules start extra
minions against the shared session master via 'with factory.started():
yield'. That stops the minion process at teardown but leaves the
accepted key on the master, so later tests in the same session that
target '*' (the netapi integration tests) key-match minions that no
longer exist. The result is the Rocky Linux 9 integration tcp/zeromq
pair failing most 3006.x PR runs:

    AssertionError: assert ['minion-X', 'minion-X-empty-string',
    'minion-X-highstate', 'minion-X-sls', 'minion-X-top',
    'non-root-minion-Y', 'sub-minion-Z'] == ['minion-X', 'sub-minion-Z']

plus 30 second TimeoutErrors waiting for returns from the dead minions.
Nightly runs do not hit it because test sharding separates these
modules from the netapi tests.

Remove each extra minion's key from the master once the minion is
stopped, restoring the isolation the netapi assertions rely on.

Fixes saltstack#69728
@dwoz dwoz added the test:full Run the full test suite label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants