Feat: upgrade ginkgo to v2 (#5940)

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
Somefive 2023-05-15 16:07:51 +08:00 committed by GitHub
parent 643429d474
commit d59b116d06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
173 changed files with 559 additions and 677 deletions

View File

@ -65,7 +65,7 @@ jobs:
- name: Get Ginkgo
run: |
go install github.com/onsi/ginkgo/ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/gomega/...
- name: Tear down K3d if exist

View File

@ -72,7 +72,7 @@ jobs:
- name: Get Ginkgo
run: |
go install github.com/onsi/ginkgo/ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/gomega/...
- name: Tear down K3d if exist

View File

@ -21,7 +21,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

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

View File

@ -24,7 +24,7 @@ import (
"time"
"github.com/Netflix/go-expect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"

View File

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

View File

@ -28,7 +28,7 @@ import (
"github.com/Netflix/go-expect"
"github.com/crossplane/crossplane-runtime/pkg/meta"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/client"
@ -54,7 +54,7 @@ var (
waitAppfileToFail = `{"name":"app-wait-fail","services":{"app-basic2":{"type":"webservice","image":"nginx:fail","ports":[{port: 80, expose: true}]}}}`
)
var _ = ginkgo.Describe("Test Vela Application", func() {
var _ = ginkgo.Describe("Test Vela Application", ginkgo.Ordered, func() {
e2e.JsonAppFileContext("json appfile apply", jsonAppFile)
e2e.EnvSetContext("env set default", "default")
e2e.DeleteEnvFunc("env delete", envName)
@ -85,20 +85,17 @@ var _ = ginkgo.Describe("Test Vela Application", func() {
})
var ApplicationStatusContext = func(context string, applicationName string, workloadType string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should get status for the application", func() {
return ginkgo.It(context+": should get status for the application", func() {
cli := fmt.Sprintf("vela status %s", applicationName)
output, err := e2e.Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring(applicationName))
// TODO(roywang) add more assertion to check health status
})
})
}
var ApplicationStatusDeeplyContext = func(context string, applicationName, workloadType, envName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should get status of the service", func() {
return ginkgo.It(context+": should get status of the service", func() {
ginkgo.By("init new k8s client")
k8sclient, err := common.NewK8sClient()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
@ -116,12 +113,10 @@ var ApplicationStatusDeeplyContext = func(context string, applicationName, workl
gomega.Expect(strings.ToLower(output)).To(gomega.ContainSubstring("healthy"))
// TODO(zzxwill) need to check workloadType after app status is refined
})
})
}
var ApplicationExecContext = func(context string, appName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should get output of exec /bin/ls", func() {
return ginkgo.It(context+": should get output of exec /bin/ls", func() {
gomega.Eventually(func() string {
cli := fmt.Sprintf("vela exec %s -- /bin/ls ", appName)
output, err := e2e.Exec(cli)
@ -129,23 +124,19 @@ var ApplicationExecContext = func(context string, appName string) bool {
return output
}, 90*time.Second, 5*time.Second).Should(gomega.ContainSubstring("bin"))
})
})
}
var ApplicationPortForwardContext = func(context string, appName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should get output of port-forward successfully", func() {
return ginkgo.It(context+": should get output of port-forward successfully", func() {
cli := fmt.Sprintf("vela port-forward %s 8080:80 ", appName)
output, err := e2e.ExecAndTerminate(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("Forward successfully"))
})
})
}
var ApplicationInitIntercativeCliContext = func(context string, appName string, workloadType string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should init app through interactive questions", func() {
return ginkgo.It(context+": should init app through interactive questions", func() {
cli := "vela init"
output, err := e2e.InteractiveExec(cli, func(c *expect.Console) {
data := []struct {
@ -191,23 +182,19 @@ var ApplicationInitIntercativeCliContext = func(context string, appName string,
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("Application Deployed"))
})
})
}
var ApplicationDeleteWithWaitOptions = func(context string, appName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should print successful deletion information", func() {
return ginkgo.It(context+": should print successful deletion information", func() {
cli := fmt.Sprintf("vela delete %s --wait -y", appName)
output, err := e2e.ExecAndTerminate(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("succeeded"))
})
})
}
var ApplicationDeleteWithForceOptions = func(context string, appName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should print successful deletion information", func() {
return ginkgo.It(context+": should print successful deletion information", func() {
args := common.Args{
Schema: common.Scheme,
}
@ -242,7 +229,6 @@ var ApplicationDeleteWithForceOptions = func(context string, appName string) boo
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("deleted"))
})
})
}
type PodList struct {
@ -271,8 +257,7 @@ type Workload struct {
}
var VelaQLPodListContext = func(context string, velaQL string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should get successful result for executing vela ql", func() {
return ginkgo.It(context+": should get successful result for executing vela ql", func() {
args := common.Args{
Schema: common.Scheme,
}
@ -319,5 +304,4 @@ var VelaQLPodListContext = func(context string, velaQL string) bool {
}
}
})
})
}

