Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a2237de
Add state field to cf stacks command
simonjjones Dec 1, 2025
1827f97
Remove state validation from cf state command
simonjjones Dec 2, 2025
9f10480
Add state output to cf stacks command
simonjjones Dec 2, 2025
07ab545
first pass of update-stack command
simonjjones Dec 8, 2025
101bb7c
Include reference to state in help text for cf stack & stacks
simonjjones Dec 9, 2025
f91cd68
Add update stack command integration tests
simonjjones Dec 9, 2025
7896700
Stack related fakes generated correctly by counterfeiter
simonjjones Jan 20, 2026
2f763f6
Fix import paths from v8 to v9 for module compatibility
simonjjones Jan 20, 2026
b755057
Add update-stack command to help categories
simonjjones Jan 20, 2026
f4b7e82
Add parentheses and spaces to update-stack usage command
simonjjones Jan 28, 2026
09c4d6d
Configure minimum CC API version for update-stack command
simonjjones Jan 30, 2026
b074828
Add assertions for state output in stack command tests
simonjjones Feb 2, 2026
205e53f
Merge branch 'main' into stack-management
simonjjones Feb 2, 2026
333b67b
Merge branch 'main' into stack-management
anujc25 Feb 4, 2026
c226add
Fix indentation in help_all_display.go APPS section
simonjjones Feb 9, 2026
911e6b3
Merge branch 'main' into stack-management
simonjjones Feb 10, 2026
cd81f87
Merge branch 'main' into stack-management
anujc25 Feb 11, 2026
d8b1342
Update stack and stacks integration test expectations for state support
simonjjones Feb 12, 2026
53d08fd
Add state_reason field to stack resource and display logic
simonjjones Feb 5, 2026
97ae116
Add --reason flag to update-stack command
simonjjones Feb 5, 2026
02da1f4
Update --reason flag usage example with detailed migration message
simonjjones Feb 5, 2026
8d8820c
Show reason field for non-active stack states and fix UpdateStack int…
simonjjones Feb 12, 2026
d7f3fd8
Add integration tests for stack reason display scenarios
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, reason 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, reason string) (resources.Stack, Warnings, error) {
stack, warnings, err := actor.CloudControllerClient.UpdateStack(stackGUID, state, reason)
if err != nil {
return resources.Stack{}, Warnings(warnings), err
}

return stack, Warnings(warnings), nil
}
107 changes: 106 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,72 @@ var _ = Describe("Stack", func() {
})
})
})

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

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

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

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, actualReason := fakeCloudControllerClient.UpdateStackArgsForCall(0)
Expect(actualGUID).To(Equal(stackGUID))
Expect(actualState).To(Equal(state))
Expect(actualReason).To(Equal(reason))
})
})

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