test: use typed atomics in test files (#25071)

Use typed atomics (atomic.Int64, atomic.Int32, etc.) in test files to prevent
mixing atomic and non-atomic access on the same value, guarantee 64-bit
alignment on 32-bit platforms, and provide a cleaner API.
This commit is contained in:
Zach
2026-05-11 08:41:17 -06:00
committed by GitHub
parent a1dbd758bc
commit 81e2be69e9
21 changed files with 115 additions and 116 deletions
+3 -3
View File
@@ -407,7 +407,7 @@ func (failingHealthcheck) Ping(context.Context) (time.Duration, error) {
type wrappedListener struct {
net.Listener
dials int32
dials atomic.Int32
}
func (w *wrappedListener) Accept() (net.Conn, error) {
@@ -416,12 +416,12 @@ func (w *wrappedListener) Accept() (net.Conn, error) {
return nil, err
}
atomic.AddInt32(&w.dials, 1)
w.dials.Add(1)
return conn, nil
}
func (w *wrappedListener) getDials() int {
return int(atomic.LoadInt32(&w.dials))
return int(w.dials.Load())
}
type agentWithID struct {