Skip to content

Commit 94af7c2

Browse files
committed
Merge remote-tracking branch 'origin/main' into test/ci-retry-transient-test-failures
2 parents 6fc92d9 + 0d111f6 commit 94af7c2

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

tests/Agent/IntegrationTests/SharedApplications/Common/MultiFunctionApplicationHelpers/NetStandardLibraries/NServiceBus/NServiceBusDriver.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ namespace MultiFunctionApplicationHelpers.NetStandardLibraries.NServiceBus;
1919
[Library]
2020
class NServiceBusDriver
2121
{
22+
// A queue this endpoint does not consume. SendCommandInTransaction routes the command here
23+
// (instead of SendLocal) so the produce-side instrumentation is exercised without also
24+
// producing an incidental no-handler "Consume" transaction on this same endpoint. That
25+
// incidental transaction has a variable duration and competes with the Send transaction for
26+
// the single slowest-trace slot per harvest window, which made NsbSendTests flaky. The
27+
// asserted Produce metric is named from the message type, not the destination queue, so
28+
// routing the command elsewhere leaves all NsbSendTests assertions unchanged.
29+
private const string UnconsumedDestinationQueue = "NsbSendTestsUnconsumedQueue";
30+
2231
// NServiceBus 10.2 deprecated the self-hosting API (IEndpointInstance, Endpoint.Start/Stop) in favor
2332
// of an IHostApplicationBuilder-based host with IServiceCollection.AddNServiceBusEndpoint. These MFA
2433
// console apps have no generic host and only start an endpoint on demand when a test exercises
@@ -140,7 +149,9 @@ public async Task PublishEvent()
140149
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
141150
public async Task SendCommandInTransaction()
142151
{
143-
await SendCommand();
152+
var command = new Command();
153+
ConsoleMFLogger.Info($"Sending NServiceBus Command with Id: {command.Id} to {UnconsumedDestinationQueue}");
154+
await _endpoint.Send(UnconsumedDestinationQueue, command);
144155
}
145156

146157
[LibraryMethod]

tests/Agent/IntegrationTests/UnboundedIntegrationTests/MsSql/MsSqlQueryParamTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public MsSqlQueryParamTestsBase(TFixture fixture, ITestOutputHelper output, stri
6161
{
6262
_fixture.AgentLog.WaitForLogLine(AgentLogBase.AgentConnectedLogLineRegex, TimeSpan.FromMinutes(1));
6363
_fixture.AgentLog.WaitForLogLine(AgentLogBase.SqlTraceDataLogLineRegex, TimeSpan.FromMinutes(1));
64+
_fixture.AgentLog.WaitForMetricAggregateCallCount("Datastore/all", 2, TimeSpan.FromMinutes(2));
6465
}
6566
);
6667

0 commit comments

Comments
 (0)