mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-08-22 18:18:00 +00:00
adding unit test fixes
This commit is contained in:
parent
2939335643
commit
05b4321ab1
@ -399,7 +399,7 @@ func updateRoutes(rObj cnitypes.Result) (cnitypes.Result, error) {
|
|||||||
|
|
||||||
// fixInterfaces fixes bad result returned by CNI plugin
|
// fixInterfaces fixes bad result returned by CNI plugin
|
||||||
// some plugins(for example calico) return empty Interfaces list but
|
// some plugins(for example calico) return empty Interfaces list but
|
||||||
// in IPConfig sets Interface index to 0. In such case it should be nil
|
// in IPConfig sets Interface index to 0. In such case it should be nil
|
||||||
func fixInterfaces(rObj cnitypes.Result) (cnitypes.Result, error) {
|
func fixInterfaces(rObj cnitypes.Result) (cnitypes.Result, error) {
|
||||||
result, err := current.NewResultFromResult(rObj)
|
result, err := current.NewResultFromResult(rObj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containernetworking/cni/pkg/skel"
|
"github.com/containernetworking/cni/pkg/skel"
|
||||||
cnitypes "github.com/containernetworking/cni/pkg/types"
|
cnitypes "github.com/containernetworking/cni/pkg/types"
|
||||||
"github.com/containernetworking/cni/pkg/types/020"
|
types020 "github.com/containernetworking/cni/pkg/types/020"
|
||||||
cniversion "github.com/containernetworking/cni/pkg/version"
|
cniversion "github.com/containernetworking/cni/pkg/version"
|
||||||
"github.com/containernetworking/plugins/pkg/ns"
|
"github.com/containernetworking/plugins/pkg/ns"
|
||||||
"github.com/containernetworking/plugins/pkg/testutils"
|
"github.com/containernetworking/plugins/pkg/testutils"
|
||||||
@ -227,7 +227,7 @@ var _ = Describe("multus operations", func() {
|
|||||||
result, err := cmdAdd(args, fExec, nil)
|
result, err := cmdAdd(args, fExec, nil)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(fExec.addIndex).To(Equal(len(fExec.plugins)))
|
Expect(fExec.addIndex).To(Equal(len(fExec.plugins)))
|
||||||
r := result.(*types020.Result)
|
r, _ := result.GetAsVersion("0.2.0")
|
||||||
// plugin 1 is the masterplugin
|
// plugin 1 is the masterplugin
|
||||||
Expect(reflect.DeepEqual(r, expectedResult1)).To(BeTrue())
|
Expect(reflect.DeepEqual(r, expectedResult1)).To(BeTrue())
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ var _ = Describe("multus operations", func() {
|
|||||||
Expect(fExec.addIndex).To(Equal(len(fExec.plugins)))
|
Expect(fExec.addIndex).To(Equal(len(fExec.plugins)))
|
||||||
Expect(fKubeClient.PodCount).To(Equal(2))
|
Expect(fKubeClient.PodCount).To(Equal(2))
|
||||||
Expect(fKubeClient.NetCount).To(Equal(2))
|
Expect(fKubeClient.NetCount).To(Equal(2))
|
||||||
r := result.(*types020.Result)
|
r, _ := result.GetAsVersion("0.2.0")
|
||||||
// plugin 1 is the masterplugin
|
// plugin 1 is the masterplugin
|
||||||
Expect(reflect.DeepEqual(r, expectedResult1)).To(BeTrue())
|
Expect(reflect.DeepEqual(r, expectedResult1)).To(BeTrue())
|
||||||
})
|
})
|
||||||
@ -454,7 +454,7 @@ var _ = Describe("multus operations", func() {
|
|||||||
Expect(fExec.addIndex).To(Equal(len(fExec.plugins)))
|
Expect(fExec.addIndex).To(Equal(len(fExec.plugins)))
|
||||||
Expect(fKubeClient.PodCount).To(Equal(2))
|
Expect(fKubeClient.PodCount).To(Equal(2))
|
||||||
Expect(fKubeClient.NetCount).To(Equal(2))
|
Expect(fKubeClient.NetCount).To(Equal(2))
|
||||||
r := result.(*types020.Result)
|
r, _ := result.GetAsVersion("0.2.0")
|
||||||
// plugin 1 is the masterplugin
|
// plugin 1 is the masterplugin
|
||||||
Expect(reflect.DeepEqual(r, expectedResult1)).To(BeTrue())
|
Expect(reflect.DeepEqual(r, expectedResult1)).To(BeTrue())
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user