Update tests to utilize ginkgo/v2

This commit updates the import of ginkgo to v2 in
all of the tests.

Signed-off-by: liornoy <lnoy@redhat.com>
Co-authored-by: Sascha Grunert <sgrunert@redhat.com>
This commit is contained in:
liornoy
2023-01-18 12:30:11 +02:00
parent 23c2134110
commit 2d1005ec02
73 changed files with 107 additions and 99 deletions

View File

@ -31,7 +31,7 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/testutils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)

View File

@ -30,7 +30,7 @@ import (
"github.com/vishvananda/netlink"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -30,7 +30,7 @@ import (
"github.com/godbus/dbus/v5"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -26,7 +26,7 @@ import (
types100 "github.com/containernetworking/cni/pkg/types/100"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/testutils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -31,7 +31,7 @@ import (
"github.com/coreos/go-iptables/iptables"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -15,7 +15,7 @@
package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"testing"

View File

@ -23,7 +23,7 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/testutils"
"github.com/coreos/go-iptables/iptables"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
@ -36,7 +36,7 @@ var _ = Describe("chain tests", func() {
var testNs ns.NetNS
var cleanup func()
BeforeEach(func() {
beforeEach := func() {
// Save a reference to the original namespace,
// Add a new NS
@ -84,9 +84,10 @@ var _ = Describe("chain tests", func() {
currNs.Set()
}
})
}
It("creates and destroys a chain", func() {
beforeEach()
defer cleanup()
tlChainName := testChain.entryChains[0]
@ -152,6 +153,7 @@ var _ = Describe("chain tests", func() {
})
It("creates chains idempotently", func() {
beforeEach()
defer cleanup()
err := testChain.setup(ipt)
@ -171,6 +173,7 @@ var _ = Describe("chain tests", func() {
})
It("deletes chains idempotently", func() {
beforeEach()
defer cleanup()
err := testChain.setup(ipt)
@ -199,6 +202,7 @@ var _ = Describe("chain tests", func() {
})
It("deletes chains idempotently in parallel", func() {
beforeEach()
defer cleanup()
// number of parallel executions
N := 10

View File

@ -29,14 +29,12 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/testutils"
"github.com/coreos/go-iptables/iptables"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"github.com/vishvananda/netlink"
)
const TIMEOUT = 90
func makeConfig(ver string) *libcni.NetworkConfigList {
configList, err := libcni.ConfListFromBytes([]byte(fmt.Sprintf(`{
"cniVersion": "%s",
@ -224,7 +222,7 @@ var _ = Describe("portmap integration tests", func() {
}
close(done)
}, TIMEOUT*9)
})
It(fmt.Sprintf("[%s] forwards a UDP port on ipv4 and keep working after creating a second container with the same HostPort", ver), func(done Done) {
var err error
@ -421,7 +419,7 @@ var _ = Describe("portmap integration tests", func() {
}
close(done)
}, TIMEOUT*9)
})
})
}
})

View File

@ -24,8 +24,7 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
@ -34,7 +33,7 @@ import (
)
func TestPortmap(t *testing.T) {
rand.Seed(config.GinkgoConfig.RandomSeed)
rand.Seed(GinkgoRandomSeed())
RegisterFailHandler(Fail)
RunSpecs(t, "plugins/meta/portmap")

View File

@ -19,7 +19,7 @@ import (
"github.com/containernetworking/cni/pkg/types"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -26,7 +26,7 @@ import (
"github.com/vishvananda/netlink"
"golang.org/x/sys/unix"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -3,7 +3,7 @@
package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"testing"

View File

@ -15,7 +15,7 @@
package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"testing"

View File

@ -30,7 +30,7 @@ import (
"github.com/vishvananda/netlink"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -15,7 +15,7 @@
package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"testing"

View File

@ -26,8 +26,7 @@ import (
"github.com/vishvananda/netlink"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)