Skip to content

Commit ed4baf8

Browse files
authored
fix: fix test leaking file (#114)
1 parent b6eb32d commit ed4baf8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

integration/docker_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ func TestDocker(t *testing.T) {
425425
HostKeyPath: regKeyPath,
426426
Image: integrationtest.UbuntuImage,
427427
TLSPort: strconv.Itoa(registryAddr.Port),
428+
PasswordDir: dir,
429+
Username: "user",
430+
Password: "password",
428431
})
429432

430433
envs := []string{

integration/integrationtest/os.go

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ func TmpDir(t *testing.T) string {
1717
tmpdir, err := os.MkdirTemp("", strings.ReplaceAll(t.Name(), "/", "_"))
1818
require.NoError(t, err)
1919
t.Logf("using tmpdir %s", tmpdir)
20+
t.Cleanup(func() {
21+
if !t.Failed() {
22+
// Could be useful in case of test failure.
23+
_ = os.RemoveAll(tmpdir)
24+
}
25+
})
2026
return tmpdir
2127
}
2228

0 commit comments

Comments
 (0)