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.
func (a *TestAgent) DNSDisableCompression(b bool) {
for _, srv := range a.dnsServers {
cfg := srv.config.Load().(*dnsConfig)
cfg.DisableCompression = b
a.config.DNSDisableCompression = b
srv.ReloadConfig(a.config)
}
}