@@ -837,7 +837,7 @@ func TestBlockedRequest(t *testing.T) {
837837func TestServerCustomClientUpstream (t * testing.T ) {
838838 const defaultCacheSize = 1024 * 1024
839839
840- var upsCalledCounter uint32
840+ var upsCalledCounter atomic. Uint32
841841
842842 forwardConf := ServerConfig {
843843 UDPListenAddrs : []* net.UDPAddr {{}},
@@ -862,7 +862,7 @@ func TestServerCustomClientUpstream(t *testing.T) {
862862 )
863863
864864 ups := aghtest .NewUpstreamMock (func (req * dns.Msg ) (resp * dns.Msg , err error ) {
865- atomic . AddUint32 ( & upsCalledCounter , 1 )
865+ upsCalledCounter . Add ( 1 )
866866
867867 return cmp .Or (
868868 aghtest .MatchedResponse (req , dns .TypeA , "host" , "192.168.0.1" ),
@@ -902,11 +902,11 @@ func TestServerCustomClientUpstream(t *testing.T) {
902902
903903 assert .Equal (t , dns .RcodeSuccess , reply .Rcode )
904904 assert .Equal (t , net.IP {192 , 168 , 0 , 1 }, reply .Answer [0 ].(* dns.A ).A )
905- assert .Equal (t , uint32 (1 ), atomic . LoadUint32 ( & upsCalledCounter ))
905+ assert .Equal (t , uint32 (1 ), upsCalledCounter . Load ( ))
906906
907907 _ , err = dns .Exchange (req , addr )
908908 require .NoError (t , err )
909- assert .Equal (t , uint32 (1 ), atomic . LoadUint32 ( & upsCalledCounter ))
909+ assert .Equal (t , uint32 (1 ), upsCalledCounter . Load ( ))
910910}
911911
912912// testCNAMEs is a map of names and CNAMEs necessary for the TestUpstream work.
@@ -1576,10 +1576,10 @@ func TestPTRResponseFromHosts(t *testing.T) {
15761576 OnHostByIP : func (ip netip.Addr ) (host string ) { return "" },
15771577 }
15781578
1579- var eventsCalledCounter uint32
1579+ var eventsCalledCounter atomic. Uint32
15801580 watcher := aghtest .NewFSWatcher ()
15811581 watcher .OnEvents = func () (e <- chan aghos.Event ) {
1582- assert .Equal (t , uint32 (1 ), atomic . AddUint32 ( & eventsCalledCounter , 1 ))
1582+ assert .Equal (t , uint32 (1 ), eventsCalledCounter . Add ( 1 ))
15831583
15841584 return nil
15851585 }
@@ -1593,7 +1593,7 @@ func TestPTRResponseFromHosts(t *testing.T) {
15931593 hc , err := aghnet .NewHostsContainer (ctx , testLogger , testFS , watcher , hostsFilename )
15941594 require .NoError (t , err )
15951595 t .Cleanup (func () {
1596- assert .Equal (t , uint32 (1 ), atomic . LoadUint32 ( & eventsCalledCounter ))
1596+ assert .Equal (t , uint32 (1 ), eventsCalledCounter . Load ( ))
15971597 })
15981598
15991599 flt , err := filtering .New (& filtering.Config {
0 commit comments