Skip to content

Delete leaf device identities in one-time test teardown#7522

Draft
damonbarry wants to merge 1 commit into
Azure:mainfrom
damonbarry:fix-RouteMessageL3LeafToL4Module
Draft

Delete leaf device identities in one-time test teardown#7522
damonbarry wants to merge 1 commit into
Azure:mainfrom
damonbarry:fix-RouteMessageL3LeafToL4Module

Conversation

@damonbarry

Copy link
Copy Markdown
Member

Summary

This change updates end-to-end test cleanup so leaf device identities are deleted during suite teardown instead of inside each individual test cleanup path.

Problem

In nested end-to-end scenarios, leaf identity deletion can be slow enough to consume the per-test timeout budget.
For RouteMessageL3LeafToL4Module specifically, test execution could succeed functionally but still time out while deleting leaf identity in the test-finally block.

What changed

  • Added a dedicated leaf cleanup collection on test context.
  • Registered created leaf devices in that collection at creation call sites across the E2E test suite.
  • Removed per-test leaf identity deletion from test-finally blocks.
  • Extended one-time teardown to delete all queued leaf identities using the teardown timeout token.

Why this approach

  • Aligns leaf cleanup behavior with existing edge device cleanup strategy.
  • Keeps test timeout focused on test behavior, not cloud identity teardown latency.
  • Reduces flakiness in nested topologies where cleanup can be slower.

Scope

Applied to all current E2E test call sites that create leaf devices, including:

  • Device tests
  • Device with custom certificates tests
  • Plug and Play tests
  • X509 device tests

Validation

  • Verified that the nested end-to-end tests pass

Expected impact

  • Fewer false-negative timeouts caused by cleanup latency.
  • No functional change to test assertions or message validation logic.
  • Leaf identity deletion still occurs, but now under teardown timeout budget.

Risk and mitigation

  • Risk: if teardown is interrupted, leaf identities may remain temporarily.
  • Mitigation: cleanup remains centralized and bounded by teardown timeout; behavior matches existing edge identity cleanup pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant