Skip to content

Commit f10fdb6

Browse files
authored
[Internal] CI: Adds meaningful failure message on assert failure (#5513)
## Description The test randomly fails with `Assert.IsTrue()` failed, without enough context on what is failing. Adding information useful for the context ## Type of change - [x] Bug fix (non-breaking change which fixes an issue)
1 parent 106dab3 commit f10fdb6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAvailabilityStrategyTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,14 @@ public async Task AvailabilityStrategyNoTriggerTest(bool isPreferredLocationsEmp
267267
if (isPreferredLocationsEmpty)
268268
{
269269
Assert.IsTrue(traceDiagnostic.ToString()
270-
.Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]"));
270+
.Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]"),
271+
$"{traceDiagnostic} does not contain expected regions \"{region1}\", \"{region2}\", \"{region3}\"");
271272
}
272273
else
273274
{
274275
Assert.IsTrue(traceDiagnostic.ToString()
275-
.Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]"));
276+
.Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]"),
277+
$"{traceDiagnostic} does not contain expected regions \"{region1}\", \"{region2}\"");
276278
}
277279
}
278280
;

0 commit comments

Comments
 (0)