From e7ae40658ef16d9236a93fba10e843adc66295ac Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Fri, 29 Mar 2024 14:47:53 +0000 Subject: [PATCH] backport of commit 31f53cec01927a842e991447c4bdf437fe588573 --- nomad/structs/structs.go | 2 +- nomad/structs/structs_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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"},