mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
mock an addon to fix flaky test (#3665)
Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
name: mock-addon
|
||||
version: 1.0.0
|
||||
description: Extended workload to do continuous and progressive delivery
|
||||
icon: https://raw.githubusercontent.com/fluxcd/flux/master/docs/_files/weave-flux.png
|
||||
url: https://fluxcd.io
|
||||
|
||||
tags:
|
||||
- extended_workload
|
||||
- gitops
|
||||
- only_example
|
||||
|
||||
deployTo:
|
||||
control_plane: true
|
||||
runtime_cluster: false
|
||||
|
||||
dependencies: []
|
||||
#- name: addon_name
|
||||
|
||||
# set invisible means this won't be list and will be enabled when depended on
|
||||
# for example, terraform-alibaba depends on terraform which is invisible,
|
||||
# when terraform-alibaba is enabled, terraform will be enabled automatically
|
||||
# default: false
|
||||
invisible: false
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: mock-addon
|
||||
namespace: vela-system
|
||||
spec:
|
||||
components:
|
||||
- name: ns-example-system
|
||||
type: raw
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: mock-system
|
||||
@@ -129,7 +129,7 @@ var _ = Describe("Test Kubectl Plugin", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).Should(ContainSubstring(showTdResult))
|
||||
})
|
||||
PIt("Test show componentDefinition use Helm Charts as Workload", func() {
|
||||
It("Test show componentDefinition use Helm Charts as Workload", func() {
|
||||
Eventually(func() string {
|
||||
cdName := "test-webapp-chart"
|
||||
output, _ := e2e.Exec(fmt.Sprintf("kubectl-vela show %s -n default", cdName))
|
||||
|
||||
@@ -96,11 +96,11 @@ var _ = Describe("Test addon rest api", func() {
|
||||
})
|
||||
|
||||
It("get addon detail", func() {
|
||||
res := get("/addons/fluxcd")
|
||||
res := get("/addons/mock-addon")
|
||||
defer res.Body.Close()
|
||||
var addon apisv1.DetailAddonResponse
|
||||
Expect(decodeResponseBody(res, &addon)).Should(Succeed())
|
||||
Expect(addon.Name).Should(BeEquivalentTo("fluxcd"))
|
||||
Expect(addon.Name).Should(BeEquivalentTo("mock-addon"))
|
||||
})
|
||||
|
||||
It("enable addon ", func() {
|
||||
@@ -109,21 +109,21 @@ var _ = Describe("Test addon rest api", func() {
|
||||
"testkey": "testvalue",
|
||||
},
|
||||
}
|
||||
res := post("/addons/fluxcd/enable", req)
|
||||
res := post("/addons/mock-addon/enable", req)
|
||||
defer res.Body.Close()
|
||||
var addon apisv1.AddonStatusResponse
|
||||
Expect(decodeResponseBody(res, &addon)).Should(Succeed())
|
||||
Expect(addon.Name).Should(BeEquivalentTo("fluxcd"))
|
||||
Expect(addon.Name).Should(BeEquivalentTo("mock-addon"))
|
||||
Expect(len(addon.Args)).Should(BeEquivalentTo(1))
|
||||
Expect(addon.Args["testkey"]).Should(BeEquivalentTo("testvalue"))
|
||||
})
|
||||
|
||||
It("addon status", func() {
|
||||
res := get("/addons/fluxcd/status")
|
||||
res := get("/addons/mock-addon/status")
|
||||
defer res.Body.Close()
|
||||
var addonStatus apisv1.AddonStatusResponse
|
||||
Expect(decodeResponseBody(res, &addonStatus)).Should(Succeed())
|
||||
Expect(addonStatus.Name).Should(BeEquivalentTo("fluxcd"))
|
||||
Expect(addonStatus.Name).Should(BeEquivalentTo("mock-addon"))
|
||||
Expect(len(addonStatus.Args)).Should(BeEquivalentTo(1))
|
||||
Expect(addonStatus.Args["testkey"]).Should(BeEquivalentTo("testvalue"))
|
||||
})
|
||||
@@ -143,18 +143,18 @@ var _ = Describe("Test addon rest api", func() {
|
||||
"testkey": "new-testvalue",
|
||||
},
|
||||
}
|
||||
res := put("/addons/fluxcd/update", req)
|
||||
res := put("/addons/mock-addon/update", req)
|
||||
defer res.Body.Close()
|
||||
var addonStatus apisv1.AddonStatusResponse
|
||||
Expect(decodeResponseBody(res, &addonStatus)).Should(Succeed())
|
||||
Expect(addonStatus.Name).Should(BeEquivalentTo("fluxcd"))
|
||||
Expect(addonStatus.Name).Should(BeEquivalentTo("mock-addon"))
|
||||
Expect(len(addonStatus.Args)).Should(BeEquivalentTo(1))
|
||||
Expect(addonStatus.Args["testkey"]).Should(BeEquivalentTo("new-testvalue"))
|
||||
|
||||
status := get("/addons/fluxcd/status")
|
||||
status := get("/addons/mock-addon/status")
|
||||
var newaddonStatus apisv1.AddonStatusResponse
|
||||
Expect(decodeResponseBody(status, &newaddonStatus)).Should(Succeed())
|
||||
Expect(newaddonStatus.Name).Should(BeEquivalentTo("fluxcd"))
|
||||
Expect(newaddonStatus.Name).Should(BeEquivalentTo("mock-addon"))
|
||||
Expect(len(newaddonStatus.Args)).Should(BeEquivalentTo(1))
|
||||
Expect(newaddonStatus.Args["testkey"]).Should(BeEquivalentTo("new-testvalue"))
|
||||
})
|
||||
@@ -176,11 +176,11 @@ var _ = Describe("Test addon rest api", func() {
|
||||
})
|
||||
|
||||
It("disable addon ", func() {
|
||||
res := post("/addons/fluxcd/disable", nil)
|
||||
res := post("/addons/mock-addon/disable", nil)
|
||||
defer res.Body.Close()
|
||||
var addonStatus apisv1.AddonStatusResponse
|
||||
Expect(decodeResponseBody(res, &addonStatus)).Should(Succeed())
|
||||
Expect(addonStatus.Name).Should(BeEquivalentTo("fluxcd"))
|
||||
Expect(addonStatus.Name).Should(BeEquivalentTo("mock-addon"))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -203,7 +203,7 @@ var _ = Describe("Test velaQL rest api", func() {
|
||||
}, 2*time.Minute, 3*time.Microsecond).Should(BeNil())
|
||||
})
|
||||
|
||||
PIt("Test collect pod from helmRelease", func() {
|
||||
It("Test collect pod from helmRelease", func() {
|
||||
appWithHelm := new(v1beta1.Application)
|
||||
Expect(yaml.Unmarshal([]byte(podInfoApp), appWithHelm)).Should(BeNil())
|
||||
req := apiv1.ApplicationRequest{
|
||||
|
||||
Reference in New Issue
Block a user