Skip to content

Commit 99c47ca

Browse files
committed
clean testdata after running unit tests
1 parent 7d0e774 commit 99c47ca

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

admission-webhook/main_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,6 @@ func Test_env_bool(t *testing.T) {
148148
func TestMain(m *testing.M) {
149149
GenerateTestCertAndKey()
150150
code := m.Run() // run tests
151+
ClearTestdata()
151152
os.Exit(code)
152153
}

admission-webhook/utils_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,7 @@ func GenerateTestCertAndKey() {
162162
pem.Encode(keyFile, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: keyBytes})
163163
keyFile.Close()
164164
}
165+
166+
func ClearTestdata() {
167+
os.RemoveAll("testdata")
168+
}

0 commit comments

Comments
 (0)