View File

@ -25,7 +25,7 @@ import (
"github.com/Netflix/go-expect"
"github.com/hinshun/vt10x"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)

View File

@ -21,7 +21,7 @@ import (
"os"
"github.com/Netflix/go-expect"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
@ -29,8 +29,7 @@ var (
// EnvInitContext used for test Env
EnvInitContext = func(context string, envName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should print environment initiation successful message", func() {
return ginkgo.It(context+": should print environment initiation successful message", func() {
cli := fmt.Sprintf("vela env init %s", envName)
var answer = "default"
if envName != "env-application" {
@ -57,70 +56,58 @@ var (
expectedOutput := fmt.Sprintf("environment %s with namespace %s created", envName, answer)
gomega.Expect(output).To(gomega.ContainSubstring(expectedOutput))
})
})
}
EnvInitWithNamespaceOptionContext = func(context string, envName string, namespace string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should print environment initiation successful message", func() {
return ginkgo.It(context+": should print environment initiation successful message", func() {
cli := fmt.Sprintf("vela env init %s --namespace %s", envName, namespace)
output, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
expectedOutput := fmt.Sprintf("environment %s with namespace %s created", envName, namespace)
gomega.Expect(output).To(gomega.ContainSubstring(expectedOutput))
})
})
}
JsonAppFileContext = func(context, jsonAppFile string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("Start the application through the app file in JSON format.", func() {
return ginkgo.It(context+": Start the application through the app file in JSON format.", func() {
writeStatus := os.WriteFile("vela.json", []byte(jsonAppFile), 0644)
gomega.Expect(writeStatus).NotTo(gomega.HaveOccurred())
output, err := Exec("vela up -f vela.json")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).NotTo(gomega.ContainSubstring("Error:"))
})
})
}
JsonAppFileContextWithWait = func(context, jsonAppFile string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("Start the application through the app file in JSON format.", func() {
return ginkgo.It(context+": Start the application through the app file in JSON format.", func() {
writeStatus := os.WriteFile("vela.json", []byte(jsonAppFile), 0644)
gomega.Expect(writeStatus).NotTo(gomega.HaveOccurred())
output, err := Exec("vela up -f vela.json --wait")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("Application Deployed Successfully!"))
})
})
}
JsonAppFileContextWithTimeout = func(context, jsonAppFile, duration string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("Start the application through the app file in JSON format.", func() {
return ginkgo.It(context+": Start the application through the app file in JSON format.", func() {
writeStatus := os.WriteFile("vela.json", []byte(jsonAppFile), 0644)
gomega.Expect(writeStatus).NotTo(gomega.HaveOccurred())
output, err := Exec("vela up -f vela.json --wait --timeout=" + duration)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("Timeout waiting Application to be healthy!"))
})
})
}
DeleteEnvFunc = func(context string, envName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should print env does not exist message", func() {
return ginkgo.It(context+": should print env does not exist message", func() {
cli := fmt.Sprintf("vela env delete %s", envName)
_, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
})
})
}
EnvShowContext = func(context string, envName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should show detailed environment message", func() {
return ginkgo.It(context+": should show detailed environment message", func() {
cli := fmt.Sprintf("vela env ls %s", envName)
output, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
@ -128,67 +115,55 @@ var (
gomega.Expect(output).To(gomega.ContainSubstring("NAMESPACE"))
gomega.Expect(output).To(gomega.ContainSubstring(envName))
})
})
}
EnvSetContext = func(context string, envName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should show environment set message", func() {
return ginkgo.It(context+": should show environment set message", func() {
cli := fmt.Sprintf("vela env sw %s", envName)
output, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring(envName))
})
})
}
EnvDeleteContext = func(context string, envName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should delete an environment", func() {
return ginkgo.It(context+": should delete an environment", func() {
cli := fmt.Sprintf("vela env delete %s", envName)
output, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
expectedOutput := fmt.Sprintf("%s deleted", envName)
gomega.Expect(output).To(gomega.ContainSubstring(expectedOutput))
})
})
}
WorkloadDeleteContext = func(context string, applicationName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should print successful deletion information", func() {
return ginkgo.It(context+": should print successful deletion information", func() {
cli := fmt.Sprintf("vela delete %s -y", applicationName)
output, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("succeeded"))
})
})
}
WorkloadCapabilityListContext = func() bool {
return ginkgo.Context("list workload capabilities", func() {
ginkgo.It("should sync capabilities from cluster before listing workload capabilities", func() {
return ginkgo.It("list workload capabilities: should sync capabilities from cluster before listing workload capabilities", func() {
output, err := Exec("vela components")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("webservice"))
})
})
}
TraitCapabilityListContext = func() bool {
return ginkgo.Context("list traits capabilities", func() {
ginkgo.It("should sync capabilities from cluster before listing trait capabilities", func() {
return ginkgo.It("list traits capabilities: should sync capabilities from cluster before listing trait capabilities", func() {
output, err := Exec("vela traits")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("scaler"))
})
})
}
// ComponentListContext used for test vela svc ls
ComponentListContext = func(context string, applicationName string, workloadType string, traitAlias string) bool {
return ginkgo.Context("ls", func() {
ginkgo.It("should list all applications", func() {
return ginkgo.It(context+": should list all applications", func() {
output, err := Exec("vela ls")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("COMPONENT"))
@ -198,26 +173,21 @@ var (
gomega.Expect(output).To(gomega.ContainSubstring(traitAlias))
}
})
})
}
ShowCapabilityReference = func(context string, capabilityName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should show capability reference", func() {
return ginkgo.It(context+": should show capability reference", func() {
cli := fmt.Sprintf("vela show %s", capabilityName)
_, err := Exec(cli)
gomega.Expect(err).Should(gomega.BeNil())
})
})
}
ShowCapabilityReferenceMarkdown = func(context string, capabilityName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should show capability reference in markdown", func() {
return ginkgo.It(context+": should show capability reference in markdown", func() {
cli := fmt.Sprintf("vela show %s --format=markdown", capabilityName)
_, err := Exec(cli)
gomega.Expect(err).Should(gomega.BeNil())
})
})
}
)

