diff options
author | Dennis Marttinen <twelho@welho.tech> | 2022-10-01 14:44:54 +0300 |
---|---|---|
committer | Dennis Marttinen <twelho@welho.tech> | 2022-10-01 14:46:10 +0300 |
commit | c54f469494bb5c429c50fa371dce81d965cf56a2 (patch) | |
tree | 95746fac73cd97b644c363e5145ba036ff2a6156 | |
parent | 043f1726f02e2908b959423a0b95a9affdc08b73 (diff) |
dhcpv4: fix require.NotNil() usage in tests
Any parameter passed to `require.NotNil()` after the first two will not be
tested but instead appended to the message that is printed if the test fails.
This means that `lease.ACK` was never tested to not be nil.
Signed-off-by: Dennis Marttinen <twelho@welho.tech>
-rw-r--r-- | dhcpv4/server4/server_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/dhcpv4/server4/server_test.go b/dhcpv4/server4/server_test.go index 7be868c..972a881 100644 --- a/dhcpv4/server4/server_test.go +++ b/dhcpv4/server4/server_test.go @@ -110,7 +110,8 @@ func TestServer(t *testing.T) { lease, err := c.Request(context.Background(), modifiers...) require.NoError(t, err) - require.NotNil(t, lease.Offer, lease.ACK) + require.NotNil(t, lease.Offer) + require.NotNil(t, lease.ACK) for _, p := range []*dhcpv4.DHCPv4{lease.Offer, lease.ACK} { require.Equal(t, xid, p.TransactionID) require.Equal(t, ifaces[0].HardwareAddr, p.ClientHWAddr) @@ -118,7 +119,8 @@ func TestServer(t *testing.T) { err = c.Renew(context.Background(), lease, modifiers...) require.NoError(t, err) - require.NotNil(t, lease.Offer, lease.ACK) + require.NotNil(t, lease.Offer) + require.NotNil(t, lease.ACK) for _, p := range []*dhcpv4.DHCPv4{lease.Offer, lease.ACK} { require.Equal(t, xid, p.TransactionID) require.Equal(t, ifaces[0].HardwareAddr, p.ClientHWAddr) |