diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 1074b6fc0cc..a6adb1dfa59 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -2871,7 +2871,7 @@ func (d *DNSConfig) IsZero() bool { if d == nil { return true } - return len(d.Options) == 0 || len(d.Searches) == 0 || len(d.Servers) == 0 + return len(d.Options) == 0 && len(d.Searches) == 0 && len(d.Servers) == 0 } // NetworkResource is used to represent available network diff --git a/nomad/structs/structs_test.go b/nomad/structs/structs_test.go index 5a2c49e3a67..2f21675f62b 100644 --- a/nomad/structs/structs_test.go +++ b/nomad/structs/structs_test.go @@ -7580,6 +7580,7 @@ func TestDNSConfig_Equal(t *testing.T) { must.Equal[*DNSConfig](t, nil, nil) must.NotEqual[*DNSConfig](t, nil, new(DNSConfig)) + must.NotEqual[*DNSConfig](t, nil, &DNSConfig{Servers: []string{"8.8.8.8"}}) must.StructEqual(t, &DNSConfig{ Servers: []string{"8.8.8.8", "8.8.4.4"},