Repository navigation
[DurableTask.ServiceBus.Tests] Fix GetHubQueueMaxDeliveryCountsAsync throwing when a hub queue is missing - #1423
Closed
Davide Montanari (davidemontanari) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The uppercase Test/ paths exclude both new files from the test project on case-sensitive checkouts, breaking compilation and preventing regression-test discovery.
1 open issue
What changed in this PR
This PR fixes missing-queue handling in the Service Bus provider’s internal test helper and removes a secret-like connection string from offline tests.
Changes:
- Extracts queue-count lookup and uses
SingleOrDefaultso missing queues return-1. - Adds three offline regression tests for queue-count lookup.
- Introduces a shared token credential stub for offline service construction.
| File | Description |
|---|---|
test/DurableTask.ServiceBus.Tests/WaitForOrchestrationTests.cs |
Replaces the fake connection string with a credential stub. |
Test/DurableTask.ServiceBus.Tests/NoOpTokenCredential.cs |
Adds the shared offline credential helper. |
Test/DurableTask.ServiceBus.Tests/HubQueueMaxDeliveryCountsTests.cs |
Adds coverage for present and missing hub queues. |
src/DurableTask.ServiceBus/ServiceBusOrchestrationService.cs |
Extracts lookup logic and enables the missing-queue fallback. |
Review effort: Balanced
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes implement the intended fallback with targeted regression coverage and no identified blocking issues; tests were not run during this review.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Two small cleanups. Neither changes production behaviour:
GetHubQueueMaxDeliveryCountsAsyncisinternaland only used by the integration tests inTaskHubClientTests.1. Missing queues now return -1 instead of throwing
GetHubQueueMaxDeliveryCountsAsyncusedSingle(...)to find the orchestrator, worker and tracking queues. When a queue was missing,SinglethrewInvalidOperationException. Because of that, the existing?.MaxDeliveryCount ?? -1fallback could never run.SinglewithSingleOrDefault, so a missing queue returns-1as the fallback intended. InTestMaxDeliveryCountandTestMaxDeliveryCountIfNew, a missing queue now shows up as a clear assertion failure instead of an unrelated exception.GetHubQueueMaxDeliveryCounts(IEnumerable<QueueDescription>)method so it can be unit tested without a Service Bus namespace. The async method still fetches the queues and delegates to it.2. Removed connection strings with keys from offline tests
WaitForOrchestrationTestsused a fake connection string containingSharedAccessKey=.... Fake as it is, it looks like a secret and can trip secret scanners.NoOpTokenCredential, a shared test helper. It is aTokenCredentialstub that never returns a token, plus a placeholder host name.ServiceBusOrchestrationServicewith the host name andTokenCredentialconstructor instead of a connection string.Tests
HubQueueMaxDeliveryCountsTests, which runs offline usingServiceBusModelFactory:-1and the others keep their values.-1.Single, 2 of the 3 new tests fail; with the fix, all 3 pass.HubQueueMaxDeliveryCountsTestsandWaitForOrchestrationTestspass on net8.0 and net48 (24 tests).