@@ -10,13 +10,13 @@ import (
10
10
)
11
11
12
12
func TestLookup (t * testing.T ) {
13
+ defer os .Clearenv ()
13
14
t .Setenv ("HTTP_ADDR" , "0.0.0.0" )
14
15
t .Setenv ("HTTP_PORT" , "8080" )
15
16
t .Setenv ("DEBUG_MODE" , "1" )
16
17
t .Setenv ("HTTP_TIMEOUT" , "30s" )
17
18
t .Setenv ("HTTP_RESERVED_CONTENT_TYPES" , "text/plain,application/json" )
18
19
t .Setenv ("HTTP_RESERVED_STATUS_CODES" , "401,429,503" )
19
- defer os .Clearenv ()
20
20
21
21
gotString := env .Lookup ("HTTP_ADDR" , "127.0.0.1" )
22
22
require .Equal (t , "0.0.0.0" , gotString )
@@ -38,14 +38,14 @@ func TestLookup(t *testing.T) {
38
38
}
39
39
40
40
func TestLookupDefaultValue (t * testing.T ) {
41
+ defer os .Clearenv ()
41
42
t .Setenv ("HTTP_ADDR" , "" )
42
43
t .Setenv ("HTTP_PORT" , "invalid-value" )
43
44
t .Setenv ("DEBUG_MODE" , "invalid-value" )
44
45
t .Setenv ("HTTP_TIMEOUT" , "invalid-value" )
45
46
t .Setenv ("HTTP_RESERVED_CONTENT_TYPES" , "" )
46
47
t .Setenv ("HTTP_RESERVED_STATUS_CODES" , "" )
47
48
t .Setenv ("RANGE_OF_RETRY_BACKOFF_SECONDS" , "10,20,30a" )
48
- defer os .Clearenv ()
49
49
50
50
got := env .Lookup ("AGENT_MODE" , true )
51
51
require .Equal (t , true , got )
0 commit comments