Skip to content

Commit

Permalink
Switch to ginkgo/v2
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed May 2, 2022
1 parent 91c7f10 commit ce9a5ae
Show file tree
Hide file tree
Showing 249 changed files with 16,958 additions and 11,643 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/containerd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
go get -u github.com/onsi/ginkgo/ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo@latest
ginkgo version
sudo cp $(command -v ginkgo) /usr/local/bin
- name: Install ginkgo on Windows
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
go get -u github.com/onsi/ginkgo/ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo@latest
ginkgo version
cp $(command -v ginkgo) /usr/local/bin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/crio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Install ginkgo
run: |
go get -u github.com/onsi/ginkgo/ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo@latest
ginkgo version
sudo cp $(command -v ginkgo) /usr/local/bin
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ $(GOLANGCI_LINT):


$(GINKGO):
$(call go-build,./vendor/github.com/onsi/ginkgo/ginkgo)
$(call go-build,./vendor/github.com/onsi/ginkgo/v2/ginkgo)

release:
hack/release.sh
Expand All @@ -123,7 +123,6 @@ test-e2e: $(GINKGO)
-r -p \
--randomizeAllSpecs \
--randomizeSuites \
--succinct \
--slowSpecThreshold 60 \
test

Expand Down
4 changes: 2 additions & 2 deletions cmd/critest/cri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"testing"
"time"

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

_ "github.com/kubernetes-sigs/cri-tools/pkg/benchmark"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/docker/go-units v0.4.0
github.com/golang/glog v1.0.0
github.com/golang/protobuf v1.5.2
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.1.3
github.com/onsi/gomega v1.19.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/runc v1.1.0
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
Expand Down Expand Up @@ -458,17 +459,15 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc=
github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
Expand Down Expand Up @@ -1099,7 +1098,6 @@ gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/warnings.v0 v0.1.1/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
Expand Down
2 changes: 1 addition & 1 deletion hack/run-dockershim-critest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sleep 10
# Skip runtime should support execSync with timeout because docker doesn't
# support it.
# Skip apparmor test as we don't enable apparmor yet in this CI job.
sudo critest -ginkgo.skip=${SKIP} -parallel 1
sudo critest -ginkgo.skip=${SKIP}

# Run benchmark test cases
sudo critest -benchmark
9 changes: 5 additions & 4 deletions pkg/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (

"github.com/golang/glog"
"github.com/kubernetes-sigs/cri-tools/pkg/framework"
"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/reporters"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/reporters"

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

Expand All @@ -47,8 +47,9 @@ func TestPerformance(t *testing.T) {
if err := os.MkdirAll(reportDir, 0755); err != nil {
glog.Errorf("Failed creating report directory: %v", err)
} else {
suite, _ := ginkgo.GinkgoConfiguration()
// Configure a junit reporter to write to the directory
junitFile := fmt.Sprintf("junit_%s%02d.xml", framework.TestContext.ReportPrefix, config.GinkgoConfig.ParallelNode)
junitFile := fmt.Sprintf("junit_%s%02d.xml", framework.TestContext.ReportPrefix, suite.ParallelProcess)
junitPath := path.Join(reportDir, junitFile)
r = append(r, reporters.NewJUnitReporter(junitPath))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/benchmark/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/benchmark/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/benchmark/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/benchmark/pod_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package framework
import (
internalapi "k8s.io/cri-api/pkg/apis"

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

Expand Down
10 changes: 6 additions & 4 deletions pkg/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"runtime"
"time"

"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/v2"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -69,14 +69,16 @@ const DefaultRegistryPrefix = "docker.io/library"

// RegisterFlags registers flags to e2e test suites.
func RegisterFlags() {
suite, reporter := ginkgo.GinkgoConfiguration()

// Turn on verbose by default to get spec names
config.DefaultReporterConfig.Verbose = true
reporter.Verbose = true

// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
config.GinkgoConfig.EmitSpecProgress = true
suite.EmitSpecProgress = true

// Randomize specs as well as suites
config.GinkgoConfig.RandomizeAllSpecs = true
suite.RandomizeAllSpecs = true

flag.StringVar(&TestContext.ReportPrefix, "report-prefix", "", "Optional prefix for JUnit XML reports. Default is empty, which doesn't prepend anything to the default name.")
flag.StringVar(&TestContext.ReportDir, "report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
"k8s.io/kubernetes/pkg/kubelet/cri/remote"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/apparmor_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
9 changes: 5 additions & 4 deletions pkg/validate/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (

"github.com/golang/glog"
"github.com/kubernetes-sigs/cri-tools/pkg/framework"
"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/reporters"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/reporters"

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

Expand All @@ -48,8 +48,9 @@ func TestE2ECRI(t *testing.T) {
if err := os.MkdirAll(reportDir, 0755); err != nil {
glog.Errorf("Failed creating report directory: %v", err)
} else {
suite, _ := ginkgo.GinkgoConfiguration()
// Configure a junit reporter to write to the directory
junitFile := fmt.Sprintf("junit_%s%02d.xml", framework.TestContext.ReportPrefix, config.GinkgoConfig.ParallelNode)
junitFile := fmt.Sprintf("junit_%s%02d.xml", framework.TestContext.ReportPrefix, suite.ParallelProcess)
junitPath := path.Join(reportDir, junitFile)
r = append(r, reporters.NewJUnitReporter(junitPath))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/multi_container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/pod_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/runtime_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/security_context_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/selinux_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/streaming_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"

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

var _ = framework.KubeDescribe("Streaming", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package e2e

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

// The actual test suite
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package e2e

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

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package e2e

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

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"

. "github.com/kubernetes-sigs/cri-tools/test/framework"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down

0 comments on commit ce9a5ae

Please sign in to comment.