Skip to content

Commit

Permalink
Fix bug in Logger test where it creates file but doesn't delete (thra…
Browse files Browse the repository at this point in the history
  • Loading branch information
shazbert authored and thrasher- committed Jan 23, 2019
1 parent 7413fc4 commit b62a9c7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ func TestSetupOutputsValidPath(t *testing.T) {
if err != nil {
t.Fatalf("SetupOutputs failed expected nil got %v", err)
}
os.Remove(path.Join(LogPath, Logger.File))

err = CloseLogFile()
if err != nil {
t.Fatalf("CloseLogFile failed with %v", err)
}

err = os.Remove(path.Join(LogPath, Logger.File))
if err != nil {
t.Fatal("Test Failed - SetupOutputsValidPath() error could not remove test file", err)
}
}

func TestSetupOutputsInValidPath(t *testing.T) {
Expand All @@ -48,7 +57,10 @@ func TestSetupOutputsInValidPath(t *testing.T) {
t.Fatalf("SetupOutputs failed expected %v got %v", os.ErrNotExist, err)
}
}
os.Remove(path.Join(LogPath, Logger.File))
err = os.Remove(path.Join(LogPath, Logger.File))
if err == nil {
t.Fatal("Test Failed - SetupOutputsInValidPath() error cannot be nil")
}
}

func BenchmarkDebugf(b *testing.B) {
Expand Down

0 comments on commit b62a9c7

Please sign in to comment.