Skip to content

Commit 0475635

Browse files
tobias-tenglermichaelstaib
authored andcommitted
(Hopefully) Fix flakey test (#8056)
1 parent 06365e4 commit 0475635

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs

+10-6
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public async Task Ensure_Warmups_Are_Triggered_An_Appropriate_Number_Of_Times()
7171
// arrange
7272
var typeModule = new TriggerableTypeModule();
7373
var warmups = 0;
74-
var resetEvent = new AutoResetEvent(false);
74+
var warmupResetEvent = new AutoResetEvent(false);
7575

7676
var services = new ServiceCollection();
7777
services
@@ -80,7 +80,7 @@ public async Task Ensure_Warmups_Are_Triggered_An_Appropriate_Number_Of_Times()
8080
.InitializeOnStartup(keepWarm: true, warmup: (_, _) =>
8181
{
8282
warmups++;
83-
resetEvent.Set();
83+
warmupResetEvent.Set();
8484
return Task.CompletedTask;
8585
})
8686
.AddQueryType(d => d.Field("foo").Resolve(""));
@@ -99,15 +99,19 @@ public async Task Ensure_Warmups_Are_Triggered_An_Appropriate_Number_Of_Times()
9999

100100
// act
101101
// assert
102+
warmupResetEvent.WaitOne();
103+
104+
Assert.Equal(1, warmups);
105+
warmupResetEvent.Reset();
106+
102107
typeModule.TriggerChange();
103-
resetEvent.WaitOne();
108+
warmupResetEvent.WaitOne();
104109

105-
// 2 since we have the initial warmup at "startup" and the one triggered above.
106110
Assert.Equal(2, warmups);
111+
warmupResetEvent.Reset();
107112

108-
resetEvent.Reset();
109113
typeModule.TriggerChange();
110-
resetEvent.WaitOne();
114+
warmupResetEvent.WaitOne();
111115

112116
Assert.Equal(3, warmups);
113117
}

0 commit comments

Comments
 (0)