summaryrefslogtreecommitdiff
path: root/container
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2023-08-15 14:24:43 +0200
committerValery Piashchynski <[email protected]>2023-08-15 14:24:43 +0200
commit80f25698ba5563202ae48078a5c9fe71c1b42b5d (patch)
tree4992317d90ef5262f505e550ade1ff4c96872541 /container
parent00d24df903004641c739f83e755cf1800c3c81a4 (diff)
chore: update config tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'container')
-rw-r--r--container/config_test.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/container/config_test.go b/container/config_test.go
index fdc81fce..da3ca74a 100644
--- a/container/config_test.go
+++ b/container/config_test.go
@@ -15,9 +15,12 @@ func TestNewConfig_SuccessfulReading(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, c)
+ ll, err := container.ParseLogLevel(c.LogLevel)
+ assert.NoError(t, err)
+
assert.Equal(t, time.Second*10, c.GracePeriod)
assert.True(t, c.PrintGraph)
- assert.Equal(t, slog.LevelWarn, c.LogLevel)
+ assert.Equal(t, slog.LevelWarn, ll.Level())
}
func TestNewConfig_WithoutEndureKey(t *testing.T) {
@@ -28,9 +31,12 @@ func TestNewConfig_WithoutEndureKey(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, c)
+ ll, err := container.ParseLogLevel(c.LogLevel)
+ assert.NoError(t, err)
+
assert.Equal(t, time.Second*30, c.GracePeriod)
assert.False(t, c.PrintGraph)
- assert.Equal(t, slog.LevelError, c.LogLevel)
+ assert.Equal(t, slog.LevelError, ll.Level())
}
func TestNewConfig_LoggingLevels(t *testing.T) {
@@ -53,15 +59,16 @@ func TestNewConfig_LoggingLevels(t *testing.T) {
assert.NoError(t, cfgPlugin.Init())
c, err := container.NewConfig(tt.path)
+ assert.NotNil(t, c)
+ ll, err2 := container.ParseLogLevel(c.LogLevel)
if tt.wantError {
- assert.Nil(t, c)
- assert.Error(t, err)
- assert.Contains(t, err.Error(), "unknown log level")
+ assert.Error(t, err2)
+ assert.Contains(t, err2.Error(), "unknown log level")
} else {
assert.NoError(t, err)
- assert.NotNil(t, c)
- assert.Equal(t, tt.wantLevel, c.LogLevel)
+ assert.NoError(t, err2)
+ assert.Equal(t, tt.wantLevel, ll.Level())
}
})
}