MCPcopy
hub / github.com/cloudfoundry/cli / CreateStack

Function CreateStack

integration/helpers/stack.go:53–72  ·  view source on GitHub ↗

CreateStack creates a new stack with the user provided name. If a name is not provided, a random name is used

(names ...string)

Source from the content-addressed store, hash-verified

51
52// CreateStack creates a new stack with the user provided name. If a name is not provided, a random name is used
53func CreateStack(names ...string) string {
54 var name string
55
56 if len(names) > 0 {
57 name = names[0]
58 } else {
59 name = NewStackName()
60 }
61
62 requestBody := fmt.Sprintf(
63 `{"name":"%s","description":"CF CLI integration test stack, please delete"}`,
64 name,
65 )
66 session := CF("curl", "-v", "-X", "POST", "/v3/stacks", "-d", requestBody)
67
68 Eventually(session).Should(Say("201 Created"))
69 Eventually(session).Should(Exit(0))
70
71 return name
72}
73
74// CreateStackWithGUID creates a stack with a random name and returns its name and guid
75func CreateStackWithGUID() (string, string) {

Calls 2

NewStackNameFunction · 0.85
CFFunction · 0.85

Tested by

no test coverage detected