From 992cfe64e1fda90717240716c47f85251beb1d83 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Fri, 24 Mar 2023 10:46:40 +0100 Subject: [PATCH] Add ipv6 test for stdnet pkg (#761) --- client/internal/stdnet/stdnet_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/internal/stdnet/stdnet_test.go b/client/internal/stdnet/stdnet_test.go index f3c09c61e..f6e0cfbcb 100644 --- a/client/internal/stdnet/stdnet_test.go +++ b/client/internal/stdnet/stdnet_test.go @@ -19,6 +19,7 @@ func Test_parseInterfacesString(t *testing.T) { }{ {"wlan0", 30, 1500, true, true, false, false, true, "10.1.10.131/24"}, {"rmnet0", 30, 1500, true, true, false, false, true, "192.168.0.56/24"}, + {"rmnet_data1", 30, 1500, true, true, false, false, true, "fec0::118c:faf7:8d97:3cb2/64"}, } var exampleString string @@ -48,5 +49,18 @@ func Test_parseInterfacesString(t *testing.T) { if net.Interface.Name != testData[i].name { t.Errorf("invalid interface name: %s, expected: %s", net.Interface.Name, testData[i].name) } + + addr, err := net.Addrs() + if err != nil { + t.Fatal(err) + } + + if len(addr) == 0 { + t.Errorf("invalid address parsing") + } + + if addr[0].String() != testData[i].addr { + t.Errorf("invalid address: %s, expected: %s", addr[0].String(), testData[i].addr) + } } }