mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-23 22:46:53 +00:00
fix e2e test and unit test
Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
This commit is contained in:
@@ -66,7 +66,8 @@ var _ = Describe("Test cloudshell service function", func() {
|
||||
ProjectService: projectService,
|
||||
}
|
||||
projectService = &projectServiceImpl{
|
||||
Store: ds,
|
||||
Store: ds,
|
||||
K8sClient: k8sClient,
|
||||
RbacService: &rbacServiceImpl{
|
||||
Store: ds,
|
||||
},
|
||||
|
||||
@@ -83,7 +83,7 @@ var _ = Describe("Test helm repo list", func() {
|
||||
pSec = v1.Secret{}
|
||||
gSec = v1.Secret{}
|
||||
Expect(k8sClient.Create(ctx, &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "vela-system"}})).Should(SatisfyAny(BeNil(), util.AlreadyExistMatcher{}))
|
||||
Expect(k8sClient.Create(ctx, &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "project-my-project"}})).Should(SatisfyAny(BeNil(), util.AlreadyExistMatcher{}))
|
||||
Expect(k8sClient.Create(ctx, &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "my-project"}})).Should(SatisfyAny(BeNil(), util.AlreadyExistMatcher{}))
|
||||
Expect(yaml.Unmarshal([]byte(projectSecret), &pSec)).Should(BeNil())
|
||||
Expect(yaml.Unmarshal([]byte(globalSecret), &gSec)).Should(BeNil())
|
||||
Expect(k8sClient.Create(ctx, &pSec)).Should(BeNil())
|
||||
@@ -390,7 +390,7 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: project-helm-repo
|
||||
namespace: project-my-project
|
||||
namespace: my-project
|
||||
labels:
|
||||
config.oam.dev/type: helm-repository
|
||||
config.oam.dev/catalog: velacore-config
|
||||
|
||||
@@ -17,14 +17,15 @@ limitations under the License.
|
||||
package service
|
||||
|
||||
import (
|
||||
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultNamespace = "project-default-ns1-test"
|
||||
// defaultNamespace = "project-default-ns1-test"
|
||||
pipelineService *pipelineServiceImpl
|
||||
pipelineRunService *pipelineRunServiceImpl
|
||||
contextService *contextServiceImpl
|
||||
|
||||
@@ -58,7 +58,7 @@ var _ = Describe("Test workflow service functions", func() {
|
||||
Expect(ds).ToNot(BeNil())
|
||||
Expect(err).Should(BeNil())
|
||||
rbacService := &rbacServiceImpl{Store: ds}
|
||||
projectService = &projectServiceImpl{Store: ds, RbacService: rbacService}
|
||||
projectService = &projectServiceImpl{Store: ds, RbacService: rbacService, K8sClient: k8sClient}
|
||||
envService = &envServiceImpl{Store: ds, KubeClient: k8sClient, ProjectService: projectService}
|
||||
envBinding = &envBindingServiceImpl{
|
||||
Store: ds,
|
||||
|
||||
@@ -47,7 +47,7 @@ func init() {
|
||||
Type: "request",
|
||||
Outputs: v1alpha1.StepOutputs{
|
||||
{
|
||||
ValueFrom: "import \"strconv\"\\n\"Current star count: \" + strconv.FormatInt(response[\"stargazers_count\"], 10)\n",
|
||||
ValueFrom: "import \"strconv\"\n\"Current star count: \" + strconv.FormatInt(response[\"stargazers_count\"], 10)\n",
|
||||
Name: "stars",
|
||||
},
|
||||
},
|
||||
@@ -59,7 +59,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
var _ = FDescribe("Test the rest api about the pipeline", func() {
|
||||
var _ = Describe("Test the rest api about the pipeline", func() {
|
||||
var (
|
||||
projectName1 = testNSprefix + strconv.FormatInt(time.Now().UnixNano(), 10)
|
||||
pipelineName = "test-pipeline"
|
||||
@@ -173,6 +173,17 @@ var _ = FDescribe("Test the rest api about the pipeline", func() {
|
||||
Expect(run.PipelineRunName).Should(Equal(pipelineRunName))
|
||||
})
|
||||
|
||||
It("get pipeline run status", func() {
|
||||
Eventually(func(g Gomega) {
|
||||
res := get("/projects/" + projectName1 + "/pipelines/" + pipelineName + "/runs/" + pipelineRunName + "/status")
|
||||
var status v1alpha1.WorkflowRunStatus
|
||||
g.Expect(decodeResponseBody(res, &status)).Should(Succeed())
|
||||
g.Expect(status.Finished).Should(Equal(true))
|
||||
g.Expect(status.Phase).Should(Equal(v1alpha1.WorkflowStateSucceeded))
|
||||
g.Expect(status.Message).Should(BeEmpty())
|
||||
}, 100*time.Second, 1*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("get pipeline run output", func() {
|
||||
outputStep := "request"
|
||||
res := get("/projects/" + projectName1 + "/pipelines/" + pipelineName + "/runs/" + pipelineRunName + "/output?step=" + outputStep)
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ spec:
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
http: op.#HTTPDo & {
|
||||
http: op.http.#Do & {
|
||||
method: parameter.method
|
||||
url: parameter.url
|
||||
request: {
|
||||
|
||||
Reference in New Issue
Block a user