Skip to content

Commit

Permalink
Clean files during tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored and traefiker committed Mar 18, 2019
1 parent 5d050ae commit e271378
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pkg/middlewares/accesslog/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ func TestLogRotation(t *testing.T) {
if err != nil {
t.Fatalf("Error setting up temporary directory: %s", err)
}
defer os.RemoveAll(tempDir)

fileName := tempDir + "traefik.log"
fileName := filepath.Join(tempDir, "traefik.log")
rotatedFileName := fileName + ".rotated"

config := &types.AccessLog{FilePath: fileName, Format: CommonFormat}
Expand Down Expand Up @@ -585,6 +586,7 @@ func captureStdout(t *testing.T) (out *os.File, restoreStdout func()) {

restoreStdout = func() {
os.Stdout = original
os.RemoveAll(file.Name())
}

return file, restoreStdout
Expand Down
4 changes: 2 additions & 2 deletions pkg/provider/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func createProvider(t *testing.T, test ProvideTestCase, watch bool) (*Provider,
}

return provider, func() {
os.Remove(tempDir)
os.RemoveAll(tempDir)
}
}

Expand Down Expand Up @@ -340,7 +340,7 @@ func createTLS(n int) string {

func TestTLSContent(t *testing.T) {
tempDir := createTempDir(t, "testdir")
defer os.Remove(tempDir)
defer os.RemoveAll(tempDir)

fileTLS := createRandomFile(t, tempDir, "CONTENT")
fileConfig := createRandomFile(t, tempDir, `
Expand Down

0 comments on commit e271378

Please sign in to comment.