1
1
package internal
2
2
3
3
import (
4
+ "log/slog"
4
5
"testing"
5
6
"time"
6
7
@@ -17,6 +18,7 @@ func TestConfig_defaults(t *testing.T) {
17
18
assert .Equal (t , 3000 , c .TargetPort )
18
19
assert .Equal (t , "echo" , c .UpstreamCommand )
19
20
assert .Equal (t , defaultCacheSize , c .CacheSizeBytes )
21
+ assert .Equal (t , slog .LevelInfo , c .LogLevel )
20
22
}
21
23
22
24
func TestConfig_override_defaults_with_env_vars (t * testing.T ) {
@@ -25,6 +27,7 @@ func TestConfig_override_defaults_with_env_vars(t *testing.T) {
25
27
usingEnvVar (t , "CACHE_SIZE" , "256" )
26
28
usingEnvVar (t , "HTTP_READ_TIMEOUT" , "5" )
27
29
usingEnvVar (t , "X_SENDFILE_ENABLED" , "0" )
30
+ usingEnvVar (t , "DEBUG" , "1" )
28
31
29
32
c , err := NewConfig ()
30
33
require .NoError (t , err )
@@ -33,6 +36,7 @@ func TestConfig_override_defaults_with_env_vars(t *testing.T) {
33
36
assert .Equal (t , 256 , c .CacheSizeBytes )
34
37
assert .Equal (t , 5 * time .Second , c .HttpReadTimeout )
35
38
assert .Equal (t , false , c .XSendfileEnabled )
39
+ assert .Equal (t , slog .LevelDebug , c .LogLevel )
36
40
}
37
41
38
42
func TestConfig_return_error_when_no_upstream_command (t * testing.T ) {
0 commit comments