summaryrefslogtreecommitdiff
path: root/libpod/network/netconflist_test.go
blob: 5893bf985b6b5042b49a907b3fac3e62097a7c90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)
			}
		})
	}
}