mirror of https://github.com/kubevela/kubevela.git
Feat: upgrade ginkgo to v2 (#5940)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
parent
643429d474
commit
d59b116d06
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package e2e
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -19,7 +19,7 @@ package e2e
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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,163 +85,149 @@ 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() {
|
||||
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
|
||||
})
|
||||
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() {
|
||||
ginkgo.By("init new k8s client")
|
||||
k8sclient, err := common.NewK8sClient()
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
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())
|
||||
|
||||
ginkgo.By("check Application reconciled ready")
|
||||
app := &v1beta1.Application{}
|
||||
gomega.Eventually(func() bool {
|
||||
_ = k8sclient.Get(context2.Background(), client.ObjectKey{Name: applicationName, Namespace: "default"}, app)
|
||||
return app.Status.LatestRevision != nil
|
||||
}, 180*time.Second, 1*time.Second).Should(gomega.BeTrue())
|
||||
ginkgo.By("check Application reconciled ready")
|
||||
app := &v1beta1.Application{}
|
||||
gomega.Eventually(func() bool {
|
||||
_ = k8sclient.Get(context2.Background(), client.ObjectKey{Name: applicationName, Namespace: "default"}, app)
|
||||
return app.Status.LatestRevision != nil
|
||||
}, 180*time.Second, 1*time.Second).Should(gomega.BeTrue())
|
||||
|
||||
cli := fmt.Sprintf("vela status %s", applicationName)
|
||||
output, err := e2e.LongTimeExec(cli, 120*time.Second)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(strings.ToLower(output)).To(gomega.ContainSubstring("healthy"))
|
||||
// TODO(zzxwill) need to check workloadType after app status is refined
|
||||
})
|
||||
cli := fmt.Sprintf("vela status %s", applicationName)
|
||||
output, err := e2e.LongTimeExec(cli, 120*time.Second)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
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() {
|
||||
gomega.Eventually(func() string {
|
||||
cli := fmt.Sprintf("vela exec %s -- /bin/ls ", appName)
|
||||
output, err := e2e.Exec(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
return output
|
||||
}, 90*time.Second, 5*time.Second).Should(gomega.ContainSubstring("bin"))
|
||||
})
|
||||
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)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
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() {
|
||||
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"))
|
||||
})
|
||||
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() {
|
||||
cli := "vela init"
|
||||
output, err := e2e.InteractiveExec(cli, func(c *expect.Console) {
|
||||
data := []struct {
|
||||
q, a string
|
||||
}{
|
||||
{
|
||||
q: "What would you like to name your application (required): ",
|
||||
a: appName,
|
||||
},
|
||||
{
|
||||
q: "webservice",
|
||||
a: workloadType,
|
||||
},
|
||||
{
|
||||
q: "What would you like to name this webservice (required): ",
|
||||
a: "mysvc",
|
||||
},
|
||||
{
|
||||
q: "Which image would you like to use for your service ",
|
||||
a: "nginx:latest",
|
||||
},
|
||||
{
|
||||
q: "Specify image pull policy for your service ",
|
||||
a: "Always",
|
||||
},
|
||||
{
|
||||
q: "Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) (optional):",
|
||||
a: "0.5",
|
||||
},
|
||||
{
|
||||
q: "Specifies the attributes of the memory resource required for the container. (optional):",
|
||||
a: "200M",
|
||||
},
|
||||
}
|
||||
for _, qa := range data {
|
||||
_, err := c.ExpectString(qa.q)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
_, err = c.SendLine(qa.a)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
}
|
||||
c.ExpectEOF()
|
||||
})
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("Application Deployed"))
|
||||
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 {
|
||||
q, a string
|
||||
}{
|
||||
{
|
||||
q: "What would you like to name your application (required): ",
|
||||
a: appName,
|
||||
},
|
||||
{
|
||||
q: "webservice",
|
||||
a: workloadType,
|
||||
},
|
||||
{
|
||||
q: "What would you like to name this webservice (required): ",
|
||||
a: "mysvc",
|
||||
},
|
||||
{
|
||||
q: "Which image would you like to use for your service ",
|
||||
a: "nginx:latest",
|
||||
},
|
||||
{
|
||||
q: "Specify image pull policy for your service ",
|
||||
a: "Always",
|
||||
},
|
||||
{
|
||||
q: "Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) (optional):",
|
||||
a: "0.5",
|
||||
},
|
||||
{
|
||||
q: "Specifies the attributes of the memory resource required for the container. (optional):",
|
||||
a: "200M",
|
||||
},
|
||||
}
|
||||
for _, qa := range data {
|
||||
_, err := c.ExpectString(qa.q)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
_, err = c.SendLine(qa.a)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
}
|
||||
c.ExpectEOF()
|
||||
})
|
||||
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() {
|
||||
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"))
|
||||
})
|
||||
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() {
|
||||
args := common.Args{
|
||||
Schema: common.Scheme,
|
||||
return ginkgo.It(context+": should print successful deletion information", func() {
|
||||
args := common.Args{
|
||||
Schema: common.Scheme,
|
||||
}
|
||||
ctx := context2.Background()
|
||||
|
||||
k8sClient, err := args.GetClient()
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
|
||||
app := new(v1beta1.Application)
|
||||
gomega.Eventually(func() error {
|
||||
if err := k8sClient.Get(ctx, client.ObjectKey{Name: appName, Namespace: "default"}, app); err != nil {
|
||||
return err
|
||||
}
|
||||
ctx := context2.Background()
|
||||
meta.AddFinalizer(app, "test")
|
||||
return k8sClient.Update(ctx, app)
|
||||
}, time.Second*3, time.Millisecond*300).Should(gomega.BeNil())
|
||||
|
||||
k8sClient, err := args.GetClient()
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
cli := fmt.Sprintf("vela delete %s --force -y", appName)
|
||||
output, err := e2e.LongTimeExec(cli, 3*time.Minute)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("timed out"))
|
||||
|
||||
app := new(v1beta1.Application)
|
||||
gomega.Eventually(func() error {
|
||||
if err := k8sClient.Get(ctx, client.ObjectKey{Name: appName, Namespace: "default"}, app); err != nil {
|
||||
return err
|
||||
}
|
||||
meta.AddFinalizer(app, "test")
|
||||
return k8sClient.Update(ctx, app)
|
||||
}, time.Second*3, time.Millisecond*300).Should(gomega.BeNil())
|
||||
app = new(v1beta1.Application)
|
||||
gomega.Eventually(func(g gomega.Gomega) {
|
||||
g.Expect(k8sClient.Get(ctx, client.ObjectKey{Name: appName, Namespace: "default"}, app)).Should(gomega.Succeed())
|
||||
meta.RemoveFinalizer(app, "test")
|
||||
g.Expect(k8sClient.Update(ctx, app)).Should(gomega.Succeed())
|
||||
}, time.Second*5, time.Millisecond*300).Should(gomega.Succeed())
|
||||
|
||||
cli := fmt.Sprintf("vela delete %s --force -y", appName)
|
||||
output, err := e2e.LongTimeExec(cli, 3*time.Minute)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("timed out"))
|
||||
|
||||
app = new(v1beta1.Application)
|
||||
gomega.Eventually(func(g gomega.Gomega) {
|
||||
g.Expect(k8sClient.Get(ctx, client.ObjectKey{Name: appName, Namespace: "default"}, app)).Should(gomega.Succeed())
|
||||
meta.RemoveFinalizer(app, "test")
|
||||
g.Expect(k8sClient.Update(ctx, app)).Should(gomega.Succeed())
|
||||
}, time.Second*5, time.Millisecond*300).Should(gomega.Succeed())
|
||||
|
||||
cli = fmt.Sprintf("vela delete %s --force -y", appName)
|
||||
output, err = e2e.ExecAndTerminate(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("deleted"))
|
||||
})
|
||||
cli = fmt.Sprintf("vela delete %s --force -y", appName)
|
||||
output, err = e2e.ExecAndTerminate(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("deleted"))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -271,53 +257,51 @@ 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() {
|
||||
args := common.Args{
|
||||
Schema: common.Scheme,
|
||||
return ginkgo.It(context+": should get successful result for executing vela ql", func() {
|
||||
args := common.Args{
|
||||
Schema: common.Scheme,
|
||||
}
|
||||
ctx := context2.Background()
|
||||
|
||||
k8sClient, err := args.GetClient()
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
|
||||
componentView := new(corev1.ConfigMap)
|
||||
gomega.Eventually(func(g gomega.Gomega) {
|
||||
g.Expect(common.ReadYamlToObject("./component-pod-view.yaml", componentView)).Should(gomega.BeNil())
|
||||
g.Expect(k8sClient.Create(ctx, componentView)).Should(gomega.SatisfyAny(gomega.Succeed(), util.AlreadyExistMatcher{}))
|
||||
}, time.Second*3, time.Millisecond*300).Should(gomega.Succeed())
|
||||
|
||||
cli := fmt.Sprintf("vela ql %s", velaQL)
|
||||
output, err := e2e.Exec(cli)
|
||||
|
||||
// remove warning like: W0406 14:07:49.832144 2443978 tree.go:958] ignore list resources: EndpointSlice as no matches for kind "EndpointSlice" in version "discovery.k8s.io/v1beta1"
|
||||
re := regexp.MustCompile(`W\d{4}.*`)
|
||||
output = re.ReplaceAllString(output, "")
|
||||
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
var list PodList
|
||||
err = json.Unmarshal([]byte(output), &list)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
for _, v := range list.PodList {
|
||||
if v.Cluster != "" {
|
||||
gomega.Expect(v.Cluster).To(gomega.ContainSubstring("local"))
|
||||
}
|
||||
ctx := context2.Background()
|
||||
|
||||
k8sClient, err := args.GetClient()
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
|
||||
componentView := new(corev1.ConfigMap)
|
||||
gomega.Eventually(func(g gomega.Gomega) {
|
||||
g.Expect(common.ReadYamlToObject("./component-pod-view.yaml", componentView)).Should(gomega.BeNil())
|
||||
g.Expect(k8sClient.Create(ctx, componentView)).Should(gomega.SatisfyAny(gomega.Succeed(), util.AlreadyExistMatcher{}))
|
||||
}, time.Second*3, time.Millisecond*300).Should(gomega.Succeed())
|
||||
|
||||
cli := fmt.Sprintf("vela ql %s", velaQL)
|
||||
output, err := e2e.Exec(cli)
|
||||
|
||||
// remove warning like: W0406 14:07:49.832144 2443978 tree.go:958] ignore list resources: EndpointSlice as no matches for kind "EndpointSlice" in version "discovery.k8s.io/v1beta1"
|
||||
re := regexp.MustCompile(`W\d{4}.*`)
|
||||
output = re.ReplaceAllString(output, "")
|
||||
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
var list PodList
|
||||
err = json.Unmarshal([]byte(output), &list)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
for _, v := range list.PodList {
|
||||
if v.Cluster != "" {
|
||||
gomega.Expect(v.Cluster).To(gomega.ContainSubstring("local"))
|
||||
}
|
||||
if v.Status.Phase != "" {
|
||||
gomega.Expect(v.Status.Phase).To(gomega.ContainSubstring("Running"))
|
||||
}
|
||||
if v.Status.NodeName != "" {
|
||||
gomega.Expect(v.Status.NodeName).To(gomega.ContainSubstring("k3d-k3s-default-server-0"))
|
||||
}
|
||||
if v.Metadata.Namespace != "" {
|
||||
gomega.Expect(v.Metadata.Namespace).To(gomega.ContainSubstring("default"))
|
||||
}
|
||||
if v.Workload.ApiVersion != "" {
|
||||
gomega.Expect(v.Workload.ApiVersion).To(gomega.ContainSubstring("apps/v1"))
|
||||
}
|
||||
if v.Workload.Kind != "" {
|
||||
gomega.Expect(v.Workload.Kind).To(gomega.ContainSubstring("ReplicaSet"))
|
||||
}
|
||||
if v.Status.Phase != "" {
|
||||
gomega.Expect(v.Status.Phase).To(gomega.ContainSubstring("Running"))
|
||||
}
|
||||
})
|
||||
if v.Status.NodeName != "" {
|
||||
gomega.Expect(v.Status.NodeName).To(gomega.ContainSubstring("k3d-k3s-default-server-0"))
|
||||
}
|
||||
if v.Metadata.Namespace != "" {
|
||||
gomega.Expect(v.Metadata.Namespace).To(gomega.ContainSubstring("default"))
|
||||
}
|
||||
if v.Workload.ApiVersion != "" {
|
||||
gomega.Expect(v.Workload.ApiVersion).To(gomega.ContainSubstring("apps/v1"))
|
||||
}
|
||||
if v.Workload.Kind != "" {
|
||||
gomega.Expect(v.Workload.Kind).To(gomega.ContainSubstring("ReplicaSet"))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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,195 +29,165 @@ 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() {
|
||||
cli := fmt.Sprintf("vela env init %s", envName)
|
||||
var answer = "default"
|
||||
if envName != "env-application" {
|
||||
answer = "vela-system"
|
||||
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" {
|
||||
answer = "vela-system"
|
||||
}
|
||||
output, err := InteractiveExec(cli, func(c *expect.Console) {
|
||||
data := []struct {
|
||||
q, a string
|
||||
}{
|
||||
{
|
||||
q: "Would you like to choose an existing namespaces as your env?",
|
||||
a: answer,
|
||||
},
|
||||
}
|
||||
output, err := InteractiveExec(cli, func(c *expect.Console) {
|
||||
data := []struct {
|
||||
q, a string
|
||||
}{
|
||||
{
|
||||
q: "Would you like to choose an existing namespaces as your env?",
|
||||
a: answer,
|
||||
},
|
||||
}
|
||||
for _, qa := range data {
|
||||
_, err := c.ExpectString(qa.q)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
_, err = c.SendLine(qa.a)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
}
|
||||
c.ExpectEOF()
|
||||
})
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
expectedOutput := fmt.Sprintf("environment %s with namespace %s created", envName, answer)
|
||||
gomega.Expect(output).To(gomega.ContainSubstring(expectedOutput))
|
||||
for _, qa := range data {
|
||||
_, err := c.ExpectString(qa.q)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
_, err = c.SendLine(qa.a)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
}
|
||||
c.ExpectEOF()
|
||||
})
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
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() {
|
||||
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))
|
||||
})
|
||||
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() {
|
||||
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:"))
|
||||
})
|
||||
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() {
|
||||
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!"))
|
||||
})
|
||||
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() {
|
||||
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!"))
|
||||
})
|
||||
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() {
|
||||
cli := fmt.Sprintf("vela env delete %s", envName)
|
||||
_, err := Exec(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
})
|
||||
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() {
|
||||
cli := fmt.Sprintf("vela env ls %s", envName)
|
||||
output, err := Exec(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("NAME"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("NAMESPACE"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring(envName))
|
||||
})
|
||||
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())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("NAME"))
|
||||
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() {
|
||||
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))
|
||||
})
|
||||
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() {
|
||||
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))
|
||||
})
|
||||
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() {
|
||||
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"))
|
||||
})
|
||||
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() {
|
||||
output, err := Exec("vela components")
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("webservice"))
|
||||
})
|
||||
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() {
|
||||
output, err := Exec("vela traits")
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("scaler"))
|
||||
})
|
||||
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() {
|
||||
output, err := Exec("vela ls")
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("COMPONENT"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring(applicationName))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring(workloadType))
|
||||
if traitAlias != "" {
|
||||
gomega.Expect(output).To(gomega.ContainSubstring(traitAlias))
|
||||
}
|
||||
})
|
||||
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"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring(applicationName))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring(workloadType))
|
||||
if traitAlias != "" {
|
||||
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() {
|
||||
cli := fmt.Sprintf("vela show %s", capabilityName)
|
||||
_, err := Exec(cli)
|
||||
gomega.Expect(err).Should(gomega.BeNil())
|
||||
})
|
||||
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() {
|
||||
cli := fmt.Sprintf("vela show %s --format=markdown", capabilityName)
|
||||
_, err := Exec(cli)
|
||||
gomega.Expect(err).Should(gomega.BeNil())
|
||||
})
|
||||
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())
|
||||
})
|
||||
}
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ package e2e
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package e2e
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package e2e
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ package e2e
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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
3
go.mod
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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() {
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -19,7 +19,7 @@ package gen_sdk_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
Loading…
Reference in New Issue