| 1 | // Copyright 2016 CNI authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package mainscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/ |
| 16 | |
| 17 | import ( |
| 18 | "fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/" |
| 19 | "netscip-go gomod github.com/golang/go/src go1.24.2 net/" |
| 20 | "osscip-go gomod github.com/golang/go/src go1.24.2 os/" |
| 21 | "path/filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/" |
| 22 | "stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/" |
| 23 | |
| 24 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 25 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 26 | |
| 27 | "github.com/containernetworking/cni/pkg/skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/" |
| 28 | "github.com/containernetworking/cni/pkg/typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/" |
| 29 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/ "github.com/containernetworking/cni/pkg/types/100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/" |
| 30 | "github.com/containernetworking/plugins/pkg/testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/" |
| 31 | "github.com/containernetworking/plugins/plugins/ipam/host-local/backend/diskscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/disk`/" |
| 32 | ) |
| 33 | |
| 34 | const LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. = "\r\n" |
| 35 | |
| 36 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("host-local Operations", func() { |
| 37 | var tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir. string |
| 38 | const ( |
| 39 | ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname. string = "eth0" |
| 40 | nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath. string = "/some/where" |
| 41 | ) |
| 42 | |
| 43 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 44 | var errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:err. error |
| 45 | tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:err. = osscip-go gomod github.com/golang/go/src go1.24.2 os/.MkdirTempscip-go gomod github.com/golang/go/src go1.24.2 os/MkdirTemp().("", "host-local_test") |
| 46 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:err.).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 47 | tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir. = filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/ToSlash().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 48 | }) |
| 49 | |
| 50 | AfterEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/AfterEach().(func() { |
| 51 | osscip-go gomod github.com/golang/go/src go1.24.2 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.24.2 os/RemoveAll().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 52 | }) |
| 53 | |
| 54 | for _, ver := range testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.AllSpecVersionsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/AllSpecVersions. { |
| 55 | // Redefine ver inside for scope so real value is picked up by each dynamically defined It() |
| 56 | // See Gingkgo's "Patterns for dynamically generating tests" documentation. |
| 57 | ver := ver |
| 58 | |
| 59 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases addresses with ADD/DEL", ver), func() { |
| 60 | err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.WriteFilescip-go gomod github.com/golang/go/src go1.24.2 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "resolv.conf"), []byte("nameserver 192.0.2.3"), 0o644) |
| 61 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 62 | |
| 63 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 64 | "cniVersion": "%s", |
| 65 | "name": "mynet", |
| 66 | "type": "ipvlan", |
| 67 | "master": "foo0", |
| 68 | "ipam": { |
| 69 | "type": "host-local", |
| 70 | "dataDir": "%s", |
| 71 | "resolvConf": "%s/resolv.conf", |
| 72 | "ranges": [ |
| 73 | [{ "subnet": "10.1.2.0/24" }, {"subnet": "10.2.2.0/24"}], |
| 74 | [{ "subnet": "2001:db8:1::0/64" }] |
| 75 | ], |
| 76 | "routes": [ |
| 77 | {"dst": "0.0.0.0/0"}, |
| 78 | {"dst": "::/0"}, |
| 79 | {"dst": "192.168.0.0/16", "gw": "1.1.1.1"}, |
| 80 | {"dst": "2001:db8:2::0/64", "gw": "2001:db8:3::1"} |
| 81 | ] |
| 82 | } |
| 83 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 84 | |
| 85 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 86 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 87 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 88 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 89 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 90 | } |
| 91 | |
| 92 | // Allocate the IP |
| 93 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 94 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 95 | }) |
| 96 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 97 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 98 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 99 | } |
| 100 | |
| 101 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 102 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 103 | |
| 104 | // Gomega is cranky about slices with different caps |
| 105 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0]).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().( |
| 106 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 107 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/mustCIDR().("10.1.2.2/24"), |
| 108 | Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.1.2.1"), |
| 109 | })) |
| 110 | |
| 111 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1]).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().( |
| 112 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 113 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/mustCIDR().("2001:db8:1::2/64"), |
| 114 | Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::1"), |
| 115 | }, |
| 116 | )) |
| 117 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 118 | |
| 119 | for _, expectedRoute := range []*typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Routescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#{ |
| 120 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/mustCIDR().("0.0.0.0/0"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: nil}, |
| 121 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/mustCIDR().("::/0"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: nil}, |
| 122 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/mustCIDR().("192.168.0.0/16"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("1.1.1.1")}, |
| 123 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/mustCIDR().("2001:db8:2::0/64"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:3::1")}, |
| 124 | } { |
| 125 | found := false |
| 126 | for _, foundRoute := range result.Routesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Routes. { |
| 127 | if foundRoute.Stringscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#String().() == expectedRoute.Stringscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#String().() { |
| 128 | found = true |
| 129 | break |
| 130 | } |
| 131 | } |
| 132 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 133 | } |
| 134 | |
| 135 | ipFilePath1 := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet", "10.1.2.2") |
| 136 | contents, err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(ipFilePath1) |
| 137 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 138 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(args.ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID. + LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. + ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname.)) |
| 139 | |
| 140 | ipFilePath2 := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., diskscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/disk`/.GetEscapedPathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/disk`/GetEscapedPath().("mynet", "2001:db8:1::2")) |
| 141 | contents, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(ipFilePath2) |
| 142 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 143 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(args.ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID. + LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. + ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname.)) |
| 144 | |
| 145 | lastFilePath1 := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet", "last_reserved_ip.0") |
| 146 | contents, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(lastFilePath1) |
| 147 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 148 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().("10.1.2.2")) |
| 149 | |
| 150 | lastFilePath2 := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet", "last_reserved_ip.1") |
| 151 | contents, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(lastFilePath2) |
| 152 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 153 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().("2001:db8:1::2")) |
| 154 | // Release the IP |
| 155 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 156 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args) |
| 157 | }) |
| 158 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 159 | |
| 160 | _, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.Statscip-go gomod github.com/golang/go/src go1.24.2 os/Stat().(ipFilePath1) |
| 161 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 162 | _, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.Statscip-go gomod github.com/golang/go/src go1.24.2 os/Stat().(ipFilePath2) |
| 163 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 164 | }) |
| 165 | |
| 166 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases addresses on specific interface with ADD/DEL", ver), func() { |
| 167 | const ifname1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname1. string = "eth1" |
| 168 | |
| 169 | err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.WriteFilescip-go gomod github.com/golang/go/src go1.24.2 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "resolv.conf"), []byte("nameserver 192.0.2.3"), 0o644) |
| 170 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 171 | |
| 172 | conf0 := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 173 | "cniVersion": "%s", |
| 174 | "name": "mynet0", |
| 175 | "type": "ipvlan", |
| 176 | "master": "foo0", |
| 177 | "ipam": { |
| 178 | "type": "host-local", |
| 179 | "dataDir": "%s", |
| 180 | "resolvConf": "%s/resolv.conf", |
| 181 | "ranges": [ |
| 182 | [{ "subnet": "10.1.2.0/24" }] |
| 183 | ] |
| 184 | } |
| 185 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 186 | |
| 187 | conf1 := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 188 | "cniVersion": "%s", |
| 189 | "name": "mynet1", |
| 190 | "type": "ipvlan", |
| 191 | "master": "foo1", |
| 192 | "ipam": { |
| 193 | "type": "host-local", |
| 194 | "dataDir": "%s", |
| 195 | "resolvConf": "%s/resolv.conf", |
| 196 | "ranges": [ |
| 197 | [{ "subnet": "10.2.2.0/24" }] |
| 198 | ] |
| 199 | } |
| 200 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 201 | |
| 202 | args0 := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 203 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 204 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 205 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 206 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf0), |
| 207 | } |
| 208 | |
| 209 | // Allocate the IP |
| 210 | r0, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args0, func() error { |
| 211 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args0) |
| 212 | }) |
| 213 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 214 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 215 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 216 | } |
| 217 | |
| 218 | _, err = types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r0) |
| 219 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 220 | |
| 221 | args1 := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 222 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 223 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 224 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifname1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname1., |
| 225 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf1), |
| 226 | } |
| 227 | |
| 228 | // Allocate the IP |
| 229 | r1, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args1, func() error { |
| 230 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args1) |
| 231 | }) |
| 232 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 233 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 234 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 235 | } |
| 236 | |
| 237 | _, err = types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r1) |
| 238 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 239 | |
| 240 | ipFilePath0 := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet0", "10.1.2.2") |
| 241 | contents, err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(ipFilePath0) |
| 242 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 243 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(args0.ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID. + LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. + ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname.)) |
| 244 | |
| 245 | ipFilePath1 := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet1", "10.2.2.2") |
| 246 | contents, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(ipFilePath1) |
| 247 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 248 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(args1.ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID. + LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. + ifname1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname1.)) |
| 249 | |
| 250 | // Release the IP on ifname |
| 251 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args0, func() error { |
| 252 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args0) |
| 253 | }) |
| 254 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 255 | _, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.Statscip-go gomod github.com/golang/go/src go1.24.2 os/Stat().(ipFilePath0) |
| 256 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 257 | |
| 258 | // reread ipFilePath1, ensure that ifname1 didn't get deleted |
| 259 | contents, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(ipFilePath1) |
| 260 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 261 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(args1.ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID. + LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. + ifname1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname1.)) |
| 262 | |
| 263 | // Release the IP on ifname1 |
| 264 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args1, func() error { |
| 265 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args1) |
| 266 | }) |
| 267 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 268 | |
| 269 | _, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.Statscip-go gomod github.com/golang/go/src go1.24.2 os/Stat().(ipFilePath1) |
| 270 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 271 | }) |
| 272 | |
| 273 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] repeat allocating addresses on specific interface for same container ID with ADD", ver), func() { |
| 274 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 275 | "cniVersion": "%s", |
| 276 | "name": "mynet0", |
| 277 | "type": "ipvlan", |
| 278 | "master": "foo0", |
| 279 | "ipam": { |
| 280 | "type": "host-local", |
| 281 | "dataDir": "%s", |
| 282 | "ranges": [ |
| 283 | [{ "subnet": "10.1.2.0/24" }] |
| 284 | ] |
| 285 | } |
| 286 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 287 | |
| 288 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 289 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 290 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 291 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 292 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 293 | } |
| 294 | |
| 295 | args1 := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 296 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy1", |
| 297 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 298 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 299 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 300 | } |
| 301 | |
| 302 | // Allocate the IP |
| 303 | r0, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 304 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 305 | }) |
| 306 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 307 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 308 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 309 | } |
| 310 | |
| 311 | result0, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r0) |
| 312 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 313 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result0.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(1)) |
| 314 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result0.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#String().()).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().("10.1.2.2/24")) |
| 315 | |
| 316 | // Allocate the IP with the same container ID |
| 317 | _, _, err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 318 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 319 | }) |
| 320 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 321 | |
| 322 | // Allocate the IP with the another container ID |
| 323 | r1, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args1, func() error { |
| 324 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args1) |
| 325 | }) |
| 326 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 327 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 328 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 329 | } |
| 330 | |
| 331 | result1, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r1) |
| 332 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 333 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result1.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(1)) |
| 334 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result1.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#String().()).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().("10.1.2.3/24")) |
| 335 | |
| 336 | // Allocate the IP with the same container ID again |
| 337 | _, _, err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 338 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 339 | }) |
| 340 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 341 | |
| 342 | ipFilePath := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet0", "10.1.2.2") |
| 343 | |
| 344 | // Release the IPs |
| 345 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 346 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args) |
| 347 | }) |
| 348 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 349 | _, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.Statscip-go gomod github.com/golang/go/src go1.24.2 os/Stat().(ipFilePath) |
| 350 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 351 | |
| 352 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args1, func() error { |
| 353 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args1) |
| 354 | }) |
| 355 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 356 | }) |
| 357 | |
| 358 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] verify DEL works on backwards compatible allocate", ver), func() { |
| 359 | err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.WriteFilescip-go gomod github.com/golang/go/src go1.24.2 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "resolv.conf"), []byte("nameserver 192.0.2.3"), 0o644) |
| 360 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 361 | |
| 362 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 363 | "cniVersion": "%s", |
| 364 | "name": "mynet", |
| 365 | "type": "ipvlan", |
| 366 | "master": "foo", |
| 367 | "ipam": { |
| 368 | "type": "host-local", |
| 369 | "dataDir": "%s", |
| 370 | "resolvConf": "%s/resolv.conf", |
| 371 | "ranges": [ |
| 372 | [{ "subnet": "10.1.2.0/24" }] |
| 373 | ] |
| 374 | } |
| 375 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 376 | |
| 377 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 378 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 379 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 380 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 381 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 382 | } |
| 383 | |
| 384 | // Allocate the IP |
| 385 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 386 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 387 | }) |
| 388 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 389 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 390 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 391 | } |
| 392 | |
| 393 | _, err = types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 394 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 395 | |
| 396 | ipFilePath := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet", "10.1.2.2") |
| 397 | contents, err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(ipFilePath) |
| 398 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 399 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(args.ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID. + LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. + ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname.)) |
| 400 | err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.WriteFilescip-go gomod github.com/golang/go/src go1.24.2 os/WriteFile().(ipFilePath, []byte(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.24.2 strings/TrimSpace().(args.ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.)), 0o644) |
| 401 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 402 | |
| 403 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 404 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args) |
| 405 | }) |
| 406 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 407 | _, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.Statscip-go gomod github.com/golang/go/src go1.24.2 os/Stat().(ipFilePath) |
| 408 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 409 | }) |
| 410 | |
| 411 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] doesn't error when passed an unknown ID on DEL", ver), func() { |
| 412 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 413 | "cniVersion": "%s", |
| 414 | "name": "mynet", |
| 415 | "type": "ipvlan", |
| 416 | "master": "foo0", |
| 417 | "ipam": { |
| 418 | "type": "host-local", |
| 419 | "subnet": "10.1.2.0/24", |
| 420 | "dataDir": "%s" |
| 421 | } |
| 422 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 423 | |
| 424 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 425 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 426 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 427 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 428 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 429 | } |
| 430 | |
| 431 | // Release the IP |
| 432 | err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 433 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args) |
| 434 | }) |
| 435 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 436 | }) |
| 437 | |
| 438 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] ignores whitespace in disk files", ver), func() { |
| 439 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 440 | "cniVersion": "%s", |
| 441 | "name": "mynet", |
| 442 | "type": "ipvlan", |
| 443 | "master": "foo0", |
| 444 | "ipam": { |
| 445 | "type": "host-local", |
| 446 | "subnet": "10.1.2.0/24", |
| 447 | "dataDir": "%s" |
| 448 | } |
| 449 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 450 | |
| 451 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 452 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: " dummy\n ", |
| 453 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 454 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 455 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 456 | } |
| 457 | |
| 458 | // Allocate the IP |
| 459 | r, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 460 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 461 | }) |
| 462 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 463 | |
| 464 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 465 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 466 | |
| 467 | ipFilePath := filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "mynet", result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().()) |
| 468 | contents, err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.2 os/ReadFile().(ipFilePath) |
| 469 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 470 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(string(contents)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().("dummy" + LineBreakscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/LineBreak. + ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname.)) |
| 471 | |
| 472 | // Release the IP |
| 473 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 474 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdDel().(args) |
| 475 | }) |
| 476 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 477 | |
| 478 | _, err = osscip-go gomod github.com/golang/go/src go1.24.2 os/.Statscip-go gomod github.com/golang/go/src go1.24.2 os/Stat().(ipFilePath) |
| 479 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 480 | }) |
| 481 | |
| 482 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] does not output an error message upon initial subnet creation", ver), func() { |
| 483 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 484 | "cniVersion": "%s", |
| 485 | "name": "mynet", |
| 486 | "type": "ipvlan", |
| 487 | "master": "foo0", |
| 488 | "ipam": { |
| 489 | "type": "host-local", |
| 490 | "subnet": "10.1.2.0/24", |
| 491 | "dataDir": "%s" |
| 492 | } |
| 493 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 494 | |
| 495 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 496 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "testing", |
| 497 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 498 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 499 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 500 | } |
| 501 | |
| 502 | // Allocate the IP |
| 503 | _, out, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 504 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 505 | }) |
| 506 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 507 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(out), "Error retrieving last reserved ip")).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(-1)) |
| 508 | }) |
| 509 | |
| 510 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates a custom IP when requested by config args", ver), func() { |
| 511 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 512 | "cniVersion": "%s", |
| 513 | "name": "mynet", |
| 514 | "type": "ipvlan", |
| 515 | "master": "foo0", |
| 516 | "ipam": { |
| 517 | "type": "host-local", |
| 518 | "dataDir": "%s", |
| 519 | "ranges": [ |
| 520 | [{ "subnet": "10.1.2.0/24" }] |
| 521 | ] |
| 522 | }, |
| 523 | "args": { |
| 524 | "cni": { |
| 525 | "ips": ["10.1.2.88"] |
| 526 | } |
| 527 | } |
| 528 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 529 | |
| 530 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 531 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 532 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 533 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 534 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 535 | } |
| 536 | |
| 537 | // Allocate the IP |
| 538 | r, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 539 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 540 | }) |
| 541 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 542 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 543 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 544 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(1)) |
| 545 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.1.2.88"))) |
| 546 | }) |
| 547 | |
| 548 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates custom IPs from multiple ranges", ver), func() { |
| 549 | err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.WriteFilescip-go gomod github.com/golang/go/src go1.24.2 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "resolv.conf"), []byte("nameserver 192.0.2.3"), 0o644) |
| 550 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 551 | |
| 552 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 553 | "cniVersion": "%s", |
| 554 | "name": "mynet", |
| 555 | "type": "ipvlan", |
| 556 | "master": "foo0", |
| 557 | "ipam": { |
| 558 | "type": "host-local", |
| 559 | "dataDir": "%s", |
| 560 | "ranges": [ |
| 561 | [{ "subnet": "10.1.2.0/24" }], |
| 562 | [{ "subnet": "10.1.3.0/24" }] |
| 563 | ] |
| 564 | }, |
| 565 | "args": { |
| 566 | "cni": { |
| 567 | "ips": ["10.1.2.88", "10.1.3.77"] |
| 568 | } |
| 569 | } |
| 570 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 571 | |
| 572 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 573 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 574 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 575 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 576 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 577 | } |
| 578 | |
| 579 | // Allocate the IP |
| 580 | r, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 581 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 582 | }) |
| 583 | if !testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasMultipleIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasMultipleIPs().(ver) { |
| 584 | errStr := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("CNI version %s does not support more than 1 address per family", ver) |
| 585 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().(errStr)) |
| 586 | } else { |
| 587 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 588 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 589 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 590 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 591 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.1.2.88"))) |
| 592 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.1.3.77"))) |
| 593 | } |
| 594 | }) |
| 595 | |
| 596 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates custom IPs from multiple protocols", ver), func() { |
| 597 | err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.WriteFilescip-go gomod github.com/golang/go/src go1.24.2 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.2 `path/filepath`/Join().(tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir., "resolv.conf"), []byte("nameserver 192.0.2.3"), 0o644) |
| 598 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 599 | |
| 600 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 601 | "cniVersion": "%s", |
| 602 | "name": "mynet", |
| 603 | "type": "ipvlan", |
| 604 | "master": "foo0", |
| 605 | "ipam": { |
| 606 | "type": "host-local", |
| 607 | "dataDir": "%s", |
| 608 | "ranges": [ |
| 609 | [{"subnet":"172.16.1.0/24"}, { "subnet": "10.1.2.0/24" }], |
| 610 | [{ "subnet": "2001:db8:1::/48" }] |
| 611 | ] |
| 612 | }, |
| 613 | "args": { |
| 614 | "cni": { |
| 615 | "ips": ["10.1.2.88", "2001:db8:1::999"] |
| 616 | } |
| 617 | } |
| 618 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 619 | |
| 620 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 621 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 622 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 623 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 624 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 625 | } |
| 626 | |
| 627 | // Allocate the IP |
| 628 | r, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 629 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 630 | }) |
| 631 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 632 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 633 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 634 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 635 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.1.2.88"))) |
| 636 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::999"))) |
| 637 | }) |
| 638 | |
| 639 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] fails if a requested custom IP is not used", ver), func() { |
| 640 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 641 | "cniVersion": "%s", |
| 642 | "name": "mynet", |
| 643 | "type": "ipvlan", |
| 644 | "master": "foo0", |
| 645 | "ipam": { |
| 646 | "type": "host-local", |
| 647 | "dataDir": "%s", |
| 648 | "ranges": [ |
| 649 | [{ "subnet": "10.1.2.0/24" }], |
| 650 | [{ "subnet": "10.1.3.0/24" }] |
| 651 | ] |
| 652 | }, |
| 653 | "args": { |
| 654 | "cni": { |
| 655 | "ips": ["10.1.2.88", "10.1.2.77"] |
| 656 | } |
| 657 | } |
| 658 | }`, ver, tmpDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:tmpDir.) |
| 659 | |
| 660 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 661 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 662 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:nspath., |
| 663 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/_:ifname., |
| 664 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 665 | } |
| 666 | |
| 667 | // Allocate the IP |
| 668 | _, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 669 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/cmdAdd().(args) |
| 670 | }) |
| 671 | if !testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasMultipleIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasMultipleIPs().(ver) { |
| 672 | errStr := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("CNI version %s does not support more than 1 address per family", ver) |
| 673 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().(errStr)) |
| 674 | } else { |
| 675 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 676 | // Need to match prefix, because ordering is not guaranteed |
| 677 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err.Error()).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HavePrefixscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HavePrefix().("failed to allocate all requested IPs: 10.1.2.")) |
| 678 | } |
| 679 | }) |
| 680 | } |
| 681 | }) |
| 682 | |
| 683 | func mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local`/mustCIDR().(s string) netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPNetscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet# { |
| 684 | ip, n, err := netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseCIDRscip-go gomod github.com/golang/go/src go1.24.2 net/ParseCIDR().(s) |
| 685 | n.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP. = ip |
| 686 | if err != nil { |
| 687 | Failscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Fail().(err.Error()) |
| 688 | } |
| 689 | |
| 690 | return *n |
| 691 | } |