MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / TestShowAPIBuildVersion

Function TestShowAPIBuildVersion

tests/src/integration/integration_test.go:355–374  ·  view source on GitHub ↗

Test case to show api build version using property file.

(t *testing.T)

Source from the content-addressed store, hash-verified

353
354// Test case to show api build version using property file.
355func TestShowAPIBuildVersion(t *testing.T) {
356 common.CreateFile(tmpProp)
357
358 os.Setenv("WSK_CONFIG_FILE", tmpProp)
359 assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.")
360
361 stdout, err := wsk.RunCommand("property", "set", "--apihost", wsk.Wskprops.APIHost,
362 "--apiversion", wsk.Wskprops.Apiversion)
363 assert.Equal(t, nil, err, "The command property set --apihost --apiversion failed to run.")
364 stdout, err = wsk.RunCommand("property", "get", "-i", "--apibuild")
365 assert.Equal(t, nil, err, "The command property get -i --apibuild failed to run.")
366 println(common.RemoveRedundantSpaces(string(stdout)))
367 assert.NotContains(t, common.RemoveRedundantSpaces(string(stdout)), common.PropDisplayAPIBuild+" Unknown",
368 "The output of the command property get --apibuild does not contain "+common.PropDisplayAPIBuild+" Unknown")
369 assert.NotContains(t, common.RemoveRedundantSpaces(string(stdout)), "Unable to obtain API build information",
370 "The output of the command property get --apibuild does not contain \"Unable to obtain API build information\".")
371 assert.Contains(t, common.RemoveRedundantSpaces(string(stdout)), common.PropDisplayAPIBuild+" 20",
372 "The output of the command property get --apibuild does not contain"+common.PropDisplayAPIBuild+" 20")
373 common.DeleteFile(tmpProp)
374}
375
376// Test case to fail to show api build when setting apihost to bogus value.
377func TestFailShowAPIBuildVersion(t *testing.T) {

Callers

nothing calls this directly

Calls 4

CreateFileFunction · 0.92
RemoveRedundantSpacesFunction · 0.92
DeleteFileFunction · 0.92
RunCommandMethod · 0.80

Tested by

no test coverage detected