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

Function CreateStackWithGUID

integration/helpers/stack.go:75–93  ·  view source on GitHub ↗

CreateStackWithGUID creates a stack with a random name and returns its name and guid

()

Source from the content-addressed store, hash-verified

73
74// CreateStackWithGUID creates a stack with a random name and returns its name and guid
75func CreateStackWithGUID() (string, string) {
76 type StackStruct struct {
77 GUID string `json:"guid"`
78 }
79 name := NewStackName()
80 requestBody := fmt.Sprintf(
81 `{"name":"%s","description":"CF CLI integration test stack, please delete"}`,
82 name,
83 )
84 session := CF("curl", "-X", "POST", "/v3/stacks", "-d", requestBody)
85
86 Eventually(session).Should(Exit(0))
87 thisStack := StackStruct{}
88 err := json.Unmarshal(session.Out.Contents(), &thisStack)
89 Expect(err).ToNot(HaveOccurred())
90 stackGUID := thisStack.GUID
91 Expect(len(stackGUID)).ToNot(Equal(0))
92 return name, stackGUID
93}
94
95// DeleteStack deletes a specific stack
96func DeleteStack(name string) {

Callers

nothing calls this directly

Calls 2

NewStackNameFunction · 0.85
CFFunction · 0.85

Tested by

no test coverage detected