Skip to content

Commit d49aabf

Browse files
Fix flaky ClaimTypesConst tests by serializing the Security test assembly (#171)
ClaimTypesConstTests.Configure_AppliesCustomValues intermittently failed on CI (seeing the default role claim URI instead of the configured "roles"). Root cause is a cross-class race on the process-wide mutable static ClaimTypesConst: both ClaimTypesConstTests and ClaimsIdentityExtensionsTests call the internal Reset() in ctor/Dispose, and under xUnit's default per-class parallelism a parallel Reset() can null the options mid-test so a later property read rebuilds defaults. Disable test parallelization for RCommon.Security.Tests so the shared static state is deterministic. Pre-existing flake, unrelated to the 3.1.1 changes; it blocked the release CI run. Co-authored-by: jasonmwebb-lv <jason.webb@leadventure.com>
1 parent 63ad76e commit d49aabf

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Xunit;
2+
3+
// Several test classes in this assembly exercise ClaimTypesConst, which is a process-wide mutable
4+
// static (configure-once-at-startup). ClaimTypesConstTests and ClaimsIdentityExtensionsTests both
5+
// call the internal ClaimTypesConst.Reset() in their constructor/Dispose for isolation. Under xUnit's
6+
// default per-class parallelism these classes race on that global: a parallel Reset() can null the
7+
// options mid-test, so a subsequent property read rebuilds defaults and a configured value (e.g. a
8+
// custom Role) reverts to the default claim URI. Serialize the assembly's tests to make the shared
9+
// static state deterministic.
10+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

0 commit comments

Comments
 (0)