Skip to content

Commit

Permalink
Merge pull request #812 from liornoy/ginkgov2
Browse files Browse the repository at this point in the history
Update ginkgo to v2
  • Loading branch information
dcbw authored Feb 20, 2023
2 parents 286064b + 2d1005e commit 36e1e16
Show file tree
Hide file tree
Showing 246 changed files with 14,209 additions and 10,602 deletions.
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containernetworking/plugins

go 1.17
go 1.18

require (
github.com/Microsoft/hcsshim v0.9.6
Expand All @@ -15,7 +15,7 @@ require (
github.com/godbus/dbus/v5 v5.1.0
github.com/mattn/go-shellwords v1.0.12
github.com/networkplumbing/go-nft v0.2.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.7.0
github.com/onsi/gomega v1.26.0
github.com/opencontainers/selinux v1.8.2
github.com/safchain/ethtool v0.2.0
Expand All @@ -27,17 +27,15 @@ require (
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/containerd/cgroups v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
go.opencensus.io v0.22.3 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/text v0.6.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
59 changes: 0 additions & 59 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration/integration_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
Expand Down
2 changes: 1 addition & 1 deletion integration/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"strings"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/hns/netconf_suite_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package hns

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
2 changes: 1 addition & 1 deletion pkg/hns/netconf_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"net"

"github.com/Microsoft/hcsshim/hcn"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ip/cidr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package ip
import (
"net"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ip/ip_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package ip_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
12 changes: 6 additions & 6 deletions pkg/ip/ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"
"net"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down Expand Up @@ -174,8 +174,8 @@ var _ = Describe("IP Operations", func() {
}
})

It("Decode", func() {
Context("valid IP", func() {
Context("Decode", func() {
It("valid IP", func() {
testCases := []struct {
text string
expected *IP
Expand Down Expand Up @@ -208,15 +208,15 @@ var _ = Describe("IP Operations", func() {

})

Context("empty text", func() {
It("empty text", func() {
ip := &IP{}
err := json.Unmarshal([]byte(`""`), ip)

Expect(err).NotTo(HaveOccurred())
Expect(ip).To(Equal(newIP(nil, nil)))
})

Context("invalid IP", func() {
It("invalid IP", func() {
testCases := []struct {
text string
expectedErr error
Expand All @@ -243,7 +243,7 @@ var _ = Describe("IP Operations", func() {
}
})

Context("IP slice", func() {
It("IP slice", func() {
testCases := []struct {
text string
expected []*IP
Expand Down
2 changes: 1 addition & 1 deletion pkg/ip/ipforward_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ip/link_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"net"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/containernetworking/plugins/pkg/ip"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipam/ipam_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/vishvananda/netlink"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ipam/ipam_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package ipam_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
2 changes: 1 addition & 1 deletion pkg/link/link_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package link_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/link/spoofcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"github.com/networkplumbing/go-nft/nft"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/containernetworking/plugins/pkg/link"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ns/ns_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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"
"golang.org/x/sys/unix"
)
Expand Down
5 changes: 2 additions & 3 deletions pkg/ns/ns_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ import (
"math/rand"
"runtime"

. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
)

func TestNs(t *testing.T) {
rand.Seed(config.GinkgoConfig.RandomSeed)
rand.Seed(GinkgoRandomSeed())
runtime.LockOSThread()

RegisterFailHandler(Fail)
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/echo/echo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os/exec"
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/echo/init_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/iptables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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"
)

Expand Down
10 changes: 7 additions & 3 deletions pkg/utils/sysctl/sysctl_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/testutils"
"github.com/containernetworking/plugins/pkg/utils/sysctl"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/vishvananda/netlink"
)
Expand All @@ -37,7 +37,7 @@ var _ = Describe("Sysctl tests", func() {
var testIfaceName string
var cleanup func()

BeforeEach(func() {
beforeEach := func() {

// Save a reference to the original namespace,
// Add a new NS
Expand Down Expand Up @@ -67,14 +67,15 @@ var _ = Describe("Sysctl tests", func() {
currNs.Set()
}

})
}

AfterEach(func() {
cleanup()
})

Describe("Sysctl", func() {
It("reads keys with dot separators", func() {
beforeEach()
sysctlIfaceName := strings.Replace(testIfaceName, ".", "/", -1)
sysctlKey := fmt.Sprintf(sysctlDotKeyTemplate, sysctlIfaceName)

Expand All @@ -85,6 +86,7 @@ var _ = Describe("Sysctl tests", func() {

Describe("Sysctl", func() {
It("reads keys with slash separators", func() {
beforeEach()
sysctlKey := fmt.Sprintf(sysctlSlashKeyTemplate, testIfaceName)

_, err := sysctl.Sysctl(sysctlKey)
Expand All @@ -94,6 +96,7 @@ var _ = Describe("Sysctl tests", func() {

Describe("Sysctl", func() {
It("writes keys with dot separators", func() {
beforeEach()
sysctlIfaceName := strings.Replace(testIfaceName, ".", "/", -1)
sysctlKey := fmt.Sprintf(sysctlDotKeyTemplate, sysctlIfaceName)

Expand All @@ -104,6 +107,7 @@ var _ = Describe("Sysctl tests", func() {

Describe("Sysctl", func() {
It("writes keys with slash separators", func() {
beforeEach()
sysctlKey := fmt.Sprintf(sysctlSlashKeyTemplate, testIfaceName)

_, err := sysctl.Sysctl(sysctlKey, "1")
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/sysctl/sysctl_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package sysctl_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/utils_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package utils_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion plugins/ipam/dhcp/dhcp2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

"github.com/vishvananda/netlink"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion plugins/ipam/dhcp/dhcp_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package main

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
2 changes: 1 addition & 1 deletion plugins/ipam/dhcp/dhcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
"github.com/d2g/dhcp4server/leasepool"
"github.com/d2g/dhcp4server/leasepool/memorypool"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package allocator_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
current "github.com/containernetworking/cni/pkg/types/100"
fakestore "github.com/containernetworking/plugins/plugins/ipam/host-local/backend/testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion plugins/ipam/host-local/backend/allocator/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"net"

"github.com/containernetworking/cni/pkg/types"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package allocator
import (
"net"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
Loading

0 comments on commit 36e1e16

Please sign in to comment.