View File

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

4
e2e/env/env_test.go vendored
View File

@ -19,7 +19,7 @@ package e2e
import (
"github.com/oam-dev/kubevela/e2e"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
@ -28,7 +28,7 @@ var (
envName2 = "env-world"
)
var _ = ginkgo.Describe("Env", func() {
var _ = ginkgo.Describe("Env", ginkgo.Ordered, func() {
e2e.EnvInitWithNamespaceOptionContext("env init env-hello --namespace heelo", envName, "heelo")
e2e.EnvInitWithNamespaceOptionContext("env init another one --namespace heelo2", envName2, "heelo2")
e2e.EnvShowContext("env show", envName)

View File

@ -22,7 +22,7 @@ import (
"path/filepath"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@ -55,7 +55,7 @@ func TestKubectlPlugin(t *testing.T) {
}
var testRegistryPath string
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
err := clientgoscheme.AddToScheme(scheme)
Expect(err).Should(BeNil())
err = core.AddToScheme(scheme)
@ -117,8 +117,7 @@ var _ = BeforeSuite(func(done Done) {
testRegistryPath, err = filepath.Abs("testdata")
testRegistryPath = "file://" + testRegistryPath
Expect(err).Should(BeNil())
close(done)
}, 300)
})
var _ = AfterSuite(func() {
By("delete application and definitions")

View File

@ -21,7 +21,7 @@ import (
"os"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/client"

View File

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

View File

@ -22,7 +22,7 @@ import (
"github.com/oam-dev/kubevela/e2e"
"github.com/oam-dev/kubevela/references/apis"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

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

View File

@ -17,7 +17,7 @@ limitations under the License.
package e2e
import (
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/oam-dev/kubevela/e2e"
)

View File

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

View File

@ -17,7 +17,7 @@ limitations under the License.
package e2e
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/e2e"

3
go.mod
View File

@ -65,7 +65,6 @@ require (
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28
github.com/oam-dev/terraform-controller v0.7.10
github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.9.4
github.com/onsi/gomega v1.27.6
github.com/openkruise/kruise-api v1.4.0
@ -245,7 +244,6 @@ require (
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
github.com/openshift/library-go v0.0.0-20230327085348-8477ec72b725 // indirect
@ -302,7 +300,6 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
istio.io/api v0.0.0-20220512212136-561ffec82582 // indirect
istio.io/gogo-genproto v0.0.0-20211208193508-5ab4acc9eb1e // indirect

View File

@ -22,7 +22,7 @@ import (
"io"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
yaml3 "gopkg.in/yaml.v3"

View File

@ -19,7 +19,7 @@ package addon
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
)

View File

@ -28,7 +28,7 @@ import (
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -24,7 +24,7 @@ import (
"net/http/httptest"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/helm/pkg/tlsutil"
)

View File

@ -21,7 +21,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v12 "k8s.io/api/core/v1"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@ -60,7 +60,7 @@ func TestAddon(t *testing.T) {
RunSpecs(t, "Addon Suite test")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
By("bootstrapping test environment")
useExistCluster := false
@ -104,9 +104,7 @@ var _ = BeforeSuite(func(done Done) {
err = stepHelmHttpServer()
Expect(err).Should(Succeed())
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -25,7 +25,7 @@ import (
"strings"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
"helm.sh/helm/v3/pkg/chartutil"

View File

@ -22,7 +22,7 @@ import (
"github.com/pkg/errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/pkg/utils/common"

View File

@ -27,7 +27,7 @@ import (
"github.com/google/go-cmp/cmp"
terraformtypes "github.com/oam-dev/terraform-controller/api/types/crossplane-runtime"
terraformapi "github.com/oam-dev/terraform-controller/api/v1beta2"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
"gotest.tools/assert"

View File

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

View File

@ -26,7 +26,7 @@ import (
"github.com/oam-dev/kubevela/apis/types"
"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/yaml"

View File

@ -30,7 +30,7 @@ import (
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/apis/types"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@ -65,7 +65,7 @@ func TestDryRun(t *testing.T) {
RunSpecs(t, "Cli Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
By("bootstrapping test environment")
useExistCluster := false
@ -120,9 +120,7 @@ var _ = BeforeSuite(func(done Done) {
dryrunOpt = NewDryRunOption(k8sClient, cfg, dm, pd, []oam.Object{cdMyWorker, tdMyIngress}, false)
diffOpt = &LiveDiffOption{DryRun: dryrunOpt, Parser: appfile.NewApplicationParser(k8sClient, dm, pd)}
close(done)
}, 60)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -23,7 +23,7 @@ import (
"strings"
"github.com/crossplane/crossplane-runtime/pkg/test"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
errors2 "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -21,7 +21,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/runtime"
@ -51,7 +51,7 @@ func TestAppFile(t *testing.T) {
RunSpecs(t, "Cli Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
By("bootstrapping test environment")
useExistCluster := false
@ -79,9 +79,7 @@ var _ = BeforeSuite(func(done Done) {
pd, err = packages.NewPackageDiscover(cfg)
Expect(err).ToNot(HaveOccurred())
Expect(pd).ToNot(BeNil())
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -17,8 +17,7 @@ limitations under the License.
package appfile
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/apis/types"

View File

@ -22,7 +22,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
@ -49,7 +49,7 @@ func TestUtils(t *testing.T) {
RunSpecs(t, "Utils Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
rand.Seed(time.Now().UnixNano())
By("bootstrapping test environment for utils test")
@ -70,8 +70,7 @@ var _ = BeforeSuite(func(done Done) {
cfg.Timeout = time.Minute * 2
k8sClient, err = client.New(cfg, client.Options{Scheme: pkgcommon.Scheme})
Expect(err).Should(Succeed())
close(done)
}, 240)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -21,7 +21,7 @@ import (
"time"
gomock "github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/rest"
"k8s.io/utils/pointer"
@ -36,7 +36,7 @@ var k8sClient client.Client
var testEnv *envtest.Environment
var ctl *gomock.Controller
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: pointer.Bool(false),
@ -54,9 +54,7 @@ var _ = BeforeSuite(func(done Done) {
k8sClient, err = client.New(cfg, client.Options{Scheme: common.Scheme})
Expect(err).ToNot(HaveOccurred())
Expect(k8sClient).ToNot(BeNil())
close(done)
}, 60)
})
var _ = AfterSuite(func() {
By("Tearing down the test environment")

View File

@ -22,7 +22,7 @@ import (
"testing"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/require"

View File

@ -23,7 +23,7 @@ import (
"time"
monitorContext "github.com/kubevela/pkg/monitor/context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@ -50,7 +50,7 @@ func TestProvider(t *testing.T) {
RunSpecs(t, "Test Config Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
testEnv = &envtest.Environment{
ControlPlaneStartTimeout: time.Minute,
@ -71,8 +71,7 @@ var _ = BeforeSuite(func(done Done) {
p = &provider{
factory: config.NewConfigFactory(k8sClient),
}
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("Tearing down the test environment")

View File

@ -21,7 +21,7 @@ package workloads
import (
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/crossplane/crossplane-runtime/pkg/event"

View File

@ -19,7 +19,7 @@
package workloads
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/crossplane/crossplane-runtime/pkg/event"

View File

@ -19,7 +19,7 @@
package workloads
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/crossplane/crossplane-runtime/pkg/event"

View File

@ -19,7 +19,7 @@
package workloads
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/crossplane/crossplane-runtime/pkg/event"

View File

@ -21,7 +21,7 @@ package workloads
import (
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/crossplane/crossplane-runtime/pkg/event"

View File

@ -18,7 +18,7 @@ package workloads
import (
"github.com/crossplane/crossplane-runtime/pkg/event"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"

View File

@ -23,7 +23,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/utils/pointer"
@ -49,7 +49,7 @@ func TestRollout(t *testing.T) {
RunSpecs(t, "Rollout Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{
@ -87,9 +87,7 @@ var _ = BeforeSuite(func(done Done) {
go func() {
defer GinkgoRecover()
}()
close(done)
}, 60)
})
var _ = AfterSuite(func() {
By("Tearing down the test environment")

View File

@ -31,7 +31,7 @@ import (
"github.com/google/go-cmp/cmp"
testdef "github.com/kubevela/pkg/util/test/definition"
wffeatures "github.com/kubevela/workflow/pkg/features"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/apps/v1"
autoscalingv1 "k8s.io/api/autoscaling/v1"

View File

@ -24,7 +24,7 @@ import (
"github.com/oam-dev/kubevela/pkg/oam"
"github.com/oam-dev/kubevela/pkg/oam/testutil"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/yaml"

View File

@ -22,7 +22,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
v1 "k8s.io/api/apps/v1"

View File

@ -27,7 +27,7 @@ import (
terraformtypes "github.com/oam-dev/terraform-controller/api/types"
terraformapi "github.com/oam-dev/terraform-controller/api/v1beta2"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"

View File

@ -19,7 +19,7 @@ package assemble
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

View File

@ -23,8 +23,7 @@ import (
"reflect"
"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
"sigs.k8s.io/yaml"

View File

@ -23,7 +23,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@ -59,7 +59,7 @@ func TestAssemble(t *testing.T) {
RunSpecs(t, "Assemble Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
rand.Seed(time.Now().UnixNano())
By("bootstrapping test environment")
@ -102,9 +102,7 @@ var _ = BeforeSuite(func(done Done) {
Expect(err).To(BeNil())
appParser = appfile.NewApplicationParser(k8sClient, dm, pd)
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -19,7 +19,7 @@ package application
import (
"context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -27,7 +27,7 @@ import (
v1 "k8s.io/api/apps/v1"
networkingv1 "k8s.io/api/networking/v1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"

View File

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

View File

@ -24,7 +24,7 @@ import (
"github.com/oam-dev/kubevela/pkg/oam/testutil"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
apierrors "k8s.io/apimachinery/pkg/api/errors"

View File

@ -26,7 +26,7 @@ import (
"time"
workflowv1alpha1 "github.com/kubevela/workflow/api/v1alpha1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/require"

View File

@ -29,7 +29,7 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/event"
"github.com/go-logr/logr"
terraformv1beta2 "github.com/oam-dev/terraform-controller/api/v1beta2"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
@ -87,7 +87,7 @@ func (r *NoOpReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
return ctrl.Result{}, nil
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
rand.Seed(time.Now().UnixNano())
By("bootstrapping test environment")
@ -165,10 +165,9 @@ var _ = BeforeSuite(func(done Done) {
err = mgr.Start(ctx)
Expect(err).NotTo(HaveOccurred())
}()
close(done)
Expect(utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=true", features.LegacyComponentRevision))).Should(Succeed())
multicluster.InitClusterInfo(cfg)
}, 120)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -22,7 +22,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"

View File

@ -20,7 +20,7 @@ import (
"context"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

View File

@ -22,7 +22,7 @@ import (
"k8s.io/apimachinery/pkg/types"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"

View File

@ -21,7 +21,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/yaml"

View File

@ -21,7 +21,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

View File

@ -23,7 +23,7 @@ import (
"strconv"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/apps/v1"

View File

@ -23,7 +23,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
@ -69,7 +69,7 @@ func TestReconcilerSuit(t *testing.T) {
RunSpecs(t, "OAM Core Resource Controller Unit test Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
var yamlPath string
if _, set := os.LookupEnv("COMPATIBILITY_TEST"); set {
@ -228,9 +228,7 @@ var _ = BeforeSuite(func(done Done) {
Expect(k8sClient.Create(ctx, &td)).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
// rollout trait is used for revisionEnable case test
Expect(k8sClient.Create(ctx, &rollout)).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
close(done)
}, 300)
})
var _ = AfterSuite(func() {

View File

@ -24,7 +24,7 @@ import (
"github.com/oam-dev/kubevela/pkg/oam/testutil"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

View File

@ -24,7 +24,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/client-go/kubernetes/scheme"
@ -49,7 +49,7 @@ func TestComponentDefinition(t *testing.T) {
RunSpecs(t, "ComponentDefinition Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
useExistCluster := false
testEnv = &envtest.Environment{
@ -101,9 +101,7 @@ var _ = BeforeSuite(func(done Done) {
defer GinkgoRecover()
Expect(mgr.Start(ctx)).ToNot(HaveOccurred())
}()
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("Stop the controller")

View File

@ -24,7 +24,7 @@ import (
"time"
"github.com/getkin/kin-openapi/openapi3"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"

View File

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

View File

@ -23,7 +23,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

View File

@ -23,7 +23,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@ -50,7 +50,7 @@ func TestPolicyDefinition(t *testing.T) {
RunSpecs(t, "PolicyDefinition Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
useExistCluster := false
testEnv = &envtest.Environment{
@ -100,9 +100,7 @@ var _ = BeforeSuite(func(done Done) {
defer GinkgoRecover()
Expect(mgr.Start(ctx)).ToNot(HaveOccurred())
}()
close(done)
}, 60)
})
var _ = AfterSuite(func() {
By("Stop the controller")

View File

@ -20,7 +20,7 @@ import (
"context"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"

View File

@ -23,7 +23,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

View File

@ -23,7 +23,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@ -49,7 +49,7 @@ func TestTraitDefinition(t *testing.T) {
RunSpecs(t, "TraitDefinition Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
useExistCluster := false
testEnv = &envtest.Environment{
@ -101,9 +101,7 @@ var _ = BeforeSuite(func(done Done) {
defer GinkgoRecover()
Expect(mgr.Start(ctx)).ToNot(HaveOccurred())
}()
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("Stop the controller")

View File

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

View File

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

View File

@ -23,7 +23,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@ -49,7 +49,7 @@ func TestWorkflowStepDefinition(t *testing.T) {
RunSpecs(t, "WorkflowStepDefinition Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
useExistCluster := false
testEnv = &envtest.Environment{
@ -101,9 +101,7 @@ var _ = BeforeSuite(func(done Done) {
defer GinkgoRecover()
Expect(mgr.Start(ctx)).ToNot(HaveOccurred())
}()
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("Stop the controller")

View File

@ -23,7 +23,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

View File

@ -22,7 +22,7 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/crossplane/crossplane-runtime/pkg/event"

View File

@ -22,7 +22,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/kubernetes/scheme"
@ -50,7 +50,7 @@ func TestAPIs(t *testing.T) {
RunSpecs(t, "Controller Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
By("bootstrapping test environment")
@ -85,9 +85,7 @@ var _ = BeforeSuite(func(done Done) {
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
Expect(err).ToNot(HaveOccurred())
Expect(k8sClient).ToNot(BeNil())
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -20,7 +20,7 @@ package utils
import (
"context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -22,7 +22,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
@ -44,7 +44,7 @@ func TestCapability(t *testing.T) {
RunSpecs(t, "Capability Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
useExistCluster := false
testEnv = &envtest.Environment{
@ -70,9 +70,7 @@ var _ = BeforeSuite(func(done Done) {
pd, err = packages.NewPackageDiscover(cfg)
Expect(err).ToNot(HaveOccurred())
close(done)
}, 60)
})
var _ = AfterSuite(func() {
By("Tearing down the test environment")

View File

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

View File

@ -21,15 +21,18 @@ import (
"path/filepath"
"github.com/getkin/kin-openapi/openapi3"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/pkg/utils/common"
)
var _outputDir string
var _ = Describe("Test Generating SDK", func() {
var err error
outputDir := filepath.Join("testdata", "output")
_outputDir = outputDir
lang := "go"
meta := GenMeta{
Output: outputDir,
@ -126,11 +129,11 @@ var _ = Describe("Test Generating SDK", func() {
checkDirNotEmpty(filepath.Join(outputDir, "pkg", "apis", "addons", "test_addon", "component", "cron-task"))
})
AfterSuite(func() {
By("Cleaning up generated files")
_ = os.RemoveAll(outputDir)
})
})
var _ = AfterSuite(func() {
By("Cleaning up generated files")
_ = os.RemoveAll(_outputDir)
})
var _ = Describe("FixSchemaWithOneAnyAllOf", func() {

View File

@ -21,7 +21,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/rest"
"k8s.io/utils/pointer"
@ -42,7 +42,7 @@ func TestUtils(t *testing.T) {
RunSpecs(t, "Utils Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
rand.Seed(time.Now().UnixNano())
By("bootstrapping test environment for utils test")
@ -65,8 +65,7 @@ var _ = BeforeSuite(func(done Done) {
k8sClient, err = client.New(cfg, client.Options{Scheme: common.Scheme})
Expect(err).Should(BeNil())
Expect(k8sClient).ToNot(BeNil())
close(done)
}, 240)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

@ -19,7 +19,7 @@ package multicluster
import (
"context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"

View File

@ -21,7 +21,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@ -50,7 +50,7 @@ func TestMapper(t *testing.T) {
RunSpecs(t, "Test Mapper Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: pointer.Bool(false),
@ -68,9 +68,7 @@ var _ = BeforeSuite(func(done Done) {
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme})
Expect(err).ToNot(HaveOccurred())
Expect(k8sClient).ToNot(BeNil())
close(done)
}, 60)
})
var _ = AfterSuite(func() {
By("Tearing down the test environment")

View File

@ -20,7 +20,7 @@ import (
"strings"
"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -24,7 +24,7 @@ import (
"time"
"github.com/crossplane/crossplane-runtime/pkg/meta"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"

View File

@ -22,7 +22,7 @@ import (
"reflect"
"github.com/crossplane/crossplane-runtime/pkg/fieldpath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -21,7 +21,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
@ -43,7 +43,7 @@ func TestResourceKeeper(t *testing.T) {
RunSpecs(t, "ResourceKeeper Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
testEnv = &envtest.Environment{
ControlPlaneStartTimeout: time.Minute,
@ -80,9 +80,7 @@ var _ = BeforeSuite(func(done Done) {
workerClient, err = client.New(cfg, client.Options{Scheme: common.Scheme})
Expect(err).ShouldNot(HaveOccurred())
Expect(workerClient).ShouldNot(BeNil())
close(done)
}, 300)
})
var _ = AfterSuite(func() {
Expect(testEnv.Stop()).Should(Succeed())

View File

@ -17,7 +17,7 @@ limitations under the License.
package resourcekeeper
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -19,7 +19,7 @@ package rollout
import (
"context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
kruisev1alpha1 "github.com/openkruise/rollouts/api/v1alpha1"
v1 "k8s.io/api/core/v1"

View File

@ -31,7 +31,7 @@ import (
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@ -64,7 +64,7 @@ func TestAddon(t *testing.T) {
RunSpecs(t, "Kruise rollout Suite test")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
By("bootstrapping test environment")
useExistCluster := false
@ -106,9 +106,7 @@ var _ = BeforeSuite(func(done Done) {
&v12.Namespace{TypeMeta: metav1.TypeMeta{APIVersion: "v1", Kind: "Namespace"}, ObjectMeta: metav1.ObjectMeta{
Name: testns,
}}))
close(done)
}, 120)
})
var _ = AfterSuite(func() {
By("tearing down the test environment")

View File

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

View File

@ -22,7 +22,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
oamcore "github.com/oam-dev/kubevela/apis/core.oam.dev"
@ -52,7 +52,7 @@ func TestApplicator(t *testing.T) {
RunSpecs(t, "Applicator Suite")
}
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
By("Bootstrapping test environment")
testEnv = &envtest.Environment{
ControlPlaneStartTimeout: time.Minute,
@ -84,9 +84,7 @@ var _ = BeforeSuite(func(done Done) {
},
}
Expect(rawClient.Create(context.Background(), &applyNS)).Should(Succeed())
close(done)
}, 300)
})
var _ = AfterSuite(func() {
Expect(testEnv.Stop()).Should(Succeed())

View File

@ -22,7 +22,7 @@ import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

View File

@ -23,7 +23,7 @@ import (
"net/http/httptest"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/google/go-cmp/cmp"

View File

@ -23,7 +23,7 @@ import (
"github.com/oam-dev/kubevela/pkg/utils/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/rest"
"k8s.io/utils/pointer"
@ -35,7 +35,7 @@ var cfg *rest.Config
var k8sClient client.Client
var testEnv *envtest.Environment
var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
rand.Seed(time.Now().UnixNano())
By("bootstrapping test environment")
@ -54,8 +54,7 @@ var _ = BeforeSuite(func(done Done) {
k8sClient, err = client.New(cfg, client.Options{Scheme: common.Scheme})
Expect(err).Should(BeNil())
Expect(k8sClient).ToNot(BeNil())
close(done)
}, 240)
})
var _ = AfterSuite(func() {
if testEnv != nil {

View File

@ -26,7 +26,7 @@ import (
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"

Some files were not shown because too many files have changed in this diff Show More