summaryrefslogtreecommitdiff
path: root/libpod/network/netconflist_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/network/netconflist_test.go')
-rw-r--r--libpod/network/netconflist_test.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/libpod/network/netconflist_test.go b/libpod/network/netconflist_test.go
new file mode 100644
index 000000000..5893bf985
--- /dev/null
+++ b/libpod/network/netconflist_test.go
@@ -0,0 +1,38 @@
+package network
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestNewIPAMDefaultRoute(t *testing.T) {
+
+ tests := []struct {
+ name string
+ isIPv6 bool
+ want IPAMRoute
+ }{
+ {
+ name: "IPv4 default route",
+ isIPv6: false,
+ want: IPAMRoute{defaultIPv4Route},
+ },
+ {
+ name: "IPv6 default route",
+ isIPv6: true,
+ want: IPAMRoute{defaultIPv6Route},
+ },
+ }
+ for _, tt := range tests {
+ tt := tt
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := NewIPAMDefaultRoute(tt.isIPv6)
+ if err != nil {
+ t.Errorf("no error expected: %v", err)
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("NewIPAMDefaultRoute() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}