Merge pull request #583 from karlkfi/karl-ginkgo-v2

chore: Upgrade to Ginkgo v2
This commit is contained in:
Kubernetes Prow Robot 2022-04-22 10:56:12 -07:00 committed by GitHub
commit 1fead05e8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 108 additions and 111 deletions

View File

@ -22,7 +22,7 @@ all: generate license fix vet fmt test lint tidy
go install k8s.io/code-generator/cmd/deepcopy-gen@v0.23.6 go install k8s.io/code-generator/cmd/deepcopy-gen@v0.23.6
"$(MYGOBIN)/ginkgo": "$(MYGOBIN)/ginkgo":
go install github.com/onsi/ginkgo/ginkgo@v1.16.5 go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.3
"$(MYGOBIN)/mdrip": "$(MYGOBIN)/mdrip":
go install github.com/monopole/mdrip@v1.0.2 go install github.com/monopole/mdrip@v1.0.2

4
go.mod
View File

@ -5,7 +5,7 @@ go 1.17
require ( require (
github.com/google/go-cmp v0.5.6 github.com/google/go-cmp v0.5.6
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
github.com/onsi/ginkgo v1.16.5 github.com/onsi/ginkgo/v2 v2.1.3
github.com/onsi/gomega v1.17.0 github.com/onsi/gomega v1.17.0
github.com/spf13/cobra v1.3.0 github.com/spf13/cobra v1.3.0
github.com/spyzhov/ajson v0.4.2 github.com/spyzhov/ajson v0.4.2
@ -73,7 +73,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
@ -97,7 +96,6 @@ require (
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.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.v2 v2.4.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect

3
go.sum
View File

@ -300,6 +300,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-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-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-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
@ -481,6 +482,8 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= 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 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= 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= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -6,7 +6,7 @@ package e2e
import ( import (
"context" "context"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apis/actuation" "sigs.k8s.io/cli-utils/pkg/apis/actuation"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -6,7 +6,7 @@ package e2e
import ( import (
"testing" "testing"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/onsi/gomega/format" "github.com/onsi/gomega/format"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
@ -46,11 +46,9 @@ var defaultTestTimeout = 5 * time.Minute
var defaultBeforeTestTimeout = 30 * time.Second var defaultBeforeTestTimeout = 30 * time.Second
var defaultAfterTestTimeout = 30 * time.Second var defaultAfterTestTimeout = 30 * time.Second
var _ = Describe("Applier", func() { var c client.Client
var c client.Client var _ = BeforeSuite(func() {
BeforeSuite(func() {
// increase from 4000 to handle long event lists // increase from 4000 to handle long event lists
format.MaxLength = 10000 format.MaxLength = 10000
@ -78,15 +76,16 @@ var _ = Describe("Applier", func() {
defer cancel() defer cancel()
e2eutil.CreateInventoryCRD(ctx, c) e2eutil.CreateInventoryCRD(ctx, c)
Expect(ctx.Err()).To(BeNil(), "BeforeSuite context cancelled or timed out") Expect(ctx.Err()).To(BeNil(), "BeforeSuite context cancelled or timed out")
}) })
AfterSuite(func() { var _ = AfterSuite(func() {
ctx, cancel := context.WithTimeout(context.Background(), defaultAfterTestTimeout) ctx, cancel := context.WithTimeout(context.Background(), defaultAfterTestTimeout)
defer cancel() defer cancel()
e2eutil.DeleteInventoryCRD(ctx, c) e2eutil.DeleteInventoryCRD(ctx, c)
Expect(ctx.Err()).To(BeNil(), "AfterSuite context cancelled or timed out") Expect(ctx.Err()).To(BeNil(), "AfterSuite context cancelled or timed out")
}) })
var _ = Describe("E2E", func() {
for i := range inventoryConfigTypes { for i := range inventoryConfigTypes {
invType := inventoryConfigTypes[i] invType := inventoryConfigTypes[i]
Context(fmt.Sprintf("Inventory%s", invType), func() { Context(fmt.Sprintf("Inventory%s", invType), func() {

View File

@ -10,7 +10,7 @@ import (
"text/template" "text/template"
"time" "time"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega" "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apis/actuation" "sigs.k8s.io/cli-utils/pkg/apis/actuation"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apis/actuation" "sigs.k8s.io/cli-utils/pkg/apis/actuation"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cli-utils/pkg/apply" "sigs.k8s.io/cli-utils/pkg/apply"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"

View File

@ -6,7 +6,7 @@ package stress
import ( import (
"testing" "testing"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )

View File

@ -7,7 +7,7 @@ import (
"context" "context"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/onsi/gomega/format" "github.com/onsi/gomega/format"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
@ -33,12 +33,10 @@ var defaultTestTimeout = 1 * time.Hour
var defaultBeforeTestTimeout = 30 * time.Second var defaultBeforeTestTimeout = 30 * time.Second
var defaultAfterTestTimeout = 30 * time.Second var defaultAfterTestTimeout = 30 * time.Second
var _ = Describe("Applier", func() { var c client.Client
var invConfig invconfig.InventoryConfig
var c client.Client var _ = BeforeSuite(func() {
var invConfig invconfig.InventoryConfig
BeforeSuite(func() {
// increase from 4000 to handle long event lists // increase from 4000 to handle long event lists
format.MaxLength = 10000 format.MaxLength = 10000
@ -65,16 +63,16 @@ var _ = Describe("Applier", func() {
defer cancel() defer cancel()
e2eutil.CreateInventoryCRD(ctx, c) e2eutil.CreateInventoryCRD(ctx, c)
Expect(ctx.Err()).To(BeNil(), "BeforeSuite context cancelled or timed out") Expect(ctx.Err()).To(BeNil(), "BeforeSuite context cancelled or timed out")
}) })
AfterSuite(func() { var _ = AfterSuite(func() {
ctx, cancel := context.WithTimeout(context.Background(), defaultAfterTestTimeout) ctx, cancel := context.WithTimeout(context.Background(), defaultAfterTestTimeout)
defer cancel() defer cancel()
e2eutil.DeleteInventoryCRD(ctx, c) e2eutil.DeleteInventoryCRD(ctx, c)
Expect(ctx.Err()).To(BeNil(), "AfterSuite context cancelled or timed out") Expect(ctx.Err()).To(BeNil(), "AfterSuite context cancelled or timed out")
}) })
Context("StressTest", func() { var _ = Describe("Stress", func() {
var namespace *v1.Namespace var namespace *v1.Namespace
var inventoryName string var inventoryName string
var ctx context.Context var ctx context.Context
@ -98,5 +96,4 @@ var _ = Describe("Applier", func() {
It("ThousandNamespaces", func() { It("ThousandNamespaces", func() {
thousandNamespacesTest(ctx, c, invConfig, inventoryName, namespace.GetName()) thousandNamespacesTest(ctx, c, invConfig, inventoryName, namespace.GetName())
}) })
})
}) })

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/klog/v2" "k8s.io/klog/v2"