Skip to content

Commit bcaeb6c

Browse files
committed
unit-test detect StatefulSet delete event
1 parent 15d1c10 commit bcaeb6c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ kind-load:
7979

8080
.PHONY: unit-test
8181
unit-test: manifests generate fmt vet envtest ## Run unit tests
82-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use --arch=amd64 $(ENVTEST_K8S_VERSION) -p path)" go test -v -timeout 1800s -p 1 ./internal/... -ginkgo.v -coverprofile cover.out
82+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use --arch=amd64 $(ENVTEST_K8S_VERSION) -p path)" go test -v -timeout 900s -p 1 ./internal/... -ginkgo.v -coverprofile cover.out
8383

8484
.PHONY: e2e-test
8585
e2e-test: manifests generate fmt vet docker-build kind-init kind-load ## Run e2e tests
86-
go test -v -timeout 1800s -p 1 ./e2e/... -args -ginkgo.v
86+
go test -v -timeout 3600s -p 1 ./e2e/... -args -ginkgo.v
8787

8888
.PHONY: test
8989
test: unit-test e2e-test ## Run all tests

internal/controllers/storage/controller_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,22 @@ var _ = Describe("Storage controller medium tests", func() {
186186
},
187187
},
188188
))
189+
190+
By("check that delete StatefulSet event was detected...")
191+
Expect(k8sClient.List(ctx,
192+
&foundStatefulSets,
193+
client.InNamespace(testobjects.YdbNamespace),
194+
)).ShouldNot(HaveOccurred())
195+
Expect(len(foundStatefulSets.Items)).Should(Equal(1))
196+
Expect(k8sClient.Delete(ctx,
197+
&foundStatefulSets.Items[0],
198+
)).ShouldNot(HaveOccurred())
199+
Eventually(func() int {
200+
Expect(k8sClient.List(ctx, &foundStatefulSets,
201+
client.InNamespace(testobjects.YdbNamespace),
202+
))
203+
return len(foundStatefulSets.Items)
204+
}, test.Timeout, test.Interval).Should(Equal(1))
189205
})
190206
})
191207
})

0 commit comments

Comments
 (0)