agent: fix a data race in DNS tests

The dnsConfig pulled from the atomic.Value is a pointer, so modifying it in place
creates a data race. Use the exported ReloadConfig interface instead.
This commit is contained in:
Daniel Nephin 2021-06-08 19:25:55 -04:00
parent 970f5d78ec
commit 0acfc2c65b
1 changed files with 2 additions and 2 deletions

View File

@ -345,8 +345,8 @@ func (a *TestAgent) Client() *api.Client {
// DNSDisableCompression disables compression for all started DNS servers. // DNSDisableCompression disables compression for all started DNS servers.
func (a *TestAgent) DNSDisableCompression(b bool) { func (a *TestAgent) DNSDisableCompression(b bool) {
for _, srv := range a.dnsServers { for _, srv := range a.dnsServers {
cfg := srv.config.Load().(*dnsConfig) a.config.DNSDisableCompression = b
cfg.DisableCompression = b srv.ReloadConfig(a.config)
} }
} }