diff options
author | Antonio Ojea <aojea@redhat.com> | 2020-08-14 11:19:02 +0200 |
---|---|---|
committer | Antonio Ojea <aojea@redhat.com> | 2020-08-15 12:11:01 +0200 |
commit | 07e3f1bba9674c0cb93a0fa260930bfebbf75728 (patch) | |
tree | 12a096d58c7903839eaf39ceb889415129e91426 /pkg/network/netconflist_test.go | |
parent | d777a7bd5c920ce3cf06c4eba25068747dbc6b8f (diff) | |
download | podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.tar.gz podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.tar.bz2 podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.zip |
podman support for IPv6 networks
podman containers using IPv6 were missing the default route, breaking
deployments trying to use them.
The problem is that the default route was hardcoded to IPv4, this
takes into consideration the podman subnet IP family to generate
the corresponding default route.
Signed-off-by: Antonio Ojea <aojea@redhat.com>
Diffstat (limited to 'pkg/network/netconflist_test.go')
-rw-r--r-- | pkg/network/netconflist_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pkg/network/netconflist_test.go b/pkg/network/netconflist_test.go new file mode 100644 index 000000000..a82a0140a --- /dev/null +++ b/pkg/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 errorr expected: %v", err) + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewIPAMDefaultRoute() = %v, want %v", got, tt.want) + } + }) + } +} |