Skip to content

Commit

Permalink
reply review
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 71b7b45 commit a5c8131
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
16 changes: 5 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ 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 @@ -412,14 +409,11 @@ e2e-test/teardown:
./test/e2e/setup/e2e_teardown.sh
.PHONY: e2e-test/teardown

e2e-test:
@if [ "$(ON_KIND)" = "true" ]; then \
make e2e-test/teardown; make e2e-test/setup; \
fi
e2e-test: e2e-test/teardown e2e-test/setup
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=$${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}
-api-server=https://$(shell cat ${PWD}/test/e2e/.external_host_ip):30080 \
-grpc-server=$(shell cat ${PWD}/test/e2e/.external_host_ip):30090 \
-consumer-name=$(shell cat ${PWD}/test/e2e/.consumer_name) \
-consumer-kubeconfig=${PWD}/test/e2e/.kubeconfig
.PHONY: e2e-test
32 changes: 16 additions & 16 deletions test/e2e/pkg/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@ var _ = Describe("Consumer", Ordered, func() {
})

Context("Consumer CRUD Tests", func() {
It("list the default consumer", func() {
consumerList, resp, err := apiClient.DefaultApi.ApiMaestroV1ConsumersGet(ctx).Execute()
Expect(err).To(Succeed())
Expect(resp.StatusCode).To(Equal(http.StatusOK))
Expect(consumerList).NotTo(BeNil())
Expect(len(consumerList.Items) > 0).To(BeTrue())

got := false
for _, c := range consumerList.Items {
if *c.Name == consumer.Name {
got = true
}
}
Expect(got).To(BeTrue())
})

It("create consumer", func() {
consumer := openapi.Consumer{Name: &testConsumerName}
created, resp, err := apiClient.DefaultApi.ApiMaestroV1ConsumersPost(ctx).Consumer(consumer).Execute()
Expand All @@ -48,6 +32,22 @@ var _ = Describe("Consumer", Ordered, func() {
Expect(got).NotTo(BeNil())
})

It("list consumer", func() {
consumerList, resp, err := apiClient.DefaultApi.ApiMaestroV1ConsumersGet(ctx).Execute()
Expect(err).To(Succeed())
Expect(resp.StatusCode).To(Equal(http.StatusOK))
Expect(consumerList).NotTo(BeNil())
Expect(len(consumerList.Items) > 0).To(BeTrue())

got := false
for _, c := range consumerList.Items {
if *c.Name == testConsumerName {
got = true
}
}
Expect(got).To(BeTrue())
})

It("patch consumer", func() {
labels := &map[string]string{"hello": "world"}
patched, resp, err := apiClient.DefaultApi.ApiMaestroV1ConsumersIdPatch(ctx, testConsumerID).
Expand Down

0 comments on commit a5c8131

Please sign in to comment.