cleanup: flakey tests and race conditions

This commit is contained in:
Jay
2026-06-04 12:07:03 -04:00
parent b5b0ec77ba
commit dda3bfd5b7
4 changed files with 15 additions and 8 deletions
+8 -1
View File
@@ -16,8 +16,11 @@ func TestAuthManager(t *testing.T) {
p, envoy := newMockEnvoy(t, WithEmbassyObserver(obs))
signed := []byte(`{"kind":22242}`)
var mu sync.Mutex
var calledWith string
callback := func(challenge string) ([]byte, error) {
mu.Lock()
defer mu.Unlock()
calledWith = challenge
return signed, nil
}
@@ -28,7 +31,11 @@ func TestAuthManager(t *testing.T) {
p.connect()
p.receive([]byte(envelope.EncloseAuthChallenge("abc")))
Eventually(t, func() bool { return calledWith == "abc" },
Eventually(t, func() bool {
mu.Lock()
defer mu.Unlock()
return calledWith == "abc"
},
"callback not called with challenge")
Eventually(t, func() bool {