summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_relaymsg_test.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2019-12-28 08:57:51 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2020-03-05 15:51:55 +0000
commitbb0c09a3da430db48a7bd0749b7d5411649e1026 (patch)
tree1f51843a9155b6444e999bf141a546bf2eaf51d3 /dhcpv6/option_relaymsg_test.go
parentd9b1a20bc08c08acc5e43e818fe1c3b71612f0a7 (diff)
v6: add ElapsedTime getter
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_relaymsg_test.go')
-rw-r--r--dhcpv6/option_relaymsg_test.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/dhcpv6/option_relaymsg_test.go b/dhcpv6/option_relaymsg_test.go
index 887bf95..a39439b 100644
--- a/dhcpv6/option_relaymsg_test.go
+++ b/dhcpv6/option_relaymsg_test.go
@@ -3,6 +3,7 @@ package dhcpv6
import (
"reflect"
"testing"
+ "time"
"github.com/stretchr/testify/require"
)
@@ -62,7 +63,7 @@ func TestRelayMsgParseOptRelayMsgSingleEncapsulation(t *testing.T) {
0xaa, 0xbb, 0xcc, // transaction ID
0, 8, // option: elapsed time
0, 2, // option length
- 0x11, 0x22, // option value
+ 0x00, 0x01, // option value
})
if err != nil {
t.Fatal(err)
@@ -109,14 +110,8 @@ func TestRelayMsgParseOptRelayMsgSingleEncapsulation(t *testing.T) {
if len(innerDHCP.Options.Options) != 1 {
t.Fatalf("Invalid inner DHCP options length. Expected 1, got %v", len(innerDHCP.Options.Options))
}
- innerOpt := innerDHCP.Options.Options[0]
- eto, ok := innerOpt.(*OptElapsedTime)
- if !ok {
- t.Fatalf("Invalid inner option type. Expected OptElapsedTime, got %v",
- reflect.TypeOf(innerOpt),
- )
- }
- if eTime := eto.ElapsedTime; eTime != 0x1122 {
+ eTime := innerDHCP.Options.ElapsedTime()
+ if eTime != 10*time.Millisecond {
t.Fatalf("Invalid elapsed time. Expected 0x1122, got 0x%04x", eTime)
}
}