@@ -148,6 +148,7 @@ var _ = Describe("Stacks", func() {
148148 var (
149149 stackGUID string
150150 state string
151+ reason string
151152 stack resources.Stack
152153 warnings Warnings
153154 err error
@@ -156,10 +157,11 @@ var _ = Describe("Stacks", func() {
156157 BeforeEach (func () {
157158 stackGUID = "some-stack-guid"
158159 state = "DEPRECATED"
160+ reason = ""
159161 })
160162
161163 JustBeforeEach (func () {
162- stack , warnings , err = client .UpdateStack (stackGUID , state )
164+ stack , warnings , err = client .UpdateStack (stackGUID , state , reason )
163165 })
164166
165167 When ("the request succeeds" , func () {
@@ -192,6 +194,40 @@ var _ = Describe("Stacks", func() {
192194 })
193195 })
194196
197+ When ("a reason is provided" , func () {
198+ BeforeEach (func () {
199+ reason = "Use cflinuxfs4 instead"
200+ server .AppendHandlers (
201+ CombineHandlers (
202+ VerifyRequest (http .MethodPatch , "/v3/stacks/some-stack-guid" ),
203+ VerifyJSONRepresenting (map [string ]string {
204+ "state" : "DEPRECATED" ,
205+ "state_reason" : "Use cflinuxfs4 instead" ,
206+ }),
207+ RespondWith (http .StatusOK , `{
208+ "guid": "some-stack-guid",
209+ "name": "some-stack",
210+ "description": "some description",
211+ "state": "DEPRECATED",
212+ "state_reason": "Use cflinuxfs4 instead"
213+ }` , http.Header {"X-Cf-Warnings" : {"this is a warning" }}),
214+ ),
215+ )
216+ })
217+
218+ It ("returns the updated stack with reason and warnings" , func () {
219+ Expect (err ).ToNot (HaveOccurred ())
220+ Expect (warnings ).To (ConsistOf ("this is a warning" ))
221+ Expect (stack ).To (Equal (resources.Stack {
222+ GUID : "some-stack-guid" ,
223+ Name : "some-stack" ,
224+ Description : "some description" ,
225+ State : "DEPRECATED" ,
226+ StateReason : "Use cflinuxfs4 instead" ,
227+ }))
228+ })
229+ })
230+
195231 When ("the cloud controller returns an error" , func () {
196232 BeforeEach (func () {
197233 server .AppendHandlers (
0 commit comments