Skip to content

Commit e390a02

Browse files
rgee0alexellis
authored andcommitted
Add multiple env vars to describe test table
As env vars are stored in a `map[string]string` the print output of this through describe is non-deterministic. This change introduces a test case that will cause `TestDescribeOuput()` to become flakey as the four env vars could be emitted in a different order each time the test is run. This will be addressed in a future commit which will make env var ordering consistent and repeatable. Signed-off-by: Richard Gee <[email protected]>
1 parent d08553e commit e390a02

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

commands/describe_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,22 @@ func TestDescribeOuput(t *testing.T) {
120120
verbose: false,
121121
expectedOutput: "Name:\tfiglet\nStatus:\tReady\nReplicas:\t0\nAvailable Replicas: 0\nInvocations:\t0\nImage:\topenfaas/figlet:latest\nFunction Process:\t<default>\nUsage:\n\tRAM:\t1024.00 MB\n\tCPU:\t2 Mi\n",
122122
},
123+
{
124+
name: "Multiple env variables",
125+
function: schema.FunctionDescription{
126+
FunctionStatus: types.FunctionStatus{
127+
Name: "figlet",
128+
Image: "openfaas/figlet:latest",
129+
Labels: &map[string]string{"quadrant": "alpha"},
130+
Annotations: &map[string]string{},
131+
EnvVars: map[string]string{"DDD": "ddd", "AAA": "aaa", "BBB": "bbb", "CCC": "ccc"},
132+
Secrets: []string{"db-password"},
133+
},
134+
Status: "Ready",
135+
},
136+
verbose: true,
137+
expectedOutput: "Name:\tfiglet\nStatus:\tReady\nReplicas:\t0\nAvailable Replicas: 0\nInvocations:\t0\nImage:\topenfaas/figlet:latest\nFunction Process:\t<default>\nURL:\t<none>\nAsync URL:\t<none>\nLabels:\n quadrant: alpha\nAnnotations:\t<none>\nConstraints:\t<none>\nEnvironment:\n AAA: aaa\n BBB: bbb\n CCC: ccc\n DDD: ddd\nSecrets:\n - db-password\nRequests:\t<none>\nLimits:\t<none>\nUsage:\t<none>\n",
138+
},
123139
}
124140
for _, tc := range cases {
125141
t.Run(tc.name, func(t *testing.T) {

0 commit comments

Comments
 (0)