From 26834c3e6390064e09cb1c670c349f8c09660c1a Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Thu, 20 Sep 2018 11:04:13 +0200 Subject: [PATCH 1/5] pkg/ip: Add missing error check Signed-off-by: Michal Rostecki --- pkg/ip/ipforward_linux_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/ip/ipforward_linux_test.go b/pkg/ip/ipforward_linux_test.go index eeedcc2e..c789bb89 100644 --- a/pkg/ip/ipforward_linux_test.go +++ b/pkg/ip/ipforward_linux_test.go @@ -12,6 +12,7 @@ import ( var _ = Describe("IpforwardLinux", func() { It("echo1 must not write the file if content is 1", func() { file, err := ioutil.TempFile(os.TempDir(), "containernetworking") + Expect(err).NotTo(HaveOccurred()) defer os.Remove(file.Name()) err = echo1(file.Name()) Expect(err).NotTo(HaveOccurred()) From 947a5881fcc73ee8447db1bf53536f29d0c4a768 Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Thu, 20 Sep 2018 11:05:15 +0200 Subject: [PATCH 2/5] pkg/ns: Add missing error checks Signed-off-by: Michal Rostecki --- pkg/ns/ns_linux_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/ns/ns_linux_test.go b/pkg/ns/ns_linux_test.go index b375802c..26e1ecd1 100644 --- a/pkg/ns/ns_linux_test.go +++ b/pkg/ns/ns_linux_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 CNI authors +// Copyright 2016-2018 CNI authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -112,6 +112,7 @@ var _ = Describe("Linux namespace operations", func() { Expect(hostNSInode).To(Equal(origNSInode)) return nil }) + Expect(err).NotTo(HaveOccurred()) return nil }) Expect(err).NotTo(HaveOccurred()) @@ -224,6 +225,7 @@ var _ = Describe("Linux namespace operations", func() { Describe("IsNSorErr", func() { It("should detect a namespace", func() { createdNetNS, err := testutils.NewNS() + Expect(err).NotTo(HaveOccurred()) defer testutils.UnmountNS(createdNetNS) err = ns.IsNSorErr(createdNetNS.Path()) Expect(err).NotTo(HaveOccurred()) From 1a3f49c7aef6e045e0104bb9e7b2f67ed7fb3615 Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Thu, 20 Sep 2018 11:05:58 +0200 Subject: [PATCH 3/5] plugins/ipam: Add missing error check Signed-off-by: Michal Rostecki --- plugins/ipam/dhcp/dhcp_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/ipam/dhcp/dhcp_test.go b/plugins/ipam/dhcp/dhcp_test.go index 5fe74353..101726e0 100644 --- a/plugins/ipam/dhcp/dhcp_test.go +++ b/plugins/ipam/dhcp/dhcp_test.go @@ -1,4 +1,4 @@ -// Copyright 2015 CNI authors +// Copyright 2015-2018 CNI authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -157,6 +157,7 @@ var _ = Describe("DHCP Operations", func() { Mask: net.IPv4Mask(0, 0, 0, 0), }, }) + Expect(err).NotTo(HaveOccurred()) cont, err := netlink.LinkByName(contVethName) Expect(err).NotTo(HaveOccurred()) From 8c61a2c2f3ab5228104130356f32fb374bc4a7c9 Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Thu, 20 Sep 2018 11:06:28 +0200 Subject: [PATCH 4/5] plugins/main: Add missing error checks Signed-off-by: Michal Rostecki --- plugins/main/bridge/bridge_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/main/bridge/bridge_test.go b/plugins/main/bridge/bridge_test.go index 6ed07a5e..aa1f8300 100644 --- a/plugins/main/bridge/bridge_test.go +++ b/plugins/main/bridge/bridge_test.go @@ -1,4 +1,4 @@ -// Copyright 2015 CNI authors +// Copyright 2015-2018 CNI authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -431,6 +431,7 @@ func (tester *testerV03x) cmdDelTest(tc testCase) { Expect(link).To(BeNil()) return nil }) + Expect(err).NotTo(HaveOccurred()) } type testerV01xOr02x struct { @@ -939,6 +940,7 @@ var _ = Describe("bridge Operations", func() { for _, tc := range testCases { tc.cniVersion = "0.3.1" _, _, err := setupBridge(tc.netConf()) + Expect(err).NotTo(HaveOccurred()) link, err := netlink.LinkByName(BRNAME) Expect(err).NotTo(HaveOccurred()) origMac := link.Attrs().HardwareAddr From f5f787057def26d5b0f5530f5f00c450a56623dc Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Thu, 20 Sep 2018 11:06:50 +0200 Subject: [PATCH 5/5] plugins/meta: Add missing error checks Signed-off-by: Michal Rostecki --- plugins/meta/bandwidth/bandwidth_suite_test.go | 1 + plugins/meta/portmap/chain_test.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/meta/bandwidth/bandwidth_suite_test.go b/plugins/meta/bandwidth/bandwidth_suite_test.go index 5aea8763..d59bb594 100644 --- a/plugins/meta/bandwidth/bandwidth_suite_test.go +++ b/plugins/meta/bandwidth/bandwidth_suite_test.go @@ -167,6 +167,7 @@ func createVeth(hostNamespace string, hostVethIfName string, containerNamespace Expect(err).NotTo(HaveOccurred()) containerNs, err := ns.GetNS(containerNamespace) + Expect(err).NotTo(HaveOccurred()) err = containerNs.Do(func(_ ns.NetNS) error { peerAddr := &net.IPNet{ IP: hostIP, diff --git a/plugins/meta/portmap/chain_test.go b/plugins/meta/portmap/chain_test.go index e5f575e2..c9571736 100644 --- a/plugins/meta/portmap/chain_test.go +++ b/plugins/meta/portmap/chain_test.go @@ -1,4 +1,4 @@ -// Copyright 2017 CNI authors +// Copyright 2017-2018 CNI authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -178,6 +178,7 @@ var _ = Describe("chain tests", func() { Expect(err).NotTo(HaveOccurred()) chains, err := ipt.ListChains(TABLE) + Expect(err).NotTo(HaveOccurred()) for _, chain := range chains { if chain == testChain.name { Fail("Chain was not deleted") @@ -187,6 +188,7 @@ var _ = Describe("chain tests", func() { err = testChain.teardown(ipt) Expect(err).NotTo(HaveOccurred()) chains, err = ipt.ListChains(TABLE) + Expect(err).NotTo(HaveOccurred()) for _, chain := range chains { if chain == testChain.name { Fail("Chain was not deleted")