Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: myan <[email protected]>
  • Loading branch information
yanmxa committed Jun 24, 2024
1 parent b1f549c commit 71b7b45
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 24 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/e2e/pkg/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var _ = Describe("Consumer", Ordered, func() {
})

AfterAll(func() {
// TODO: add the conusmer deletion
// TODO: add the consumer deletion
})
})
})
8 changes: 0 additions & 8 deletions test/e2e/pkg/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
10 changes: 1 addition & 9 deletions test/e2e/pkg/sourceclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/pkg/status_resync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit 71b7b45

Please sign in to comment.