mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
Feat: support pause reconcile (#5732)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/kubevela/pkg/controller/reconciler"
|
||||
workflowv1alpha1 "github.com/kubevela/workflow/api/v1alpha1"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
@@ -987,5 +988,28 @@ var _ = Describe("Test multicluster scenario", func() {
|
||||
g.Expect(app.Status.Services[0].Traits[0].Healthy).Should(BeTrue())
|
||||
}).WithTimeout(20 * time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("Test pause application", func() {
|
||||
app := &v1beta1.Application{}
|
||||
bs, err := os.ReadFile("./testdata/app/app-pause.yaml")
|
||||
Expect(err).Should(Succeed())
|
||||
Expect(yaml.Unmarshal(bs, app)).Should(Succeed())
|
||||
app.SetNamespace(namespace)
|
||||
Expect(k8sClient.Create(hubCtx, app)).Should(Succeed())
|
||||
time.Sleep(10 * time.Second)
|
||||
appKey := client.ObjectKeyFromObject(app)
|
||||
Expect(k8sClient.Get(hubCtx, appKey, app)).Should(Succeed())
|
||||
Expect(app.Status.Workflow).Should(BeNil())
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(hubCtx, appKey, app)).Should(Succeed())
|
||||
reconciler.SetPause(app, false)
|
||||
g.Expect(k8sClient.Update(hubCtx, app)).Should(Succeed())
|
||||
}).WithTimeout(5 * time.Second).WithPolling(time.Second).Should(Succeed())
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(hubCtx, appKey, app)).Should(Succeed())
|
||||
g.Expect(app.Status.Phase).Should(Equal(common.ApplicationRunning))
|
||||
}).WithTimeout(15 * time.Second).WithPolling(3 * time.Second).Should(Succeed())
|
||||
Expect(k8sClient.Delete(hubCtx, app)).Should(Succeed())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
15
test/e2e-multicluster-test/testdata/app/app-pause.yaml
vendored
Normal file
15
test/e2e-multicluster-test/testdata/app/app-pause.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: busybox
|
||||
labels:
|
||||
controller.core.oam.dev/pause: "true"
|
||||
spec:
|
||||
components:
|
||||
- name: data-worker
|
||||
type: worker
|
||||
properties:
|
||||
image: busybox
|
||||
cmd:
|
||||
- sleep
|
||||
- '1000000'
|
||||
Reference in New Issue
Block a user