Skip to content

Commit

Permalink
Merge pull request #1341 from zhijianli88/cleanup
Browse files Browse the repository at this point in the history
🌱: testing: Cleanup temporary files
  • Loading branch information
k8s-ci-robot committed Feb 18, 2021
2 parents 0b554eb + 3618bd1 commit 2ad142a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ var _ = Describe("Etcd", func() {
// it will timeout, as we'll never see the "startup message" we are waiting
// for on StdErr
Expect(etcd.Start()).To(MatchError(ContainSubstring("timeout")))
// Stop is required to cleanup the temporary directory
Expect(etcd.Stop()).To(Succeed())

Expect(stdout.String()).To(ContainSubstring("Member:"))
Expect(stderr.String()).To(ContainSubstring("Usage:"))
Expand Down
8 changes: 5 additions & 3 deletions pkg/webhook/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ var _ = Describe("Webhook Server", func() {
testHostPort string
client *http.Client
server *webhook.Server
servingOpts envtest.WebhookInstallOptions
)

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

servingOpts := envtest.WebhookInstallOptions{}
servingOpts = envtest.WebhookInstallOptions{}
Expect(servingOpts.PrepWithoutInstalling()).To(Succeed())

testHostPort = net.JoinHostPort(servingOpts.LocalServingHost, fmt.Sprintf("%d", servingOpts.LocalServingPort))
Expand All @@ -62,8 +63,9 @@ var _ = Describe("Webhook Server", func() {
Port: servingOpts.LocalServingPort,
CertDir: servingOpts.LocalServingCertDir,
}

// TODO(directxman12): cleanup generated certificate dir, etc
})
AfterEach(func() {
Expect(servingOpts.Cleanup()).To(Succeed())
})

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

0 comments on commit 2ad142a

Please sign in to comment.