Skip to content

Commit 3618bd1

Browse files
committed
testing: cleanup the temproary certs
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
1 parent c4870a4 commit 3618bd1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/webhook/server_test.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ var _ = Describe("Webhook Server", func() {
3737
testHostPort string
3838
client *http.Client
3939
server *webhook.Server
40+
servingOpts envtest.WebhookInstallOptions
4041
)
4142

4243
BeforeEach(func() {
4344
ctx, ctxCancel = context.WithCancel(context.Background())
4445
// closed in indivual tests differently
4546

46-
servingOpts := envtest.WebhookInstallOptions{}
47+
servingOpts = envtest.WebhookInstallOptions{}
4748
Expect(servingOpts.PrepWithoutInstalling()).To(Succeed())
4849

4950
testHostPort = net.JoinHostPort(servingOpts.LocalServingHost, fmt.Sprintf("%d", servingOpts.LocalServingPort))
@@ -62,8 +63,9 @@ var _ = Describe("Webhook Server", func() {
6263
Port: servingOpts.LocalServingPort,
6364
CertDir: servingOpts.LocalServingCertDir,
6465
}
65-
66-
// TODO(directxman12): cleanup generated certificate dir, etc
66+
})
67+
AfterEach(func() {
68+
Expect(servingOpts.Cleanup()).To(Succeed())
6769
})
6870

6971
startServer := func() (done <-chan struct{}) {

0 commit comments

Comments
 (0)