chore: improve docker test shutdown reliability (#4576)

This commit is contained in:
David Zhao
2026-06-08 08:27:15 -07:00
committed by GitHub
parent bfd9deffd7
commit e0815be27d
+3 -1
View File
@@ -75,7 +75,9 @@ func runRedis(t testing.TB) string {
t.Fatal(err) t.Fatal(err)
} }
t.Cleanup(func() { t.Cleanup(func() {
_ = c.Close(t.Context()) // t.Context() is canceled before cleanup funcs run, so use a
// non-canceled context to let the container stop/remove complete.
_ = c.Close(context.Background())
}) })
addr := c.GetHostPort("6379/tcp") addr := c.GetHostPort("6379/tcp")
waitTCPPort(t, addr) waitTCPPort(t, addr)