diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-10-12 22:36:24 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2021-10-12 22:36:24 +0200 |
commit | cead185373b0dabe2226d56bbd8d9e2b4edeb8eb (patch) | |
tree | bae2d9daf6aec7e2f94072afc1f712b86a85bd7e /libpod/network/cni/config_test.go | |
parent | c90beedbe160eb6e8094b492091231f3c5838006 (diff) | |
download | podman-cead185373b0dabe2226d56bbd8d9e2b4edeb8eb.tar.gz podman-cead185373b0dabe2226d56bbd8d9e2b4edeb8eb.tar.bz2 podman-cead185373b0dabe2226d56bbd8d9e2b4edeb8eb.zip |
CNI: fix network create --ip-range
The --ip-range option did not work correctly. The endIP was accidentally
assigned to the start IP. New tests are added to make sure it works.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'libpod/network/cni/config_test.go')
-rw-r--r-- | libpod/network/cni/config_test.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libpod/network/cni/config_test.go b/libpod/network/cni/config_test.go index 5b0feb859..6473a69a8 100644 --- a/libpod/network/cni/config_test.go +++ b/libpod/network/cni/config_test.go @@ -621,7 +621,7 @@ var _ = Describe("Config", func() { err = libpodNet.NetworkRemove(network1.Name) Expect(err).To(BeNil()) - endIP := "10.0.0.10" + endIP := "10.0.0.30" network = types.Network{ Driver: "bridge", Subnets: []types.Subnet{ @@ -665,6 +665,22 @@ var _ = Describe("Config", func() { Expect(network1.Subnets[0].Gateway.String()).To(Equal("10.0.0.1")) Expect(network1.Subnets[0].LeaseRange.StartIP.String()).To(Equal(startIP)) Expect(network1.Subnets[0].LeaseRange.EndIP.String()).To(Equal(endIP)) + + // create a new interface to force a config load from disk + libpodNet, err = getNetworkInterface(cniConfDir, false) + Expect(err).To(BeNil()) + + network1, err = libpodNet.NetworkInspect(network1.Name) + Expect(err).To(BeNil()) + Expect(network1.Name).ToNot(BeEmpty()) + Expect(network1.ID).ToNot(BeEmpty()) + Expect(network1.NetworkInterface).ToNot(BeEmpty()) + Expect(network1.Driver).To(Equal("bridge")) + Expect(network1.Subnets).To(HaveLen(1)) + Expect(network1.Subnets[0].Subnet.String()).To(Equal(subnet)) + Expect(network1.Subnets[0].Gateway.String()).To(Equal("10.0.0.1")) + Expect(network1.Subnets[0].LeaseRange.StartIP.String()).To(Equal(startIP)) + Expect(network1.Subnets[0].LeaseRange.EndIP.String()).To(Equal(endIP)) }) It("create bridge with subnet and invalid lease range", func() { |