mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
consul: Fix data race within test by using mutex to read map. (#25977)
This commit is contained in:
@@ -404,8 +404,11 @@ func TestConsul_ShutdownBlocked(t *testing.T) {
|
||||
}
|
||||
require.NoError(ctx.ServiceClient.RegisterAgent("client", agentServices))
|
||||
require.Eventually(ctx.ServiceClient.hasSeen, time.Second, 10*time.Millisecond)
|
||||
|
||||
ctx.FakeConsul.mu.Lock()
|
||||
require.Len(ctx.FakeConsul.services["default"], 1, "expected agent service to be registered")
|
||||
require.Len(ctx.FakeConsul.checks["default"], 1, "expected agent check to be registered")
|
||||
ctx.FakeConsul.mu.Unlock()
|
||||
|
||||
// prevent normal shutdown by blocking Consul. the shutdown should wait
|
||||
// until agent deregistration has finished
|
||||
|
||||
Reference in New Issue
Block a user