Skip to content

Commit

Permalink
Added unit tests for logger initialization fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vikasmb committed Jul 12, 2022
1 parent 6234c46 commit b186b76
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/utils/logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ func TestEnvLogFilePath(t *testing.T) {
assert.Equal(t, path, GetLogLocation())
}

func TestLoggerGetSameInstance(t *testing.T) {
log1 := Get()
log2 := Get()

assert.True(t, log1 == log2)
}

func TestLoggerNewAndGetSameInstance(t *testing.T) {
logConfig := LoadLogConfig()
log1 := New(logConfig)
log2 := Get()

assert.True(t, log1 == log2)
}

func TestGetLogFileLocationReturnsDefaultPath(t *testing.T) {
defaultPath := "/host/var/log/aws-routed-eni/ipamd.log"
assert.Equal(t, defaultPath, GetLogLocation())
Expand Down

0 comments on commit b186b76

Please sign in to comment.