CreateStackWithGUID creates a stack with a random name and returns its name and guid
()
| 73 | |
| 74 | // CreateStackWithGUID creates a stack with a random name and returns its name and guid |
| 75 | func 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 |
| 96 | func DeleteStack(name string) { |
nothing calls this directly
no test coverage detected