@@ -169,6 +169,11 @@ func TestStackReadUpdateDelete(t *testing.T) {
169
169
170
170
stackUpdated , err := client .Stacks .Update (ctx , stack .ID , StackUpdateOptions {
171
171
Description : String ("updated description" ),
172
+ VCSRepo : & StackVCSRepoOptions {
173
+ Identifier : "brandonc/pet-nulls-stack" ,
174
+ OAuthTokenID : oauthClient .OAuthTokens [0 ].ID ,
175
+ Branch : "main" ,
176
+ },
172
177
})
173
178
174
179
require .NoError (t , err )
@@ -186,6 +191,52 @@ func TestStackReadUpdateDelete(t *testing.T) {
186
191
require .Nil (t , stackReadAfterDelete )
187
192
}
188
193
194
+ func TestStackRemoveVCSBacking (t * testing.T ) {
195
+ skipUnlessBeta (t )
196
+
197
+ client := testClient (t )
198
+ ctx := context .Background ()
199
+
200
+ orgTest , orgTestCleanup := createOrganization (t , client )
201
+ t .Cleanup (orgTestCleanup )
202
+
203
+ oauthClient , cleanup := createOAuthClient (t , client , orgTest , nil )
204
+ t .Cleanup (cleanup )
205
+
206
+ stack , err := client .Stacks .Create (ctx , StackCreateOptions {
207
+ Name : "test-stack" ,
208
+ VCSRepo : & StackVCSRepoOptions {
209
+ Identifier : "brandonc/pet-nulls-stack" ,
210
+ OAuthTokenID : oauthClient .OAuthTokens [0 ].ID ,
211
+ Branch : "main" ,
212
+ },
213
+ Project : & Project {
214
+ ID : orgTest .DefaultProject .ID ,
215
+ },
216
+ })
217
+
218
+ require .NoError (t , err )
219
+ require .NotNil (t , stack )
220
+ require .NotEmpty (t , stack .VCSRepo .Identifier )
221
+ require .NotEmpty (t , stack .VCSRepo .OAuthTokenID )
222
+ require .NotEmpty (t , stack .VCSRepo .Branch )
223
+
224
+ stackRead , err := client .Stacks .Read (ctx , stack .ID , nil )
225
+ require .NoError (t , err )
226
+ require .Equal (t , stack .VCSRepo .Identifier , stackRead .VCSRepo .Identifier )
227
+ require .Equal (t , stack .VCSRepo .OAuthTokenID , stackRead .VCSRepo .OAuthTokenID )
228
+ require .Equal (t , stack .VCSRepo .Branch , stackRead .VCSRepo .Branch )
229
+
230
+ assert .Equal (t , stack , stackRead )
231
+
232
+ stackUpdated , err := client .Stacks .Update (ctx , stack .ID , StackUpdateOptions {
233
+ VCSRepo : nil ,
234
+ })
235
+
236
+ require .NoError (t , err )
237
+ require .Nil (t , stackUpdated .VCSRepo )
238
+ }
239
+
189
240
func TestStackReadUpdateForceDelete (t * testing.T ) {
190
241
skipUnlessBeta (t )
191
242
@@ -226,6 +277,11 @@ func TestStackReadUpdateForceDelete(t *testing.T) {
226
277
227
278
stackUpdated , err := client .Stacks .Update (ctx , stack .ID , StackUpdateOptions {
228
279
Description : String ("updated description" ),
280
+ VCSRepo : & StackVCSRepoOptions {
281
+ Identifier : "brandonc/pet-nulls-stack" ,
282
+ OAuthTokenID : oauthClient .OAuthTokens [0 ].ID ,
283
+ Branch : "main" ,
284
+ },
229
285
})
230
286
231
287
require .NoError (t , err )
0 commit comments