From 1ade2c25662cb9413b4ef6a4acf5faf201286e28 Mon Sep 17 00:00:00 2001 From: Gabriel Rosenhouse Date: Tue, 31 Oct 2017 22:58:50 -0700 Subject: [PATCH] Enable Windows CI (Appveyor) - start list of linux_only plugins; ignore them when testing on Windows - Isolate linux-only code by filename suffix - Remove stub (NotImplemented) functions - other misc. fixes for Windows compatibility --- .appveyor.yml | 28 +++ pkg/ip/{addr.go => addr_linux.go} | 0 pkg/ip/{ipforward.go => ipforward_linux.go} | 0 pkg/ip/{ipmasq.go => ipmasq_linux.go} | 0 pkg/ip/{link.go => link_linux.go} | 0 pkg/ip/{link_test.go => link_linux_test.go} | 0 pkg/ip/route.go | 27 --- pkg/ip/route_linux.go | 6 + pkg/ip/route_unspecified.go | 34 ---- pkg/ipam/ipam.go | 71 ------- pkg/ipam/ipam_linux.go | 89 +++++++++ pkg/ipam/{ipam_test.go => ipam_linux_test.go} | 2 +- pkg/ns/ns.go | 178 ------------------ pkg/ns/ns_linux.go | 156 +++++++++++++++ pkg/ns/{ns_test.go => ns_linux_test.go} | 0 pkg/ns/ns_unspecified.go | 36 ---- pkg/testutils/echosvr/echosvr_test.go | 2 +- plugins/ipam/host-local/backend/disk/lock.go | 1 + plugins/linux_only.txt | 11 ++ ...{flannel_test.go => flannel_linux_test.go} | 0 .../{sample_test.go => sample_linux_test.go} | 0 21 files changed, 293 insertions(+), 348 deletions(-) create mode 100644 .appveyor.yml rename pkg/ip/{addr.go => addr_linux.go} (100%) rename pkg/ip/{ipforward.go => ipforward_linux.go} (100%) rename pkg/ip/{ipmasq.go => ipmasq_linux.go} (100%) rename pkg/ip/{link.go => link_linux.go} (100%) rename pkg/ip/{link_test.go => link_linux_test.go} (100%) delete mode 100644 pkg/ip/route.go delete mode 100644 pkg/ip/route_unspecified.go create mode 100644 pkg/ipam/ipam_linux.go rename pkg/ipam/{ipam_test.go => ipam_linux_test.go} (99%) delete mode 100644 pkg/ns/ns.go rename pkg/ns/{ns_test.go => ns_linux_test.go} (100%) delete mode 100644 pkg/ns/ns_unspecified.go create mode 100644 plugins/linux_only.txt rename plugins/meta/flannel/{flannel_test.go => flannel_linux_test.go} (100%) rename plugins/sample/{sample_test.go => sample_linux_test.go} (100%) diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..ea06455d3 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,28 @@ +clone_folder: c:\gopath\src\github.com\containernetworking\plugins + +environment: + GOPATH: c:\gopath + +install: + - echo %PATH% + - echo %GOPATH% + - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% + - go version + - go env + +build: off + +test_script: + - ps: | + go list ./... | Select-String -Pattern (Get-Content "./plugins/linux_only.txt") -NotMatch > "to_test.txt" + echo "Will test:" + Get-Content "to_test.txt" + foreach ($pkg in Get-Content "to_test.txt") { + if ($pkg) { + echo $pkg + go test -v $pkg + if ($LastExitCode -ne 0) { + throw "test failed" + } + } + } diff --git a/pkg/ip/addr.go b/pkg/ip/addr_linux.go similarity index 100% rename from pkg/ip/addr.go rename to pkg/ip/addr_linux.go diff --git a/pkg/ip/ipforward.go b/pkg/ip/ipforward_linux.go similarity index 100% rename from pkg/ip/ipforward.go rename to pkg/ip/ipforward_linux.go diff --git a/pkg/ip/ipmasq.go b/pkg/ip/ipmasq_linux.go similarity index 100% rename from pkg/ip/ipmasq.go rename to pkg/ip/ipmasq_linux.go diff --git a/pkg/ip/link.go b/pkg/ip/link_linux.go similarity index 100% rename from pkg/ip/link.go rename to pkg/ip/link_linux.go diff --git a/pkg/ip/link_test.go b/pkg/ip/link_linux_test.go similarity index 100% rename from pkg/ip/link_test.go rename to pkg/ip/link_linux_test.go diff --git a/pkg/ip/route.go b/pkg/ip/route.go deleted file mode 100644 index 1325a47a3..000000000 --- a/pkg/ip/route.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 CNI authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ip - -import ( - "net" - - "github.com/vishvananda/netlink" -) - -// AddDefaultRoute sets the default route on the given gateway. -func AddDefaultRoute(gw net.IP, dev netlink.Link) error { - _, defNet, _ := net.ParseCIDR("0.0.0.0/0") - return AddRoute(defNet, gw, dev) -} diff --git a/pkg/ip/route_linux.go b/pkg/ip/route_linux.go index 8b11807dd..f5c0d0803 100644 --- a/pkg/ip/route_linux.go +++ b/pkg/ip/route_linux.go @@ -39,3 +39,9 @@ func AddHostRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error { Gw: gw, }) } + +// AddDefaultRoute sets the default route on the given gateway. +func AddDefaultRoute(gw net.IP, dev netlink.Link) error { + _, defNet, _ := net.ParseCIDR("0.0.0.0/0") + return AddRoute(defNet, gw, dev) +} diff --git a/pkg/ip/route_unspecified.go b/pkg/ip/route_unspecified.go deleted file mode 100644 index 7e79fdef1..000000000 --- a/pkg/ip/route_unspecified.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015-2017 CNI authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !linux - -package ip - -import ( - "net" - - "github.com/containernetworking/cni/pkg/types" - "github.com/vishvananda/netlink" -) - -// AddRoute adds a universally-scoped route to a device. -func AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error { - return types.NotImplementedError -} - -// AddHostRoute adds a host-scoped route to a device. -func AddHostRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error { - return types.NotImplementedError -} diff --git a/pkg/ipam/ipam.go b/pkg/ipam/ipam.go index aa72e5c58..904b25577 100644 --- a/pkg/ipam/ipam.go +++ b/pkg/ipam/ipam.go @@ -15,16 +15,8 @@ package ipam import ( - "fmt" - "net" - "os" - "github.com/containernetworking/cni/pkg/invoke" "github.com/containernetworking/cni/pkg/types" - "github.com/containernetworking/cni/pkg/types/current" - "github.com/containernetworking/plugins/pkg/ip" - - "github.com/vishvananda/netlink" ) func ExecAdd(plugin string, netconf []byte) (types.Result, error) { @@ -34,66 +26,3 @@ func ExecAdd(plugin string, netconf []byte) (types.Result, error) { func ExecDel(plugin string, netconf []byte) error { return invoke.DelegateDel(plugin, netconf) } - -// ConfigureIface takes the result of IPAM plugin and -// applies to the ifName interface -func ConfigureIface(ifName string, res *current.Result) error { - if len(res.Interfaces) == 0 { - return fmt.Errorf("no interfaces to configure") - } - - link, err := netlink.LinkByName(ifName) - if err != nil { - return fmt.Errorf("failed to lookup %q: %v", ifName, err) - } - - if err := netlink.LinkSetUp(link); err != nil { - return fmt.Errorf("failed to set %q UP: %v", ifName, err) - } - - var v4gw, v6gw net.IP - for _, ipc := range res.IPs { - if ipc.Interface == nil { - continue - } - intIdx := *ipc.Interface - if intIdx < 0 || intIdx >= len(res.Interfaces) || res.Interfaces[intIdx].Name != ifName { - // IP address is for a different interface - return fmt.Errorf("failed to add IP addr %v to %q: invalid interface index", ipc, ifName) - } - - addr := &netlink.Addr{IPNet: &ipc.Address, Label: ""} - if err = netlink.AddrAdd(link, addr); err != nil { - return fmt.Errorf("failed to add IP addr %v to %q: %v", ipc, ifName, err) - } - - gwIsV4 := ipc.Gateway.To4() != nil - if gwIsV4 && v4gw == nil { - v4gw = ipc.Gateway - } else if !gwIsV4 && v6gw == nil { - v6gw = ipc.Gateway - } - } - - ip.SettleAddresses(ifName, 10) - - for _, r := range res.Routes { - routeIsV4 := r.Dst.IP.To4() != nil - gw := r.GW - if gw == nil { - if routeIsV4 && v4gw != nil { - gw = v4gw - } else if !routeIsV4 && v6gw != nil { - gw = v6gw - } - } - if err = ip.AddRoute(&r.Dst, gw, link); err != nil { - // we skip over duplicate routes as we assume the first one wins - if !os.IsExist(err) { - return fmt.Errorf("failed to add route '%v via %v dev %v': %v", r.Dst, gw, ifName, err) - } - } - } - - return nil -} diff --git a/pkg/ipam/ipam_linux.go b/pkg/ipam/ipam_linux.go new file mode 100644 index 000000000..6c8ef20cc --- /dev/null +++ b/pkg/ipam/ipam_linux.go @@ -0,0 +1,89 @@ +// Copyright 2015 CNI authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ipam + +import ( + "fmt" + "net" + "os" + + "github.com/containernetworking/cni/pkg/types/current" + "github.com/containernetworking/plugins/pkg/ip" + + "github.com/vishvananda/netlink" +) + +// ConfigureIface takes the result of IPAM plugin and +// applies to the ifName interface +func ConfigureIface(ifName string, res *current.Result) error { + if len(res.Interfaces) == 0 { + return fmt.Errorf("no interfaces to configure") + } + + link, err := netlink.LinkByName(ifName) + if err != nil { + return fmt.Errorf("failed to lookup %q: %v", ifName, err) + } + + if err := netlink.LinkSetUp(link); err != nil { + return fmt.Errorf("failed to set %q UP: %v", ifName, err) + } + + var v4gw, v6gw net.IP + for _, ipc := range res.IPs { + if ipc.Interface == nil { + continue + } + intIdx := *ipc.Interface + if intIdx < 0 || intIdx >= len(res.Interfaces) || res.Interfaces[intIdx].Name != ifName { + // IP address is for a different interface + return fmt.Errorf("failed to add IP addr %v to %q: invalid interface index", ipc, ifName) + } + + addr := &netlink.Addr{IPNet: &ipc.Address, Label: ""} + if err = netlink.AddrAdd(link, addr); err != nil { + return fmt.Errorf("failed to add IP addr %v to %q: %v", ipc, ifName, err) + } + + gwIsV4 := ipc.Gateway.To4() != nil + if gwIsV4 && v4gw == nil { + v4gw = ipc.Gateway + } else if !gwIsV4 && v6gw == nil { + v6gw = ipc.Gateway + } + } + + ip.SettleAddresses(ifName, 10) + + for _, r := range res.Routes { + routeIsV4 := r.Dst.IP.To4() != nil + gw := r.GW + if gw == nil { + if routeIsV4 && v4gw != nil { + gw = v4gw + } else if !routeIsV4 && v6gw != nil { + gw = v6gw + } + } + if err = ip.AddRoute(&r.Dst, gw, link); err != nil { + // we skip over duplicate routes as we assume the first one wins + if !os.IsExist(err) { + return fmt.Errorf("failed to add route '%v via %v dev %v': %v", r.Dst, gw, ifName, err) + } + } + } + + return nil +} diff --git a/pkg/ipam/ipam_test.go b/pkg/ipam/ipam_linux_test.go similarity index 99% rename from pkg/ipam/ipam_test.go rename to pkg/ipam/ipam_linux_test.go index cf8511755..9de3fa056 100644 --- a/pkg/ipam/ipam_test.go +++ b/pkg/ipam/ipam_linux_test.go @@ -39,7 +39,7 @@ func ipNetEqual(a, b *net.IPNet) bool { return a.IP.Equal(b.IP) } -var _ = Describe("IPAM Operations", func() { +var _ = Describe("ConfigureIface", func() { var originalNS ns.NetNS var ipv4, ipv6, routev4, routev6 *net.IPNet var ipgw4, ipgw6, routegwv4, routegwv6 net.IP diff --git a/pkg/ns/ns.go b/pkg/ns/ns.go deleted file mode 100644 index c212f4893..000000000 --- a/pkg/ns/ns.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2015 CNI authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ns - -import ( - "fmt" - "os" - "runtime" - "sync" - "syscall" -) - -type NetNS interface { - // Executes the passed closure in this object's network namespace, - // attempting to restore the original namespace before returning. - // However, since each OS thread can have a different network namespace, - // and Go's thread scheduling is highly variable, callers cannot - // guarantee any specific namespace is set unless operations that - // require that namespace are wrapped with Do(). Also, no code called - // from Do() should call runtime.UnlockOSThread(), or the risk - // of executing code in an incorrect namespace will be greater. See - // https://github.com/golang/go/wiki/LockOSThread for further details. - Do(toRun func(NetNS) error) error - - // Sets the current network namespace to this object's network namespace. - // Note that since Go's thread scheduling is highly variable, callers - // cannot guarantee the requested namespace will be the current namespace - // after this function is called; to ensure this wrap operations that - // require the namespace with Do() instead. - Set() error - - // Returns the filesystem path representing this object's network namespace - Path() string - - // Returns a file descriptor representing this object's network namespace - Fd() uintptr - - // Cleans up this instance of the network namespace; if this instance - // is the last user the namespace will be destroyed - Close() error -} - -type netNS struct { - file *os.File - mounted bool - closed bool -} - -// netNS implements the NetNS interface -var _ NetNS = &netNS{} - -const ( - // https://github.com/torvalds/linux/blob/master/include/uapi/linux/magic.h - NSFS_MAGIC = 0x6e736673 - PROCFS_MAGIC = 0x9fa0 -) - -type NSPathNotExistErr struct{ msg string } - -func (e NSPathNotExistErr) Error() string { return e.msg } - -type NSPathNotNSErr struct{ msg string } - -func (e NSPathNotNSErr) Error() string { return e.msg } - -func IsNSorErr(nspath string) error { - stat := syscall.Statfs_t{} - if err := syscall.Statfs(nspath, &stat); err != nil { - if os.IsNotExist(err) { - err = NSPathNotExistErr{msg: fmt.Sprintf("failed to Statfs %q: %v", nspath, err)} - } else { - err = fmt.Errorf("failed to Statfs %q: %v", nspath, err) - } - return err - } - - switch stat.Type { - case PROCFS_MAGIC, NSFS_MAGIC: - return nil - default: - return NSPathNotNSErr{msg: fmt.Sprintf("unknown FS magic on %q: %x", nspath, stat.Type)} - } -} - -// Returns an object representing the namespace referred to by @path -func GetNS(nspath string) (NetNS, error) { - err := IsNSorErr(nspath) - if err != nil { - return nil, err - } - - fd, err := os.Open(nspath) - if err != nil { - return nil, err - } - - return &netNS{file: fd}, nil -} - -func (ns *netNS) Path() string { - return ns.file.Name() -} - -func (ns *netNS) Fd() uintptr { - return ns.file.Fd() -} - -func (ns *netNS) errorIfClosed() error { - if ns.closed { - return fmt.Errorf("%q has already been closed", ns.file.Name()) - } - return nil -} - -func (ns *netNS) Do(toRun func(NetNS) error) error { - if err := ns.errorIfClosed(); err != nil { - return err - } - - containedCall := func(hostNS NetNS) error { - threadNS, err := GetCurrentNS() - if err != nil { - return fmt.Errorf("failed to open current netns: %v", err) - } - defer threadNS.Close() - - // switch to target namespace - if err = ns.Set(); err != nil { - return fmt.Errorf("error switching to ns %v: %v", ns.file.Name(), err) - } - defer threadNS.Set() // switch back - - return toRun(hostNS) - } - - // save a handle to current network namespace - hostNS, err := GetCurrentNS() - if err != nil { - return fmt.Errorf("Failed to open current namespace: %v", err) - } - defer hostNS.Close() - - var wg sync.WaitGroup - wg.Add(1) - - var innerError error - go func() { - defer wg.Done() - runtime.LockOSThread() - innerError = containedCall(hostNS) - }() - wg.Wait() - - return innerError -} - -// WithNetNSPath executes the passed closure under the given network -// namespace, restoring the original namespace afterwards. -func WithNetNSPath(nspath string, toRun func(NetNS) error) error { - ns, err := GetNS(nspath) - if err != nil { - return err - } - defer ns.Close() - return ns.Do(toRun) -} diff --git a/pkg/ns/ns_linux.go b/pkg/ns/ns_linux.go index 8949d21b5..4ce989467 100644 --- a/pkg/ns/ns_linux.go +++ b/pkg/ns/ns_linux.go @@ -21,6 +21,7 @@ import ( "path" "runtime" "sync" + "syscall" "golang.org/x/sys/unix" ) @@ -147,3 +148,158 @@ func (ns *netNS) Set() error { return nil } + +type NetNS interface { + // Executes the passed closure in this object's network namespace, + // attempting to restore the original namespace before returning. + // However, since each OS thread can have a different network namespace, + // and Go's thread scheduling is highly variable, callers cannot + // guarantee any specific namespace is set unless operations that + // require that namespace are wrapped with Do(). Also, no code called + // from Do() should call runtime.UnlockOSThread(), or the risk + // of executing code in an incorrect namespace will be greater. See + // https://github.com/golang/go/wiki/LockOSThread for further details. + Do(toRun func(NetNS) error) error + + // Sets the current network namespace to this object's network namespace. + // Note that since Go's thread scheduling is highly variable, callers + // cannot guarantee the requested namespace will be the current namespace + // after this function is called; to ensure this wrap operations that + // require the namespace with Do() instead. + Set() error + + // Returns the filesystem path representing this object's network namespace + Path() string + + // Returns a file descriptor representing this object's network namespace + Fd() uintptr + + // Cleans up this instance of the network namespace; if this instance + // is the last user the namespace will be destroyed + Close() error +} + +type netNS struct { + file *os.File + mounted bool + closed bool +} + +// netNS implements the NetNS interface +var _ NetNS = &netNS{} + +const ( + // https://github.com/torvalds/linux/blob/master/include/uapi/linux/magic.h + NSFS_MAGIC = 0x6e736673 + PROCFS_MAGIC = 0x9fa0 +) + +type NSPathNotExistErr struct{ msg string } + +func (e NSPathNotExistErr) Error() string { return e.msg } + +type NSPathNotNSErr struct{ msg string } + +func (e NSPathNotNSErr) Error() string { return e.msg } + +func IsNSorErr(nspath string) error { + stat := syscall.Statfs_t{} + if err := syscall.Statfs(nspath, &stat); err != nil { + if os.IsNotExist(err) { + err = NSPathNotExistErr{msg: fmt.Sprintf("failed to Statfs %q: %v", nspath, err)} + } else { + err = fmt.Errorf("failed to Statfs %q: %v", nspath, err) + } + return err + } + + switch stat.Type { + case PROCFS_MAGIC, NSFS_MAGIC: + return nil + default: + return NSPathNotNSErr{msg: fmt.Sprintf("unknown FS magic on %q: %x", nspath, stat.Type)} + } +} + +// Returns an object representing the namespace referred to by @path +func GetNS(nspath string) (NetNS, error) { + err := IsNSorErr(nspath) + if err != nil { + return nil, err + } + + fd, err := os.Open(nspath) + if err != nil { + return nil, err + } + + return &netNS{file: fd}, nil +} + +func (ns *netNS) Path() string { + return ns.file.Name() +} + +func (ns *netNS) Fd() uintptr { + return ns.file.Fd() +} + +func (ns *netNS) errorIfClosed() error { + if ns.closed { + return fmt.Errorf("%q has already been closed", ns.file.Name()) + } + return nil +} + +func (ns *netNS) Do(toRun func(NetNS) error) error { + if err := ns.errorIfClosed(); err != nil { + return err + } + + containedCall := func(hostNS NetNS) error { + threadNS, err := GetCurrentNS() + if err != nil { + return fmt.Errorf("failed to open current netns: %v", err) + } + defer threadNS.Close() + + // switch to target namespace + if err = ns.Set(); err != nil { + return fmt.Errorf("error switching to ns %v: %v", ns.file.Name(), err) + } + defer threadNS.Set() // switch back + + return toRun(hostNS) + } + + // save a handle to current network namespace + hostNS, err := GetCurrentNS() + if err != nil { + return fmt.Errorf("Failed to open current namespace: %v", err) + } + defer hostNS.Close() + + var wg sync.WaitGroup + wg.Add(1) + + var innerError error + go func() { + defer wg.Done() + runtime.LockOSThread() + innerError = containedCall(hostNS) + }() + wg.Wait() + + return innerError +} + +// WithNetNSPath executes the passed closure under the given network +// namespace, restoring the original namespace afterwards. +func WithNetNSPath(nspath string, toRun func(NetNS) error) error { + ns, err := GetNS(nspath) + if err != nil { + return err + } + defer ns.Close() + return ns.Do(toRun) +} diff --git a/pkg/ns/ns_test.go b/pkg/ns/ns_linux_test.go similarity index 100% rename from pkg/ns/ns_test.go rename to pkg/ns/ns_linux_test.go diff --git a/pkg/ns/ns_unspecified.go b/pkg/ns/ns_unspecified.go deleted file mode 100644 index 41b446862..000000000 --- a/pkg/ns/ns_unspecified.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015-2017 CNI authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !linux - -package ns - -import "github.com/containernetworking/cni/pkg/types" - -// Returns an object representing the current OS thread's network namespace -func GetCurrentNS() (NetNS, error) { - return nil, types.NotImplementedError -} - -func NewNS() (NetNS, error) { - return nil, types.NotImplementedError -} - -func (ns *netNS) Close() error { - return types.NotImplementedError -} - -func (ns *netNS) Set() error { - return types.NotImplementedError -} diff --git a/pkg/testutils/echosvr/echosvr_test.go b/pkg/testutils/echosvr/echosvr_test.go index 6a4c3bf80..901febd0c 100644 --- a/pkg/testutils/echosvr/echosvr_test.go +++ b/pkg/testutils/echosvr/echosvr_test.go @@ -37,7 +37,7 @@ var _ = Describe("Echosvr", func() { }) AfterEach(func() { - session.Terminate().Wait() + session.Kill().Wait() }) It("starts and doesn't terminate immediately", func() { diff --git a/plugins/ipam/host-local/backend/disk/lock.go b/plugins/ipam/host-local/backend/disk/lock.go index 724148251..bd4fce275 100644 --- a/plugins/ipam/host-local/backend/disk/lock.go +++ b/plugins/ipam/host-local/backend/disk/lock.go @@ -1,3 +1,4 @@ +// +build !windows // Copyright 2015 CNI authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/plugins/linux_only.txt b/plugins/linux_only.txt new file mode 100644 index 000000000..f4904b38f --- /dev/null +++ b/plugins/linux_only.txt @@ -0,0 +1,11 @@ +plugins/host-device +plugins/ipam/dhcp +plugins/ipam/host-local +plugins/main/bridge +plugins/main/ipvlan +plugins/main/loopback +plugins/main/macvlan +plugins/main/ptp +plugins/main/vlan +plugins/meta/portmap +plugins/meta/tuning diff --git a/plugins/meta/flannel/flannel_test.go b/plugins/meta/flannel/flannel_linux_test.go similarity index 100% rename from plugins/meta/flannel/flannel_test.go rename to plugins/meta/flannel/flannel_linux_test.go diff --git a/plugins/sample/sample_test.go b/plugins/sample/sample_linux_test.go similarity index 100% rename from plugins/sample/sample_test.go rename to plugins/sample/sample_linux_test.go