Skip to content

fix(amqp): repair cleanup test fixtures - #7535

Open
Johnathan W (j7nw4r) wants to merge 1 commit into
mainfrom
fix/eventhubs-cleanup-test-fixtures
Open

Johnathan W (j7nw4r) wants to merge 1 commit into
mainfrom
fix/eventhubs-cleanup-test-fixtures

Conversation

@j7nw4r

Copy link
Copy Markdown
Member

Summary

Fix the AMQP retry death test's MSVC compilation error and the mock-server shutdown failure in Event Hubs cleanup tests.

Motivation

#7511 added both failing tests. The retry test nests exception assertions inside EXPECT_EXIT, which generates duplicate GoogleTest labels on MSVC. The Event Hubs test closes its client connection before the mock session sends END. That send fails, and the mock destructor retries partial shutdown during stack unwinding.

These test-only changes support release preparation in #7532. Production code and release metadata remain unchanged.

Changes

  • Move the retry sequence and its assertions into a helper outside EXPECT_EXIT. Keep the exception, retry, idle-state, and child-exit expectations.
  • Release mock link owners before session shutdown, then release sessions and connections. Mark shutdown as started before cleanup to prevent destructor retries.
  • Log runtime_error("Could not end session") only after an observed terminal connection state. Report other session shutdown errors through GoogleTest.
  • Extend the discovery tests to stop the mock twice and require idle polling before mock destruction. Keep the close-failure notification and exactly-one-End assertions.

Validation

  • Windows Release x64 static build with native uAMQP, WinHTTP, Rust disabled, and warnings as errors passed. The build includes both AMQP test executables, both Event Hubs test executables, and public samples.
  • SessionCleanupDeathTest.FailedEndCanBeRetried passed in the actual AMQP test executable. Ten isolated runs of PropertiesCleanupDeathTest.ManagementCloseFailureStillEndsSession passed with captured output.
  • The selected Event Hubs offline suites passed 98/98 tests across 11 suites, including cleanup, concurrent operations, and cancellation.
  • The full relevant AMQP offline suites passed 274/276 tests. TestCbs.CbsOpenNoListener and TestMessageSendReceive.SenderCloseWhileUnsettledSendIgnoresLateDisposition failed. An isolated snapshot of upstream commit 8021f71052bbf87ccf1c2b470e2af436d37c86ff, with only the required compiler helper fix, produced the same two failures.
  • An isolated GoogleTest macro compile probe passed with both /Zc:preprocessor- and /Zc:preprocessor. This probe tests macro extraction only. A full /Zc:preprocessor build failed in vendored optionhandler.h with missing UMOCK_C_PROD_ARG_IN_SIGNATURE and MU_FOR_EACH_2_COUNTED_* macros.
  • Local clang-format 19.1.5 and whitespace checks passed. CI supplies the required clang-format 20 gate and the platform matrix.
  • Localhost mocks used AZURE_TEST_MODE=LIVE with the proxy disabled. Azure live tests remain unrun because service configuration and credentials are unavailable. The Blob checkpoint store integration tests also require Azure Storage.

Move retry assertions outside the death-test macro to avoid duplicate
GoogleTest labels on MSVC.

Release mock link and session owners during shutdown. Log the known
session-End error after peer closure and report other shutdown errors
as test failures. Test repeated shutdown and idle state before mock
destruction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 24a4d885-ae9e-4ead-aecb-b07d53634716
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
7 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the test-fixture cleanup changes.

No open issues 🎉

What changed in this PR

Repairs AMQP and Event Hubs cleanup test fixtures introduced in #7511, supporting release preparation in #7532 without changing production code or release metadata.

Changes:

  • Moves retry assertions into a helper outside EXPECT_EXIT to avoid duplicate GoogleTest labels on MSVC.
  • Orders mock resource cleanup, prevents repeated shutdown, and distinguishes expected session-end failures after connection termination from unexpected errors.
  • Extends discovery cleanup tests to verify repeated shutdown and idle polling before mock destruction.
File Description
sdk/​eventhubs/​azure-messaging-eventhubs/​test/​ut/​properties_cleanup_test.cpp Adds repeated-stop and idle-polling checks.
sdk/​core/​azure-core-amqp/​test/​ut/​session_cleanup_tests.cpp Extracts retry assertions into an MSVC-compatible helper.
sdk/​core/​azure-core-amqp/​test/​ut/​mock_amqp_server.hpp Repairs shutdown ordering, resource release, and error handling.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

4 participants