Skip to content

Commit

Permalink
Switch to ginkgo v2
Browse files Browse the repository at this point in the history
The GINKGO_PANIC replacement values come from
kubernetes/kubernetes@05c0f4a

See https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-5
for the ginkgo configuration migration strategy.

The shell scripts handle both v1 and v2 to avoid breaking dependent
projects.

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt authored and dfarrell07 committed Jan 6, 2023
1 parent b01f845 commit f4e8acf
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 48 deletions.
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/submariner-io/shipyard
go 1.19

require (
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.6.1
github.com/onsi/gomega v1.24.2
github.com/pkg/errors v0.9.1
github.com/psampaz/go-mod-outdated v0.8.0
Expand All @@ -19,7 +19,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/elazarl/goproxy v0.0.0-20200426045556-49ad98f6dac1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
Expand All @@ -39,7 +38,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand All @@ -52,7 +50,6 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
Expand Down
10 changes: 1 addition & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
Expand Down Expand Up @@ -181,7 +180,6 @@ github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+
github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA=
github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/gobuffalo/flect v0.2.0/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
Expand Down Expand Up @@ -339,8 +337,6 @@ 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.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
Expand All @@ -350,9 +346,8 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
github.com/onsi/ginkgo v1.11.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.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.6.1 h1:1xQPCjcqYw/J5LchOcp4/2q/jzJFjiAOc25chhnDw+Q=
github.com/onsi/ginkgo/v2 v2.6.1/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
Expand Down Expand Up @@ -599,7 +594,6 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
Expand Down Expand Up @@ -670,7 +664,6 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -773,7 +766,6 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
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/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
2 changes: 0 additions & 2 deletions package/Dockerfile.shipyard-dapper-base
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} PATH=/go/bin:/root/.l
# findutils | make unit (find unit test dirs)
# gcc | needed by `go test -race` (https://github.com/golang/go/issues/27089)
# gh | backport, releases
# ginkgo | tests
# git | find the workspace root
# golang | build
# golangci-lint | code linting
Expand Down Expand Up @@ -71,7 +70,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/i
i=0; until curl "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" | tar -xzf -; do if ((++i > 5)); then break; fi; sleep 1; done && \
mv linux-${ARCH}/helm /go/bin/ && chmod a+x /go/bin/helm && rm -rf linux-${ARCH} && \
curl -Lo /go/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-${ARCH}" && chmod a+x /go/bin/kind && \
GOFLAGS="" go install -v github.com/onsi/ginkgo/ginkgo@latest && \
GOFLAGS="" go install -v github.com/mikefarah/yq/v4@v${YQ_VERSION} && \
mkdir -p /usr/local/libexec/docker/cli-plugins && \
curl -L "https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-${ARCH}" -o /usr/local/libexec/docker/cli-plugins/docker-buildx && \
Expand Down
21 changes: 15 additions & 6 deletions scripts/shared/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@ function generate_kubecontexts() {
function test_with_e2e_tests {
cd "${DAPPER_SOURCE}/${TESTDIR}"

# shellcheck disable=SC2086 # TEST_ARGS is split on purpose
${GO:-go} test -v -timeout 30m -args -test.timeout 15m \
-submariner-namespace $SUBM_NS "${clusters[@]/#/-dp-context=}" \
-ginkgo.v -ginkgo.randomizeAllSpecs -ginkgo.trace \
-ginkgo.reportPassed -ginkgo.reportFile "${DAPPER_OUTPUT}/e2e-junit.xml" \
$TEST_ARGS 2>&1 | tee "${DAPPER_OUTPUT}/e2e-tests.log"
if go mod graph | grep 'submariner.*ginkgo/v2' >/dev/null; then
# shellcheck disable=SC2086 # TEST_ARGS is split on purpose
${GO:-go} test -v -timeout 30m -args -test.timeout 15m \
-submariner-namespace $SUBM_NS "${clusters[@]/#/-dp-context=}" \
--ginkgo.v --ginkgo.randomize-all --ginkgo.trace \
--ginkgo.junit-report "${DAPPER_OUTPUT}/e2e-junit.xml" \
$TEST_ARGS 2>&1 | tee "${DAPPER_OUTPUT}/e2e-tests.log"
else
# shellcheck disable=SC2086 # TEST_ARGS is split on purpose
${GO:-go} test -v -timeout 30m -args -test.timeout 15m \
-submariner-namespace $SUBM_NS "${clusters[@]/#/-dp-context=}" \
-ginkgo.v -ginkgo.randomizeAllSpecs -ginkgo.trace \
-ginkgo.reportPassed -ginkgo.reportFile "${DAPPER_OUTPUT}/e2e-junit.xml" \
$TEST_ARGS 2>&1 | tee "${DAPPER_OUTPUT}/e2e-tests.log"
fi
}

function test_with_subctl {
Expand Down
9 changes: 7 additions & 2 deletions scripts/shared/unit_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ for module in "${modules[@]}"; do
[ "${ARCH}" == "amd64" ] && race=-race
# It's important that the `go test` command's exit status is reported from this () block.
# Can't be one command (with -cover). Need detailed -coverprofile for Sonar and summary to console.
${GO:-go} test -v ${race} -coverprofile unit.coverprofile "${packages[@]}" -ginkgo.v -ginkgo.trace -ginkgo.reportPassed -ginkgo.reportFile junit.xml "$@" && \
go tool cover -func unit.coverprofile
if go mod graph | grep 'submariner.*ginkgo/v2' >/dev/null; then
${GO:-go} test -v ${race} -coverprofile unit.coverprofile "${packages[@]}" --ginkgo.v --ginkgo.trace --ginkgo.junit-report junit.xml "$@" && \
go tool cover -func unit.coverprofile
else
${GO:-go} test -v ${race} -coverprofile unit.coverprofile "${packages[@]}" -ginkgo.v -ginkgo.trace -ginkgo.reportPassed -ginkgo.reportFile junit.xml "$@" && \
go tool cover -func unit.coverprofile
fi
) || result=1
done

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

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/submariner-io/shipyard/test/e2e/framework"
"github.com/submariner-io/shipyard/test/e2e/tcp"
)
Expand Down
28 changes: 11 additions & 17 deletions test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import (
"strings"
"testing"

"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"github.com/submariner-io/shipyard/test/e2e/framework"
"k8s.io/client-go/rest"
Expand All @@ -39,7 +38,7 @@ import (
// This function takes two parameters: one function which runs on only the first Ginkgo node,
// returning an opaque byte array, and then a second function which runs on all Ginkgo nodes,
// accepting the byte array.
var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
var _ = SynchronizedBeforeSuite(func() []byte {
// Run only on Ginkgo node 1

framework.BeforeSuite()
Expand All @@ -52,7 +51,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
// Here, the order of functions is reversed; first, the function which runs everywhere,
// and then the function that only runs on the first Ginkgo node.

var _ = ginkgo.SynchronizedAfterSuite(func() {
var _ = SynchronizedAfterSuite(func() {
// Run on all Ginkgo nodes

// framework.Logf("Running AfterSuite actions on all node")
Expand All @@ -67,15 +66,15 @@ func init() {

func RunE2ETests(t *testing.T) bool {
framework.SetStatusFunction(func(text string) {
ginkgo.By(text)
By(text)
})

framework.SetFailFunction(func(text string) {
ginkgo.Fail(text)
Fail(text)
})

framework.SetUserAgentFunction(func() string {
testDesc := ginkgo.CurrentGinkgoTestDescription()
testDesc := CurrentGinkgoTestDescription()
prefix := "ginkgo"
if len(testDesc.ComponentTexts) > 0 {
prefix = strings.Join(testDesc.ComponentTexts, " ")
Expand All @@ -84,17 +83,12 @@ func RunE2ETests(t *testing.T) bool {
})

framework.ValidateFlags(framework.TestContext)
gomega.RegisterFailHandler(ginkgo.Fail)
gomega.RegisterFailHandler(Fail)

// If the ginkgo default for slow test was not modified, bump it to 45 seconds
if config.DefaultReporterConfig.SlowSpecThreshold == 5.0 {
config.DefaultReporterConfig.SlowSpecThreshold = 45.0
suiteConfig, reporterConfig := GinkgoConfiguration()
if framework.TestContext.JunitReport != "" {
reporterConfig.JUnitReport = framework.TestContext.JunitReport
}

// Set junit report path and filename if required by user
// The default of the parameter is set to empty, so if not used
// creation of report will be skipped
config.DefaultReporterConfig.ReportFile = framework.TestContext.JunitReport

return ginkgo.RunSpecs(t, "Submariner E2E suite")
return RunSpecs(t, "Submariner E2E suite", suiteConfig, reporterConfig)
}
2 changes: 1 addition & 1 deletion test/e2e/example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/submariner-io/shipyard/test/e2e/framework"
v1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/ginkgo_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.

package framework

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

// NewFramework creates a test framework, under ginkgo.
func NewFramework(baseName string) *Framework {
Expand Down
26 changes: 23 additions & 3 deletions test/e2e/framework/ginkgowrapper/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"runtime/debug"
"strings"

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

// FailurePanic is the value that will be panicked from Fail.
Expand All @@ -37,8 +37,18 @@ type FailurePanic struct {
FullStackTrace string // A full stack trace starting at the source of the failure
}

const ginkgoFailurePanic = `
Your test failed.
Ginkgo panics to prevent subsequent assertions from running.
Normally Ginkgo rescues this panic so you shouldn't see it.
But, if you make an assertion in a goroutine, Ginkgo can't capture the panic.
To circumvent this, you should call
defer GinkgoRecover()
at the top of the goroutine that caused this panic.
`

// String makes FailurePanic look like the old Ginkgo panic when printed.
func (FailurePanic) String() string { return ginkgo.GINKGO_PANIC }
func (FailurePanic) String() string { return ginkgoFailurePanic }

// Fail wraps ginkgo.Fail so that it panics with more useful
// information about the failure. This function will panic with a
Expand Down Expand Up @@ -75,8 +85,18 @@ type SkipPanic struct {
FullStackTrace string // A full stack trace starting at the source of the failure
}

const ginkgoSkipPanic = `
Your test was skipped.
Ginkgo panics to prevent subsequent assertions from running.
Normally Ginkgo rescues this panic so you shouldn't see it.
But, if you make an assertion in a goroutine, Ginkgo can't capture the panic.
To circumvent this, you should call
defer GinkgoRecover()
at the top of the goroutine that caused this panic.
`

// String makes SkipPanic look like the old Ginkgo panic when printed.
func (SkipPanic) String() string { return ginkgo.GINKGO_PANIC }
func (SkipPanic) String() string { return ginkgoSkipPanic }

// Skip wraps ginkgo.Skip so that it panics with more useful
// information about why the test is being skipped. This function will
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"time"

"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/submariner-io/shipyard/test/e2e/framework/ginkgowrapper"
)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tcp/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package tcp
import (
"fmt"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/submariner-io/shipyard/test/e2e/framework"
v1 "k8s.io/api/core/v1"
Expand Down

0 comments on commit f4e8acf

Please sign in to comment.