Skip to content

Commit

Permalink
Attempt at fixing occasionally failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Aug 21, 2024
1 parent 6366315 commit 16885d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ConfigCat.Client.Tests/ConfigServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ public async Task AutoPollConfigService_GetConfig_FetchesConfigWhenCachedConfigI
cts.Cancel();
clientReadyCalled = task == clientReadyTask && task.Status == TaskStatus.RanToCompletion;

await Task.Yield();

// Wait for the hook event handlers to execute (as that might not happen if the service got disposed immediately).
SpinWait.SpinUntil(() => configFetchedEvents.TryPeek(out _), TimeSpan.FromSeconds(1));
}
Expand Down Expand Up @@ -835,6 +837,8 @@ public async Task AutoPollConfigService_GetConfig_ReturnsExpiredConfigWhenCantRe
cts.Cancel();
clientReadyCalled = task == clientReadyTask && task.Status == TaskStatus.RanToCompletion;

await Task.Yield();

// Wait for the hook event handlers to execute (as that might not happen if the service got disposed immediately).
SpinWait.SpinUntil(() => configFetchedEvents.TryPeek(out _), TimeSpan.FromSeconds(1));
}
Expand Down

0 comments on commit 16885d5

Please sign in to comment.