From 71b7b459f4971d8623cbb28f1105b2c66e5f3645 Mon Sep 17 00:00:00 2001 From: myan Date: Mon, 24 Jun 2024 16:11:33 +0800 Subject: [PATCH] fix Signed-off-by: myan --- Makefile | 10 ++++++---- test/e2e/pkg/consumer_test.go | 2 +- test/e2e/pkg/resources_test.go | 8 -------- test/e2e/pkg/sourceclient_test.go | 10 +--------- test/e2e/pkg/status_resync_test.go | 4 ++-- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 8ce2a283..4d733b12 100755 --- a/Makefile +++ b/Makefile @@ -79,6 +79,9 @@ ENABLE_OCM_MOCK ?= false ENABLE_GRPC ?= false +# Run the e2e on kind cluster. If false, the api/grpc server, consumer_name, and consumer_kubeconfig required to be set. +ON_KIND ?= true + # Enable set images POSTGRES_IMAGE ?= docker.io/library/postgres:14.2 MQTT_IMAGE ?= docker.io/library/eclipse-mosquitto:2.0.18 @@ -410,14 +413,13 @@ e2e-test/teardown: .PHONY: e2e-test/teardown e2e-test: - @if [ -z "$$consumer_name" ] || [ -z "$$api_server" ] || [ -z "$$consumer_kubeconfig" ]; then \ - make e2e-test/teardown; \ - make e2e-test/setup; \ + @if [ "$(ON_KIND)" = "true" ]; then \ + make e2e-test/teardown; make e2e-test/setup; \ fi ginkgo --output-dir="${PWD}/test/e2e/report" --json-report=report.json --junit-report=report.xml \ ${PWD}/test/e2e/pkg -- \ -api-server=$${api_server:-https://$$(cat ${PWD}/test/e2e/.external_host_ip):30080} \ - -grpc-server=$(shell cat ${PWD}/test/e2e/.external_host_ip):30090 \ + -grpc-server=$${grpc_server:-$$(shell cat ${PWD}/test/e2e/.external_host_ip):30090} \ -consumer-name=$${consumer_name:-$$(cat ${PWD}/test/e2e/.consumer_name)} \ -consumer-kubeconfig=$${consumer_kubeconfig:-${PWD}/test/e2e/.kubeconfig} .PHONY: e2e-test diff --git a/test/e2e/pkg/consumer_test.go b/test/e2e/pkg/consumer_test.go index 238670e2..eac9882a 100644 --- a/test/e2e/pkg/consumer_test.go +++ b/test/e2e/pkg/consumer_test.go @@ -66,7 +66,7 @@ var _ = Describe("Consumer", Ordered, func() { }) AfterAll(func() { - // TODO: add the conusmer deletion + // TODO: add the consumer deletion }) }) }) diff --git a/test/e2e/pkg/resources_test.go b/test/e2e/pkg/resources_test.go index 04f56217..2efde412 100644 --- a/test/e2e/pkg/resources_test.go +++ b/test/e2e/pkg/resources_test.go @@ -117,14 +117,6 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() { }, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred()) }) - It("patch the nginx resource with orphan delete option", func() { - patchedResource, resp, err := apiClient.DefaultApi.ApiMaestroV1ResourcesIdPatch(ctx, *resource.Id). - ResourcePatchRequest(openapi.ResourcePatchRequest{Version: resource.Version, Manifest: res.Manifest, DeleteOption: map[string]interface{}{"propagationPolicy": "Orphan"}}).Execute() - Expect(err).ShouldNot(HaveOccurred()) - Expect(resp.StatusCode).To(Equal(http.StatusOK)) - Expect(*patchedResource.Version).To(Equal(*resource.Version + 1)) - }) - It("delete the nginx resource from the maestro api", func() { resp, err := apiClient.DefaultApi.ApiMaestroV1ResourcesIdDelete(ctx, *resource.Id).Execute() Expect(err).ShouldNot(HaveOccurred()) diff --git a/test/e2e/pkg/sourceclient_test.go b/test/e2e/pkg/sourceclient_test.go index 63b86445..a54108fb 100644 --- a/test/e2e/pkg/sourceclient_test.go +++ b/test/e2e/pkg/sourceclient_test.go @@ -88,15 +88,7 @@ var _ = Describe("gRPC Source ManifestWork Client Test", func() { // wait for few seconds to ensure the creation is finished <-time.After(5 * time.Second) - By("list the works") - works, err := workClient.ManifestWorks(consumer.Name).List(ctx, metav1.ListOptions{}) - Expect(err).ShouldNot(HaveOccurred()) - Expect(len(works.Items) == 1).To(BeTrue()) - - // wait for few seconds to ensure the work status is updated by agent - <-time.After(5 * time.Second) - - By("update a work") + By("update a work by work client") work, err := workClient.ManifestWorks(consumer.Name).Get(ctx, workName, metav1.GetOptions{}) Expect(err).ShouldNot(HaveOccurred()) diff --git a/test/e2e/pkg/status_resync_test.go b/test/e2e/pkg/status_resync_test.go index 6e6c04cc..5582f773 100644 --- a/test/e2e/pkg/status_resync_test.go +++ b/test/e2e/pkg/status_resync_test.go @@ -70,7 +70,7 @@ var _ = Describe("Status resync", Ordered, Label("e2e-tests-status-resync"), fun // patch maestro server replicas to 0 deploy, err = consumer.ClientSet.AppsV1().Deployments("maestro").Patch(ctx, "maestro", types.MergePatchType, []byte(`{"spec":{"replicas":0}}`), metav1.PatchOptions{ - FieldManager: "testconsumer.ClientSet", + FieldManager: "testConsumer.ClientSet", }) Expect(err).ShouldNot(HaveOccurred()) Expect(*deploy.Spec.Replicas).To(Equal(int32(0))) @@ -106,7 +106,7 @@ var _ = Describe("Status resync", Ordered, Label("e2e-tests-status-resync"), fun It("start maestro server", func() { // patch maestro server replicas to 1 deploy, err := consumer.ClientSet.AppsV1().Deployments("maestro").Patch(ctx, "maestro", types.MergePatchType, []byte(fmt.Sprintf(`{"spec":{"replicas":%d}}`, maestroServerReplicas)), metav1.PatchOptions{ - FieldManager: "testconsumer.ClientSet", + FieldManager: "testConsumer.ClientSet", }) Expect(err).ShouldNot(HaveOccurred()) Expect(*deploy.Spec.Replicas).To(Equal(int32(maestroServerReplicas)))