From f8b45ae068f5603860b078e090bca741224ba1af Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 3 Jun 2026 16:34:59 -0400 Subject: [PATCH] test: AuthManager close cleans up --- auth_test.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/auth_test.go b/auth_test.go index 7e23420..df43952 100644 --- a/auth_test.go +++ b/auth_test.go @@ -182,8 +182,20 @@ func TestAuthManager(t *testing.T) { }) t.Run("close cleans up", func(t *testing.T) { - // m.Close() - // feed another AUTH - // Never: callback invoked after close + p, envoy := newMockEnvoy(t) + + called := false + callback := func(challenge string) ([]byte, error) { + called = true + return []byte(`{"kind":22242}`), nil + } + + m := NewAuthManager(envoy, callback) + p.connect() + m.Close() + + p.receive([]byte(envelope.EncloseAuthChallenge("abc"))) + + Never(t, func() bool { return called }, "callback should not fire after Close") }) }