| 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 ip_testscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/ |
| 16 | |
| 17 | import ( |
| 18 | "bytesscip-go gomod github.com/golang/go/src go1.24.2 bytes/" |
| 19 | "crypto/randscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/" |
| 20 | "fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/" |
| 21 | "netscip-go gomod github.com/golang/go/src go1.24.2 net/" |
| 22 | |
| 23 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 24 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 25 | |
| 26 | "github.com/containernetworking/plugins/pkg/ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/" |
| 27 | "github.com/containernetworking/plugins/pkg/netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/" |
| 28 | "github.com/containernetworking/plugins/pkg/nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/" |
| 29 | "github.com/containernetworking/plugins/pkg/testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/" |
| 30 | ) |
| 31 | |
| 32 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("Link", func() { |
| 33 | const ( |
| 34 | ifaceFormatStringscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:ifaceFormatString. string = "i%d" |
| 35 | mtuscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mtu. int = 1400 |
| 36 | ip4onehwaddrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:ip4onehwaddr. = "0a:58:01:01:01:01" |
| 37 | ) |
| 38 | var ( |
| 39 | hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS. nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS# |
| 40 | containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS. nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS# |
| 41 | ifaceCounterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:ifaceCounter. = 0 |
| 42 | hostVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVeth. netscip-go gomod github.com/golang/go/src go1.24.2 net/.Interfacescip-go gomod github.com/golang/go/src go1.24.2 net/Interface# |
| 43 | containerVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVeth. netscip-go gomod github.com/golang/go/src go1.24.2 net/.Interfacescip-go gomod github.com/golang/go/src go1.24.2 net/Interface# |
| 44 | hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName. string |
| 45 | containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName. string |
| 46 | |
| 47 | originalRandReaderscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:originalRandReader. = randscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/.Readerscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/Reader. |
| 48 | ) |
| 49 | |
| 50 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 51 | var errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:err. error |
| 52 | |
| 53 | hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:err. = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.NewNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/NewNS().() |
| 54 | 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/pkg/ip_test`/_: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().()) |
| 55 | |
| 56 | containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:err. = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.NewNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/NewNS().() |
| 57 | 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/pkg/ip_test`/_: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().()) |
| 58 | |
| 59 | fakeBytes := make([]byte, 20) |
| 60 | // to be reset in AfterEach block |
| 61 | randscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/.Readerscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/Reader. = bytesscip-go gomod github.com/golang/go/src go1.24.2 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.24.2 bytes/NewReader().(fakeBytes) |
| 62 | |
| 63 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 64 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 65 | |
| 66 | hostVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVeth., containerVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVeth., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:err. = ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.SetupVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/SetupVeth().(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().(ifaceFormatStringscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:ifaceFormatString., ifaceCounterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:ifaceCounter.), mtuscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mtu., "", hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS.) |
| 67 | if errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:err. != nil { |
| 68 | return errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:err. |
| 69 | } |
| 70 | 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/pkg/ip_test`/_: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().()) |
| 71 | |
| 72 | hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName. = hostVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVeth..Namescip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Name. |
| 73 | containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName. = containerVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVeth..Namescip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Name. |
| 74 | |
| 75 | return nil |
| 76 | }) |
| 77 | }) |
| 78 | |
| 79 | AfterEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/AfterEach().(func() { |
| 80 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Closescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Close.()).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 81 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS..Closescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Close.()).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 82 | ifaceCounterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:ifaceCounter.++ |
| 83 | randscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/.Readerscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/Reader. = originalRandReaderscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:originalRandReader. |
| 84 | }) |
| 85 | |
| 86 | Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("GetVethPeerIfindex", func() { |
| 87 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("returns the link and peer index of the named interface", func() { |
| 88 | Byscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/By().("looking up the container veth index using the host veth name") |
| 89 | _ = hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 90 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 91 | |
| 92 | gotHostLink, gotContainerIndex, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.GetVethPeerIfindexscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/GetVethPeerIfindex().(hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName.) |
| 93 | 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().()) |
| 94 | |
| 95 | Byscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/By().("checking we got back the host link") |
| 96 | attrs := gotHostLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().() |
| 97 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(attrs.Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.).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().(hostVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVeth..Indexscip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Index.)) |
| 98 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(attrs.Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(hostVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVeth..Namescip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Name.)) |
| 99 | |
| 100 | Byscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/By().("checking we got back the container veth index") |
| 101 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(gotContainerIndex).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().(containerVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVeth..Indexscip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Index.)) |
| 102 | |
| 103 | return nil |
| 104 | }) |
| 105 | |
| 106 | Byscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/By().("looking up the host veth index using the container veth name") |
| 107 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 108 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 109 | |
| 110 | gotContainerLink, gotHostIndex, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.GetVethPeerIfindexscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/GetVethPeerIfindex().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName.) |
| 111 | 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().()) |
| 112 | |
| 113 | Byscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/By().("checking we got back the container link") |
| 114 | attrs := gotContainerLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().() |
| 115 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(attrs.Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.).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().(containerVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVeth..Indexscip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Index.)) |
| 116 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(attrs.Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(containerVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVeth..Namescip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Name.)) |
| 117 | |
| 118 | Byscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/By().("checking we got back the host veth index") |
| 119 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(gotHostIndex).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().(hostVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVeth..Indexscip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Index.)) |
| 120 | |
| 121 | return nil |
| 122 | }) |
| 123 | }) |
| 124 | }) |
| 125 | |
| 126 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("SetupVeth must put the veth endpoints into the separate namespaces", func() { |
| 127 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 128 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 129 | |
| 130 | containerVethFromName, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName.) |
| 131 | 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().()) |
| 132 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(containerVethFromName.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.).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().(containerVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVeth..Indexscip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Index.)) |
| 133 | |
| 134 | return nil |
| 135 | }) |
| 136 | |
| 137 | _ = hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 138 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 139 | |
| 140 | hostVethFromName, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName.) |
| 141 | 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().()) |
| 142 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(hostVethFromName.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.).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().(hostVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVeth..Indexscip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Index.)) |
| 143 | |
| 144 | return nil |
| 145 | }) |
| 146 | }) |
| 147 | |
| 148 | Contextscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Context.("when container already has an interface with the same name", func() { |
| 149 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("returns useful error", func() { |
| 150 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 151 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 152 | testHostVethName := "t" + hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName. |
| 153 | _, _, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.SetupVethWithNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/SetupVethWithName().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName., testHostVethName, mtuscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mtu., "", hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS.) |
| 154 | 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().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(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().("container veth name (%q) peer provided (%q) already exists", containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName., testHostVethName))) |
| 155 | |
| 156 | return nil |
| 157 | }) |
| 158 | }) |
| 159 | }) |
| 160 | |
| 161 | Contextscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Context.("deleting an non-existent device", func() { |
| 162 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("returns known error", func() { |
| 163 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 164 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 165 | |
| 166 | // This string should match the expected error codes in the cmdDel functions of some of the plugins |
| 167 | _, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.DelLinkByNameAddrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/DelLinkByNameAddr().("THIS_DONT_EXIST") |
| 168 | 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().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.ErrLinkNotFoundscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/ErrLinkNotFound.)) |
| 169 | |
| 170 | return nil |
| 171 | }) |
| 172 | }) |
| 173 | }) |
| 174 | |
| 175 | Contextscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Context.("when there is no name available for the host-side", func() { |
| 176 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 177 | // adding different interface to container ns |
| 178 | containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName. += "0" |
| 179 | }) |
| 180 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("returns useful error", func() { |
| 181 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 182 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 183 | _, _, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.SetupVethWithNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/SetupVethWithName().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName., hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName., mtuscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mtu., "", hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS.) |
| 184 | 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().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(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().("container veth name (%q) peer provided (%q) already exists", containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName., hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName.))) |
| 185 | return nil |
| 186 | }) |
| 187 | }) |
| 188 | }) |
| 189 | |
| 190 | Contextscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Context.("when there is no name conflict for the host or container interfaces", func() { |
| 191 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 192 | // adding different interface to container and host ns |
| 193 | containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName. += "0" |
| 194 | randscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/.Readerscip-go gomod github.com/golang/go/src go1.24.2 `crypto/rand`/Reader. = originalRandReaderscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:originalRandReader. |
| 195 | }) |
| 196 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("successfully creates the second veth pair", func() { |
| 197 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 198 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 199 | |
| 200 | hostVeth, _, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.SetupVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/SetupVeth().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName., mtuscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mtu., "", hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS.) |
| 201 | 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().()) |
| 202 | hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName. = hostVeth.Namescip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Name. |
| 203 | return nil |
| 204 | }) |
| 205 | |
| 206 | // verify veths are in different namespaces |
| 207 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 208 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 209 | |
| 210 | _, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName.) |
| 211 | 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().()) |
| 212 | |
| 213 | return nil |
| 214 | }) |
| 215 | |
| 216 | _ = hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 217 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 218 | |
| 219 | _, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName.) |
| 220 | 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().()) |
| 221 | |
| 222 | return nil |
| 223 | }) |
| 224 | }) |
| 225 | |
| 226 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("successfully creates a veth pair with an explicit mac", func() { |
| 227 | const macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mac. = "02:00:00:00:01:23" |
| 228 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 229 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 230 | |
| 231 | hostVeth, _, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.SetupVethscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/SetupVeth().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName., mtuscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mtu., macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mac., hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS.) |
| 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 | hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName. = hostVeth.Namescip-go gomod github.com/golang/go/src go1.24.2 net/Interface#Name. |
| 234 | |
| 235 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName.) |
| 236 | 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().()) |
| 237 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).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().(macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mac.)) |
| 238 | |
| 239 | return nil |
| 240 | }) |
| 241 | |
| 242 | _ = hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 243 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 244 | |
| 245 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName.) |
| 246 | 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().()) |
| 247 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:mac.)) |
| 248 | |
| 249 | return nil |
| 250 | }) |
| 251 | }) |
| 252 | }) |
| 253 | |
| 254 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("DelLinkByName must delete the veth endpoints", func() { |
| 255 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 256 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 257 | |
| 258 | // this will delete the host endpoint too |
| 259 | err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.DelLinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/DelLinkByName().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName.) |
| 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 | |
| 262 | _, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName.) |
| 263 | 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().()) |
| 264 | |
| 265 | return nil |
| 266 | }) |
| 267 | |
| 268 | _ = hostNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 269 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 270 | |
| 271 | _, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(hostVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:hostVethName.) |
| 272 | 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().()) |
| 273 | |
| 274 | return nil |
| 275 | }) |
| 276 | }) |
| 277 | |
| 278 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("DelLinkByNameAddr should return no IPs when no IPs are configured", func() { |
| 279 | _ = containerNetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerNetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 280 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 281 | |
| 282 | // this will delete the host endpoint too |
| 283 | addr, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.DelLinkByNameAddrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/DelLinkByNameAddr().(containerVethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip_test`/_:containerVethName.) |
| 284 | 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().()) |
| 285 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addr).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 286 | return nil |
| 287 | }) |
| 288 | }) |
| 289 | }) |