mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
Chore: upgrade kind in tests, fix flaky test (#4105)
* Chore: upgrade kind in tests, fix some hacky test. Signed-off-by: qiaozp <chivalry.pp@gmail.com> * longer wait Signed-off-by: qiaozp <chivalry.pp@gmail.com> * make e2e-multicluster test timeout 20m Signed-off-by: qiaozp <chivalry.pp@gmail.com> * switch to kind v0.14.0 Signed-off-by: 伊灵 <qiaozhongpei.qzp@alibaba-inc.com>
This commit is contained in:
@@ -19,9 +19,9 @@ env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.7\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.7\",\"v1.22.7\"]'
|
||||
KIND_VERSION: 'v0.14.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.15\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.15\",\"v1.22.9\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.7\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.7\",\"v1.22.7\"]'
|
||||
KIND_VERSION: 'v0.14.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.15\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.15\",\"v1.22.9\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.7\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.7\",\"v1.22.7\"]'
|
||||
KIND_VERSION: 'v0.14.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.15\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.15\",\"v1.22.9\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.7\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.7\",\"v1.22.7\"]'
|
||||
KIND_VERSION: 'v0.14.0'
|
||||
KIND_IMAGE_VERSION: '[\"v1.20.15\"]'
|
||||
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.15\",\"v1.22.9\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
KIND_VERSION: 'v0.14.0'
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
KIND_VERSION: 'v0.14.0'
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
@@ -13,12 +13,6 @@ spec:
|
||||
properties:
|
||||
image: {{ .Values.imageRegistry }}{{ .Values.test.app.repository }}:{{ .Values.test.app.tag }}
|
||||
port: 8000
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: testsvc.example.com
|
||||
http:
|
||||
"/": 8000
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
@@ -52,12 +46,6 @@ spec:
|
||||
kubectl -n {{ include "systemDefinitionNamespace" . }} wait --for=condition=available deployments helm-test-express-server --timeout 3m
|
||||
echo "deployment being available"
|
||||
|
||||
# wait for ingress being created
|
||||
while ! [ `kubectl -n {{ include "systemDefinitionNamespace" . }} get ing helm-test-express-server | grep -v NAME | wc -l` = 1 ]; do
|
||||
echo "waiting for ingress being created"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
||||
|
||||
echo "Application and its components are created"
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ e2e-rollout-test:
|
||||
|
||||
.PHONY: e2e-multicluster-test
|
||||
e2e-multicluster-test:
|
||||
go test -v -coverpkg=./... -coverprofile=/tmp/e2e_multicluster_test.out ./test/e2e-multicluster-test
|
||||
go test -v -coverpkg=./... -timeout=20m -coverprofile=/tmp/e2e_multicluster_test.out ./test/e2e-multicluster-test
|
||||
@$(OK) tests pass
|
||||
|
||||
.PHONY: e2e-cleanup
|
||||
|
||||
@@ -145,7 +145,7 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
g.Expect(k8sClient.Status().Update(hubCtx, _app)).Should(Succeed())
|
||||
}, 15*time.Second).Should(Succeed())
|
||||
|
||||
// test application can run without external policies and workflow since they are recorded in the application revision
|
||||
By("Test application can run without external policies and workflow since they are recorded in the application revision")
|
||||
_app := &v1beta1.Application{}
|
||||
Eventually(func(g Gomega) {
|
||||
deploys := &v1.DeploymentList{}
|
||||
@@ -156,14 +156,13 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
g.Expect(_app.Status.Phase).Should(Equal(oamcomm.ApplicationRunning))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
|
||||
// update application without updating publishVersion
|
||||
By("Update application without updating publishVersion. App should not re-run workflow")
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(hubCtx, appKey, _app)).Should(Succeed())
|
||||
_app.Spec.Policies[0].Properties = &runtime.RawExtension{Raw: []byte(fmt.Sprintf(`{"clusters":["local"],"namespace":"%s"}`, nsLocal.Name))}
|
||||
g.Expect(k8sClient.Update(hubCtx, _app)).Should(Succeed())
|
||||
}, 10*time.Second).Should(Succeed())
|
||||
|
||||
// application should no re-run workflow
|
||||
time.Sleep(10 * time.Second)
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(hubCtx, appKey, _app)).Should(Succeed())
|
||||
@@ -173,7 +172,7 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
g.Expect(len(apprevs.Items)).Should(Equal(1))
|
||||
}, 10*time.Second).Should(Succeed())
|
||||
|
||||
// update application with publishVersion
|
||||
By("Update application with publishVersion")
|
||||
applyFile("policy.yaml")
|
||||
applyFile("workflow.yaml")
|
||||
Eventually(func(g Gomega) {
|
||||
@@ -191,7 +190,7 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
g.Expect(k8sClient.List(hubCtx, deploys, client.InNamespace(nsLocal.Name))).Should(Succeed())
|
||||
g.Expect(len(deploys.Items)).Should(Equal(1))
|
||||
g.Expect(deploys.Items[0].Spec.Replicas).Should(Equal(pointer.Int32(3)))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
}, 2*time.Minute, time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("Test rollback application with publish version", func() {
|
||||
@@ -205,7 +204,7 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(hubCtx, appKey, app)).Should(Succeed())
|
||||
g.Expect(app.Status.Phase).Should(Equal(oamcomm.ApplicationRunning))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
|
||||
By("Update Application to first failed version")
|
||||
Eventually(func(g Gomega) {
|
||||
@@ -213,7 +212,7 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
app.Annotations[oam.AnnotationPublishVersion] = "alpha2"
|
||||
app.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(`{"image":"busybox:bad"}`)}
|
||||
g.Expect(k8sClient.Update(hubCtx, app)).Should(Succeed())
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(hubCtx, appKey, app)).Should(Succeed())
|
||||
|
||||
@@ -255,7 +255,7 @@ var _ = Describe("Test multicluster scenario", func() {
|
||||
deploys = &appsv1.DeploymentList{}
|
||||
g.Expect(k8sClient.List(workerCtx, deploys, client.InNamespace(prodNamespace))).Should(Succeed())
|
||||
g.Expect(len(deploys.Items)).Should(Equal(2))
|
||||
}, time.Minute).Should(Succeed())
|
||||
}, 4*time.Minute, time.Second).Should(Succeed())
|
||||
Expect(hubDeployName).Should(Equal("data-worker"))
|
||||
// delete application
|
||||
By("delete application")
|
||||
@@ -455,7 +455,7 @@ var _ = Describe("Test multicluster scenario", func() {
|
||||
Components: []common.ApplicationComponent{{
|
||||
Name: "test-busybox",
|
||||
Type: "webservice",
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"busybox","cmd":["sleep","86400"]}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"crccheck/hello-world"}`)},
|
||||
}},
|
||||
Policies: []v1beta1.AppPolicy{{
|
||||
Name: "topology-local",
|
||||
@@ -481,7 +481,7 @@ var _ = Describe("Test multicluster scenario", func() {
|
||||
g.Expect(k8sClient.Get(hubCtx, types.NamespacedName{Name: "test-busybox-v2", Namespace: testNamespace}, &appsv1.Deployment{})).Should(Succeed())
|
||||
err := k8sClient.Get(hubCtx, types.NamespacedName{Name: "test-busybox", Namespace: testNamespace}, &appsv1.Deployment{})
|
||||
g.Expect(kerrors.IsNotFound(err)).Should(BeTrue())
|
||||
}, time.Minute).Should(Succeed())
|
||||
}, 2*time.Minute, 2*time.Second).Should(Succeed())
|
||||
|
||||
By("Re-publish application to v1")
|
||||
_, err := execCommand("up", appKey.Name, "-n", appKey.Namespace, "--revision", appKey.Name+"-v1", "--publish-version", "v1.0")
|
||||
|
||||
@@ -17,10 +17,7 @@ spec:
|
||||
- name: data-worker
|
||||
type: worker
|
||||
properties:
|
||||
image: busybox
|
||||
cmd:
|
||||
- sleep
|
||||
- '1000000'
|
||||
image: crccheck/hello-world
|
||||
policies:
|
||||
- name: example-multi-env-policy
|
||||
type: env-binding
|
||||
|
||||
+4
-4
@@ -1,21 +1,21 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: podinfo
|
||||
name: hello-world
|
||||
annotations:
|
||||
app.oam.dev/publishVersion: alpha1
|
||||
spec:
|
||||
components:
|
||||
- name: podinfo
|
||||
- name: hello-world
|
||||
type: ref-objects
|
||||
properties:
|
||||
objects:
|
||||
- resource: deployment
|
||||
name: podinfo
|
||||
name: hello-world-ref
|
||||
policies:
|
||||
- type: topology
|
||||
name: topology-worker
|
||||
properties:
|
||||
clusters: ["cluster-worker"]
|
||||
workflow:
|
||||
ref: deploy-podinfo
|
||||
ref: deploy-hello-world
|
||||
@@ -4,12 +4,12 @@ metadata:
|
||||
name: podinfo
|
||||
spec:
|
||||
components:
|
||||
- name: podinfo
|
||||
- name: hello-world
|
||||
type: ref-objects
|
||||
properties:
|
||||
objects:
|
||||
- resource: deployment
|
||||
name: podinfo
|
||||
name: hello-world-ref
|
||||
- resource: configmap
|
||||
labelSelector:
|
||||
app: podinfo
|
||||
@@ -23,4 +23,4 @@ spec:
|
||||
properties:
|
||||
clusters: ["cluster-worker"]
|
||||
workflow:
|
||||
ref: deploy-podinfo
|
||||
ref: deploy-hello-world
|
||||
@@ -1,17 +1,17 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: podinfo
|
||||
name: hello-world-ref
|
||||
spec:
|
||||
replicas: 0
|
||||
selector:
|
||||
matchLabels:
|
||||
app: podinfo
|
||||
app: hello-world
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: podinfo
|
||||
app: hello-world
|
||||
spec:
|
||||
containers:
|
||||
- image: stefanprodan/podinfo:6.0.2
|
||||
name: podinfo
|
||||
- image: crccheck/hello-world
|
||||
name: hello-world
|
||||
+1
-1
@@ -5,7 +5,7 @@ metadata:
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- name: podinfo
|
||||
- name: hello-world
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
|
||||
@@ -5,7 +5,7 @@ metadata:
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- name: podinfo
|
||||
- name: hello-world
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apiVersion: core.oam.dev/v1alpha1
|
||||
kind: Workflow
|
||||
metadata:
|
||||
name: deploy-podinfo
|
||||
name: deploy-hello-world
|
||||
steps:
|
||||
- type: deploy
|
||||
name: deploy-worker
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apiVersion: core.oam.dev/v1alpha1
|
||||
kind: Workflow
|
||||
metadata:
|
||||
name: deploy-podinfo
|
||||
name: deploy-hello-world
|
||||
steps:
|
||||
- type: deploy
|
||||
name: deploy-worker
|
||||
|
||||
@@ -174,7 +174,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "worker",
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "crccheck/hello-world"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cluster-scope-trait",
|
||||
@@ -211,7 +211,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "worker",
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "crccheck/hello-world"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
// remove the cluster-scoped trait and keep the
|
||||
// cross-namespaced trait.
|
||||
@@ -244,7 +244,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
Eventually(func() error {
|
||||
RequestReconcileNow(ctx, app)
|
||||
return k8sClient.Get(ctx, client.ObjectKey{Name: "pv-" + componentName, Namespace: namespace}, pv)
|
||||
}, 20*time.Second, 2*time.Second).Should(SatisfyAll(&util.NotFoundMatcher{}))
|
||||
}, 120*time.Second, 1*time.Second).Should(SatisfyAll(&util.NotFoundMatcher{}))
|
||||
})
|
||||
|
||||
It("Test application have cross-namespace workload", func() {
|
||||
@@ -987,7 +987,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "cross-worker",
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"crccheck/hello-world"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
@@ -1033,8 +1033,11 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
trait := mts.Items[0]
|
||||
deploys := new(appsv1.DeploymentList)
|
||||
err = k8sClient.List(ctx, deploys, opts...)
|
||||
if err != nil || len(deploys.Items) != 1 {
|
||||
return fmt.Errorf("error to list deploy")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error to list deploy: %v", err)
|
||||
}
|
||||
if len(deploys.Items) != 1 {
|
||||
return fmt.Errorf("more than one deploy, actual %d", len(deploys.Items))
|
||||
}
|
||||
deploy := deploys.Items[0]
|
||||
for _, resource := range resourceTracker.Spec.ManagedResources {
|
||||
@@ -1084,8 +1087,11 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
}
|
||||
deploys := new(appsv1.DeploymentList)
|
||||
err = k8sClient.List(ctx, deploys, opts...)
|
||||
if err != nil || len(deploys.Items) != 1 {
|
||||
return fmt.Errorf("error to list deploy")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error to list deploy: %v", err)
|
||||
}
|
||||
if len(deploys.Items) != 1 {
|
||||
return fmt.Errorf("more than one deploy, actual %d", len(deploys.Items))
|
||||
}
|
||||
deploy := deploys.Items[0]
|
||||
if resourceTracker.Spec.ManagedResources[0].Name != deploy.Name {
|
||||
@@ -1136,7 +1142,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "cross-worker",
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"crccheck/hello-world"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -201,11 +201,11 @@ var _ = Describe("Application Normal tests", func() {
|
||||
return fmt.Errorf("expect replicas %v != real %v", replicas, workload.Status.ReadyReplicas)
|
||||
}
|
||||
if workload.Spec.Template.Spec.Containers[0].Image != image {
|
||||
return fmt.Errorf("expect replicas %v != real %v", image, workload.Spec.Template.Spec.Containers[0].Image)
|
||||
return fmt.Errorf("expect image %v != real %v", image, workload.Spec.Template.Spec.Containers[0].Image)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
time.Second*60, time.Millisecond*500).Should(BeNil())
|
||||
time.Second*120, time.Millisecond*500).Should(BeNil())
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
@@ -225,22 +225,22 @@ var _ = Describe("Application Normal tests", func() {
|
||||
It("Test app created normally", func() {
|
||||
applyApp("app1.yaml")
|
||||
By("Apply the application rollout go directly to the target")
|
||||
verifyWorkloadRunningExpected("myweb", 1, "stefanprodan/podinfo:4.0.3")
|
||||
verifyWorkloadRunningExpected("myweb", 1, "crccheck/hello-world")
|
||||
|
||||
By("Update app with trait")
|
||||
updateApp("app2.yaml")
|
||||
By("Apply the application rollout go directly to the target")
|
||||
verifyWorkloadRunningExpected("myweb", 2, "stefanprodan/podinfo:4.0.3")
|
||||
verifyWorkloadRunningExpected("myweb", 2, "crccheck/hello-world")
|
||||
|
||||
By("Update app with trait updated")
|
||||
updateApp("app3.yaml")
|
||||
By("Apply the application rollout go directly to the target")
|
||||
verifyWorkloadRunningExpected("myweb", 3, "stefanprodan/podinfo:4.0.3")
|
||||
verifyWorkloadRunningExpected("myweb", 3, "crccheck/hello-world")
|
||||
|
||||
By("Update app with trait and workload image updated")
|
||||
updateApp("app4.yaml")
|
||||
By("Apply the application rollout go directly to the target")
|
||||
verifyWorkloadRunningExpected("myweb", 1, "stefanprodan/podinfo:5.0.2")
|
||||
verifyWorkloadRunningExpected("myweb", 1, "hello-world")
|
||||
})
|
||||
|
||||
It("Test app have component with multiple same type traits", func() {
|
||||
|
||||
@@ -80,6 +80,8 @@ var _ = Describe("HealthScope", func() {
|
||||
var healthyAppName, unhealthyAppName string
|
||||
Expect(utilcommon.ReadYamlToObject("testdata/app/app_healthscope.yaml", &newApp)).Should(BeNil())
|
||||
newApp.Namespace = namespace
|
||||
convertToLegacyIngressTrait(&newApp)
|
||||
|
||||
Eventually(func() error {
|
||||
return k8sClient.Create(ctx, newApp.DeepCopy())
|
||||
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
|
||||
@@ -101,6 +103,7 @@ var _ = Describe("HealthScope", func() {
|
||||
newApp = v1beta1.Application{}
|
||||
Expect(utilcommon.ReadYamlToObject("testdata/app/app_healthscope_unhealthy.yaml", &newApp)).Should(BeNil())
|
||||
newApp.Namespace = namespace
|
||||
convertToLegacyIngressTrait(&newApp)
|
||||
Eventually(func() error {
|
||||
return k8sClient.Create(ctx, newApp.DeepCopy())
|
||||
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
|
||||
@@ -133,7 +136,7 @@ var _ = Describe("HealthScope", func() {
|
||||
k8sClient.Get(ctx, healthScopeObject, healthScope)
|
||||
return healthScope.Status.ScopeHealthCondition
|
||||
},
|
||||
time.Second*60, time.Millisecond*500).Should(Equal(v1alpha2.ScopeHealthCondition{
|
||||
time.Second*120, time.Millisecond*500).Should(Equal(v1alpha2.ScopeHealthCondition{
|
||||
HealthStatus: v1alpha2.StatusHealthy,
|
||||
Total: int64(2),
|
||||
HealthyWorkloads: int64(2),
|
||||
@@ -205,3 +208,16 @@ var _ = Describe("HealthScope", func() {
|
||||
}, time.Second*30, time.Millisecond*500).Should(Succeed())
|
||||
})
|
||||
})
|
||||
|
||||
// convertToLegacyIngressTrait convert app's gateway trait to ingress
|
||||
func convertToLegacyIngressTrait(app *v1beta1.Application) {
|
||||
if noNetworkingV1 {
|
||||
for i := range app.Spec.Components {
|
||||
for j := range app.Spec.Components[i].Traits {
|
||||
if app.Spec.Components[i].Traits[j].Type == "gateway" {
|
||||
app.Spec.Components[i].Traits[j].Type = "ingress"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ var _ = Describe("Application Resource-Related Policy Tests", func() {
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(ctx, appKey, app)).Should(Succeed())
|
||||
g.Expect(app.Status.Phase).Should(Equal(common2.ApplicationRunning))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
}, 120*time.Second).Should(Succeed())
|
||||
|
||||
By("test state-keep")
|
||||
deploy := &v13.Deployment{}
|
||||
@@ -118,7 +118,7 @@ var _ = Describe("Application Resource-Related Policy Tests", func() {
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(ctx, appKey, app)).Should(Succeed())
|
||||
g.Expect(app.Status.Phase).Should(Equal(common2.ApplicationRunning))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
}, 120*time.Second).Should(Succeed())
|
||||
|
||||
By("upgrade to v2 (same component)")
|
||||
Eventually(func(g Gomega) {
|
||||
@@ -217,7 +217,7 @@ var _ = Describe("Application Resource-Related Policy Tests", func() {
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(ctx, appKey, app)).Should(Succeed())
|
||||
g.Expect(app.Status.Phase).Should(Equal(common2.ApplicationWorkflowSuspending))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
|
||||
By("test suspending app state-keep")
|
||||
deploy := &v13.Deployment{}
|
||||
|
||||
@@ -25,19 +25,20 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
kruise "github.com/openkruise/kruise-api/apps/v1alpha1"
|
||||
"github.com/pkg/errors"
|
||||
networkv1 "k8s.io/api/networking/v1"
|
||||
rbac "k8s.io/api/rbac/v1"
|
||||
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
k8sutils "k8s.io/utils/pointer"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/config"
|
||||
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
|
||||
@@ -48,6 +49,7 @@ import (
|
||||
core "github.com/oam-dev/kubevela/apis/core.oam.dev"
|
||||
commontypes "github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
// +kubebuilder:scaffold:imports
|
||||
)
|
||||
@@ -58,6 +60,10 @@ var manualscalertrait v1alpha2.TraitDefinition
|
||||
var roleName = "oam-example-com"
|
||||
var roleBindingName = "oam-role-binding"
|
||||
|
||||
var (
|
||||
noNetworkingV1 bool
|
||||
)
|
||||
|
||||
// A DefinitionExtension is an Object type for xxxDefinitin.spec.extension
|
||||
type DefinitionExtension struct {
|
||||
Alias string `json:"alias,omitempty"`
|
||||
@@ -104,6 +110,8 @@ var _ = BeforeSuite(func(done Done) {
|
||||
}
|
||||
By("Finished setting up test environment")
|
||||
|
||||
detectAPIVersion()
|
||||
|
||||
// Create manual scaler trait definition
|
||||
manualscalertrait = v1alpha2.TraitDefinition{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@@ -219,3 +227,20 @@ func RequestReconcileNow(ctx context.Context, o client.Object) {
|
||||
func randomNamespaceName(basic string) string {
|
||||
return fmt.Sprintf("%s-%s", basic, strconv.FormatInt(rand.Int63(), 16))
|
||||
}
|
||||
|
||||
// detectAPIVersion helps detect legacy GVK
|
||||
func detectAPIVersion() {
|
||||
err := k8sClient.Create(context.Background(), &networkv1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-ingress",
|
||||
},
|
||||
Spec: networkv1.IngressSpec{
|
||||
IngressClassName: k8sutils.StringPtr("nginx"),
|
||||
Rules: []networkv1.IngressRule{},
|
||||
},
|
||||
})
|
||||
var noKindMatchErr = &meta.NoKindMatchError{}
|
||||
if err != nil && errors.As(err, &noKindMatchErr) {
|
||||
noNetworkingV1 = true
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-4
@@ -7,7 +7,4 @@ spec:
|
||||
- name: myweb
|
||||
type: worker
|
||||
properties:
|
||||
image: "stefanprodan/podinfo:4.0.3"
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=1
|
||||
image: crccheck/hello-world
|
||||
Vendored
+1
-4
@@ -7,10 +7,7 @@ spec:
|
||||
- name: myweb
|
||||
type: worker
|
||||
properties:
|
||||
image: "stefanprodan/podinfo:4.0.3"
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=1
|
||||
image: crccheck/hello-world
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
|
||||
Vendored
+1
-4
@@ -7,10 +7,7 @@ spec:
|
||||
- name: myweb
|
||||
type: worker
|
||||
properties:
|
||||
image: "stefanprodan/podinfo:4.0.3"
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=1
|
||||
image: crccheck/hello-world
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
|
||||
Vendored
+1
-4
@@ -7,10 +7,7 @@ spec:
|
||||
- name: myweb
|
||||
type: worker
|
||||
properties:
|
||||
image: "stefanprodan/podinfo:5.0.2"
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=1
|
||||
image: hello-world
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: test-rolling
|
||||
spec:
|
||||
components:
|
||||
- name: metrics-provider
|
||||
type: worker
|
||||
properties:
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=3.0
|
||||
image: stefanprodan/podinfo:4.0.6
|
||||
port: 8080
|
||||
rolloutPlan:
|
||||
rolloutStrategy: "IncreaseFirst"
|
||||
targetSize: 3
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ spec:
|
||||
- name: myworker
|
||||
type: worker
|
||||
properties:
|
||||
image: nginx
|
||||
image: crccheck/hello-world
|
||||
traits:
|
||||
- type: config
|
||||
properties:
|
||||
|
||||
+4
-10
@@ -7,13 +7,10 @@ spec:
|
||||
- name: my-server-1
|
||||
type: webservice
|
||||
properties:
|
||||
cmd:
|
||||
- node
|
||||
- server.js
|
||||
image: oamdev/testapp:v1
|
||||
image: crccheck/hello-world
|
||||
port: 8080
|
||||
traits:
|
||||
- type: ingress
|
||||
- type: gateway
|
||||
properties:
|
||||
domain: test.my.domain
|
||||
http:
|
||||
@@ -21,13 +18,10 @@ spec:
|
||||
- name: my-server-2
|
||||
type: webservice
|
||||
properties:
|
||||
cmd:
|
||||
- node
|
||||
- server.js
|
||||
image: oamdev/testapp:v1
|
||||
image: crccheck/hello-world
|
||||
port: 8080
|
||||
traits:
|
||||
- type: ingress
|
||||
- type: gateway
|
||||
properties:
|
||||
domain: test.my.domain
|
||||
http:
|
||||
|
||||
@@ -15,13 +15,10 @@ spec:
|
||||
- name: my-server
|
||||
type: webservice
|
||||
properties:
|
||||
cmd:
|
||||
- node
|
||||
- server.js
|
||||
image: oamdev/testapp:v1
|
||||
image: crccheck/hello-world
|
||||
port: 8080
|
||||
traits:
|
||||
- type: ingress
|
||||
- type: gateway
|
||||
properties:
|
||||
domain: test.my.domain
|
||||
http:
|
||||
|
||||
+1
-2
@@ -7,8 +7,7 @@ spec:
|
||||
- name: busybox
|
||||
type: webservice
|
||||
properties:
|
||||
image: busybox
|
||||
cmd: ["sleep", "86400"]
|
||||
image: crccheck/hello-world
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ spec:
|
||||
- name: wait-suspend-comp
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx
|
||||
image: crccheck/hello-world
|
||||
port: 80
|
||||
workflow:
|
||||
steps:
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: test-e2e-rolling
|
||||
annotations:
|
||||
"app.oam.dev/rollout-template": "true"
|
||||
spec:
|
||||
components:
|
||||
- name: metrics-provider
|
||||
type: clonesetservice
|
||||
properties:
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=1
|
||||
image: stefanprodan/podinfo:5.0.2
|
||||
port: 8080
|
||||
updateStrategyType: InPlaceOnly
|
||||
@@ -1,23 +0,0 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: test-e2e-rolling
|
||||
annotations:
|
||||
"app.oam.dev/rollout-template": "true"
|
||||
spec:
|
||||
components:
|
||||
- name: metrics-provider
|
||||
type: clonesetservice
|
||||
properties:
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=1
|
||||
image: stefanprodan/podinfo:4.0.3
|
||||
port: 8080
|
||||
updateStrategyType: InPlaceOnly
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: test.example.com
|
||||
http:
|
||||
"/": 8080
|
||||
@@ -1,23 +0,0 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: test-e2e-rolling
|
||||
annotations:
|
||||
"app.oam.dev/rollout-template": "true"
|
||||
spec:
|
||||
components:
|
||||
- name: metrics-provider
|
||||
type: clonesetservice
|
||||
properties:
|
||||
cmd:
|
||||
- ./podinfo
|
||||
- stress-cpu=1
|
||||
image: stefanprodan/podinfo:5.0.2
|
||||
port: 8080
|
||||
updateStrategyType: InPlaceOnly
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: test-1.example.com
|
||||
http:
|
||||
"/": 8080
|
||||
Reference in New Issue
Block a user