summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_serverid_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/option_serverid_test.go')
-rw-r--r--dhcpv6/option_serverid_test.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/dhcpv6/option_serverid_test.go b/dhcpv6/option_serverid_test.go
index 556f515..3422287 100644
--- a/dhcpv6/option_serverid_test.go
+++ b/dhcpv6/option_serverid_test.go
@@ -14,7 +14,8 @@ func TestParseOptServerID(t *testing.T) {
0, 1, // hwtype ethernet
0, 1, 2, 3, 4, 5, // hw addr
}
- opt, err := parseOptServerID(data)
+ var opt optServerID
+ err := opt.FromBytes(data)
require.NoError(t, err)
want := OptServerID(
&DUIDLL{
@@ -22,7 +23,7 @@ func TestParseOptServerID(t *testing.T) {
LinkLayerAddr: net.HardwareAddr{0, 1, 2, 3, 4, 5},
},
)
- require.Equal(t, opt, want)
+ require.Equal(t, &opt, want)
}
func TestOptServerIdToBytes(t *testing.T) {
@@ -46,7 +47,8 @@ func TestOptServerIdDecodeEncode(t *testing.T) {
0, 1, // hwtype ethernet
5, 4, 3, 2, 1, 0, // hw addr
}
- opt, err := parseOptServerID(data)
+ var opt optServerID
+ err := opt.FromBytes(data)
require.NoError(t, err)
require.Equal(t, data, opt.ToBytes())
}
@@ -73,7 +75,8 @@ func TestOptServerIdparseOptServerIDBogusDUID(t *testing.T) {
1, 2, 3, 4, 5, 6, 7, 8, 9, // a UUID should be 18 bytes not 17
10, 11, 12, 13, 14, 15, 16, 17,
}
- _, err := parseOptServerID(data)
+ var opt optServerID
+ err := opt.FromBytes(data)
require.Error(t, err, "A truncated OptServerId DUID should return an error")
}
@@ -81,6 +84,7 @@ func TestOptServerIdparseOptServerIDInvalidTooShort(t *testing.T) {
data := []byte{
0, // truncated: DUIDs are at least 2 bytes
}
- _, err := parseOptServerID(data)
+ var opt optServerID
+ err := opt.FromBytes(data)
require.Error(t, err, "A truncated OptServerId should return an error")
}