...
1 package entrypoint
2
3 import (
4 "os"
5 "testing"
6
7 "github.com/stretchr/testify/assert"
8 )
9
10 func TestGetEnvoyFlags(t *testing.T) {
11 foundFlag := false
12 foundValue := false
13
14 os.Setenv("ENVOY_CONCURRENCY", "4")
15
16 flags := GetEnvoyFlags()
17 for idx, flag := range flags {
18 if flag == "--concurrency" {
19 foundFlag = true
20 t.Logf("flags[idx] = %v", flags[idx])
21 if idx+1 < len(flags) && flags[idx+1] == "4" {
22 foundValue = true
23 }
24 break
25 }
26 }
27
28 os.Setenv("ENVOY_CONCURRENCY", "")
29
30 assert.True(t, foundFlag)
31 assert.True(t, foundValue)
32 }
33
View as plain text