Skip to content

Commit a8374c5

Browse files
committed
clean testdata after running unit tests
1 parent 0cc2bc4 commit a8374c5

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
@@ -90,5 +90,6 @@ func Test_env_int(t *testing.T) {
9090
func TestMain(m *testing.M) {
9191
GenerateTestCertAndKey()
9292
code := m.Run() // run tests
93+
ClearTestdata()
9394
os.Exit(code)
9495
}

admission-webhook/utils_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,7 @@ func GenerateTestCertAndKey() {
148148
pem.Encode(keyFile, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: keyBytes})
149149
keyFile.Close()
150150
}
151+
152+
func ClearTestdata() {
153+
os.RemoveAll("testdata")
154+
}

0 commit comments

Comments
 (0)