Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8657670
Add state field to cf stacks command
simonjjones Dec 1, 2025
ca7c432
Remove state validation from cf state command
simonjjones Dec 2, 2025
fcc41cd
Add state output to cf stacks command
simonjjones Dec 2, 2025
3516b13
first pass of update-stack command
simonjjones Dec 8, 2025
b29d390
Include reference to state in help text for cf stack & stacks
simonjjones Dec 9, 2025
c4e4734
Add update stack command integration tests
simonjjones Dec 9, 2025
0ddeb16
Stack related fakes generated correctly by counterfeiter
simonjjones Jan 20, 2026
cd08e31
Merge branch 'v8' into v8-stack-management
simonjjones Jan 20, 2026
6df05cc
Add update-stack to help categories in APPS section
simonjjones Jan 20, 2026
64ec3ed
Add parentheses and spaces to update-stack usage command
simonjjones Jan 28, 2026
e44f012
Add minimum API version check for update-stack command (3.210.0)
simonjjones Jan 30, 2026
b6ba7fa
Add assertions for state output in stack command tests
simonjjones Feb 2, 2026
91633b1
Merge branch 'v8' into v8-stack-management
simonjjones Feb 2, 2026
4be6183
Merge branch 'v8' into v8-stack-management
anujc25 Feb 4, 2026
dd3c6fe
Fix indentation in help_all_display.go APPS section
simonjjones Feb 9, 2026
f70d30c
Merge branch 'v8' into v8-stack-management
simonjjones Feb 9, 2026
88c243e
Merge branch 'v8' into v8-stack-management
anujc25 Feb 11, 2026
121e124
Merge branch 'v8' into v8-stack-management
anujc25 Feb 11, 2026
0b5dfda
Update stack and stacks integration test expectations for state support
simonjjones Feb 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions actor/v7action/cloud_controller_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ type CloudControllerClient interface {
GetAppFeature(appGUID string, featureName string) (resources.ApplicationFeature, ccv3.Warnings, error)
GetStacks(query ...ccv3.Query) ([]resources.Stack, ccv3.Warnings, error)
GetStagingSecurityGroups(spaceGUID string, queries ...ccv3.Query) ([]resources.SecurityGroup, ccv3.Warnings, error)
UpdateStack(stackGUID string, state string) (resources.Stack, ccv3.Warnings, error)
GetTask(guid string) (resources.Task, ccv3.Warnings, error)
GetUser(userGUID string) (resources.User, ccv3.Warnings, error)
GetUsers(query ...ccv3.Query) ([]resources.User, ccv3.Warnings, error)
Expand Down
9 changes: 9 additions & 0 deletions actor/v7action/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ func (actor Actor) GetStacks(labelSelector string) ([]resources.Stack, Warnings,

return stacks, Warnings(warnings), nil
}

func (actor Actor) UpdateStack(stackGUID string, state string) (resources.Stack, Warnings, error) {
stack, warnings, err := actor.CloudControllerClient.UpdateStack(stackGUID, state)
if err != nil {
return resources.Stack{}, Warnings(warnings), err
}

return stack, Warnings(warnings), nil
}
104 changes: 103 additions & 1 deletion actor/v7action/stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var _ = Describe("Stack", func() {

Context("there are no errors", func() {

When("the stack exists", func() {
When("the stack exists without state", func() {
expectedStack := resources.Stack{
GUID: "some-stack-guid",
Name: "some-stack-name",
Expand Down Expand Up @@ -98,6 +98,43 @@ var _ = Describe("Stack", func() {
Expect(stack.GUID).To(Equal(expectedStack.GUID))
Expect(stack.Name).To(Equal(expectedStack.Name))
Expect(stack.Description).To(Equal(expectedStack.Description))
Expect(stack.State).To(Equal(""))
Expect(err).To(BeNil())
Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
})
})

When("the stack exists with state", func() {
expectedStack := resources.Stack{
GUID: "some-stack-guid",
Name: "some-stack-name",
Description: "Some stack desc",
State: "ACTIVE",
}

expectedParams := []ccv3.Query{
{Key: ccv3.NameFilter, Values: []string{"some-stack-name"}},
{Key: ccv3.PerPage, Values: []string{"1"}},
{Key: ccv3.Page, Values: []string{"1"}},
}

BeforeEach(func() {
fakeCloudControllerClient.GetStacksReturns(
[]resources.Stack{expectedStack},
ccv3.Warnings{"warning-1", "warning-2"},
nil,
)
})

It("returns the desired stack with state", func() {

actualParams := fakeCloudControllerClient.GetStacksArgsForCall(0)
Expect(actualParams).To(Equal(expectedParams))
Expect(fakeCloudControllerClient.GetStacksCallCount()).To(Equal(1))
Expect(stack.GUID).To(Equal(expectedStack.GUID))
Expect(stack.Name).To(Equal(expectedStack.Name))
Expect(stack.Description).To(Equal(expectedStack.Description))
Expect(stack.State).To(Equal(resources.StackStateActive))
Expect(err).To(BeNil())
Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
})
Expand Down Expand Up @@ -196,4 +233,69 @@ var _ = Describe("Stack", func() {
})
})
})

Describe("UpdateStack", func() {
var (
stackGUID string
state string
stack resources.Stack
warnings Warnings
executeErr error
)

BeforeEach(func() {
stackGUID = "some-stack-guid"
state = "DEPRECATED"
})

JustBeforeEach(func() {
stack, warnings, executeErr = actor.UpdateStack(stackGUID, state)
})

When("the cloud controller request is successful", func() {
BeforeEach(func() {
fakeCloudControllerClient.UpdateStackReturns(
resources.Stack{
GUID: "some-stack-guid",
Name: "some-stack",
Description: "some description",
State: "DEPRECATED",
},
ccv3.Warnings{"warning-1", "warning-2"},
nil,
)
})

It("returns the updated stack and warnings", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
Expect(stack).To(Equal(resources.Stack{
GUID: "some-stack-guid",
Name: "some-stack",
Description: "some description",
State: "DEPRECATED",
}))

Expect(fakeCloudControllerClient.UpdateStackCallCount()).To(Equal(1))
actualGUID, actualState := fakeCloudControllerClient.UpdateStackArgsForCall(0)
Expect(actualGUID).To(Equal(stackGUID))
Expect(actualState).To(Equal(state))
})
})

When("the cloud controller request fails", func() {
BeforeEach(func() {
fakeCloudControllerClient.UpdateStackReturns(
resources.Stack{},
ccv3.Warnings{"warning-1"},
errors.New("some-error"),
)
})

It("returns the error and warnings", func() {
Expect(executeErr).To(MatchError("some-error"))
Expect(warnings).To(ConsistOf("warning-1"))
})
})
})
})
Loading
Loading