1- package cfn
1+ package cloudformation
22
33import (
44 "bytes"
@@ -97,7 +97,7 @@ func executeCommand(t *testing.T, args ...string) (string, error) {
9797}
9898
9999func TestDeleteStackSetRequiresName (t * testing.T ) {
100- _ , err := executeCommand (t , "cfn " , "delete-stackset" )
100+ _ , err := executeCommand (t , "cloudformation " , "delete-stackset" )
101101 if err == nil || ! strings .Contains (err .Error (), "--stackset-name is required" ) {
102102 t .Fatalf ("expected required name error, got %v" , err )
103103 }
@@ -136,9 +136,9 @@ func TestDeleteStackSetDryRun(t *testing.T) {
136136 func (awssdk.Config ) API { return client },
137137 )
138138
139- output , err := executeCommand (t , "--output" , "json" , "--dry-run" , "cfn " , "delete-stackset" , "--stackset-name" , "stackset-a" )
139+ output , err := executeCommand (t , "--output" , "json" , "--dry-run" , "cloudformation " , "delete-stackset" , "--stackset-name" , "stackset-a" )
140140 if err != nil {
141- t .Fatalf ("execute cfn delete-stackset dry-run: %v" , err )
141+ t .Fatalf ("execute cloudformation delete-stackset dry-run: %v" , err )
142142 }
143143 if deleteInstancesCalls != 0 || deleteStackSetCalls != 0 {
144144 t .Fatalf ("expected no delete calls in dry-run, got instances=%d stackset=%d" , deleteInstancesCalls , deleteStackSetCalls )
@@ -183,9 +183,9 @@ func TestDeleteStackSetNoConfirmExecutes(t *testing.T) {
183183 func (awssdk.Config ) API { return client },
184184 )
185185
186- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "stackset-a" )
186+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "stackset-a" )
187187 if err != nil {
188- t .Fatalf ("execute cfn delete-stackset --no-confirm: %v" , err )
188+ t .Fatalf ("execute cloudformation delete-stackset --no-confirm: %v" , err )
189189 }
190190 if deleteInstancesCalls != 1 || describeOperationCalls != 1 || deleteStackSetCalls != 1 {
191191 t .Fatalf ("unexpected API call counts instances=%d describe=%d stackset=%d" , deleteInstancesCalls , describeOperationCalls , deleteStackSetCalls )
@@ -231,9 +231,9 @@ func TestDeleteStackSetWaitsBeyondLegacyTimeout(t *testing.T) {
231231 func (awssdk.Config ) API { return client },
232232 )
233233
234- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "stackset-a" )
234+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "stackset-a" )
235235 if err != nil {
236- t .Fatalf ("execute cfn delete-stackset with long-running operation: %v" , err )
236+ t .Fatalf ("execute cloudformation delete-stackset with long-running operation: %v" , err )
237237 }
238238 if describeOperationCalls != 200 {
239239 t .Fatalf ("expected operation polling to continue until success, got %d calls" , describeOperationCalls )
@@ -244,7 +244,7 @@ func TestDeleteStackSetWaitsBeyondLegacyTimeout(t *testing.T) {
244244}
245245
246246func TestFindStackByResourceRequiresResource (t * testing.T ) {
247- _ , err := executeCommand (t , "cfn " , "find-stack-by-resource" )
247+ _ , err := executeCommand (t , "cloudformation " , "find-stack-by-resource" )
248248 if err == nil || ! strings .Contains (err .Error (), "--resource is required" ) {
249249 t .Fatalf ("expected required resource error, got %v" , err )
250250 }
@@ -284,9 +284,9 @@ func TestFindStackByResourceMatchesNestedWhenRequested(t *testing.T) {
284284 func (awssdk.Config ) API { return client },
285285 )
286286
287- output , err := executeCommand (t , "--output" , "json" , "cfn " , "find-stack-by-resource" , "--resource" , "AWS::S3::Bucket" , "--exact" , "--include-nested" )
287+ output , err := executeCommand (t , "--output" , "json" , "cloudformation " , "find-stack-by-resource" , "--resource" , "AWS::S3::Bucket" , "--exact" , "--include-nested" )
288288 if err != nil {
289- t .Fatalf ("execute cfn find-stack-by-resource: %v" , err )
289+ t .Fatalf ("execute cloudformation find-stack-by-resource: %v" , err )
290290 }
291291 if ! strings .Contains (output , "parent-stack" ) || ! strings .Contains (output , "nested-stack" ) {
292292 t .Fatalf ("expected both parent and nested matches, output=%s" , output )
@@ -319,7 +319,7 @@ func TestDeleteStackSetUserDeclines(t *testing.T) {
319319 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
320320
321321 // Without --no-confirm, stdin is empty so the prompter reads EOF and returns false (declined).
322- output , err := executeCommand (t , "--output" , "json" , "cfn " , "delete-stackset" , "--stackset-name" , "my-stackset" )
322+ output , err := executeCommand (t , "--output" , "json" , "cloudformation " , "delete-stackset" , "--stackset-name" , "my-stackset" )
323323 if err != nil {
324324 t .Fatalf ("expected no error when user declines, got %v" , err )
325325 }
@@ -339,7 +339,7 @@ func TestDeleteStackSetListInstancesError(t *testing.T) {
339339
340340 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
341341
342- _ , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "my-stackset" )
342+ _ , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "my-stackset" )
343343 if err == nil || ! strings .Contains (err .Error (), "list stack set instances" ) {
344344 t .Fatalf ("expected list instances error, got %v" , err )
345345 }
@@ -363,7 +363,7 @@ func TestDeleteStackSetInstanceDeletionError(t *testing.T) {
363363
364364 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
365365
366- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "my-stackset" )
366+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "my-stackset" )
367367 if err != nil {
368368 t .Fatalf ("command should not return error, got %v" , err )
369369 }
@@ -401,7 +401,7 @@ func TestDeleteStackSetWaitOperationFailure(t *testing.T) {
401401
402402 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
403403
404- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "my-stackset" )
404+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "my-stackset" )
405405 if err != nil {
406406 t .Fatalf ("command should not return error, got %v" , err )
407407 }
@@ -441,7 +441,7 @@ func TestDeleteStackSetDeleteStackSetError(t *testing.T) {
441441
442442 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
443443
444- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "my-stackset" )
444+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "my-stackset" )
445445 if err != nil {
446446 t .Fatalf ("command should not return error, got %v" , err )
447447 }
@@ -469,7 +469,7 @@ func TestDeleteStackSetNoInstances(t *testing.T) {
469469
470470 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
471471
472- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "empty-stackset" )
472+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "empty-stackset" )
473473 if err != nil {
474474 t .Fatalf ("unexpected error: %v" , err )
475475 }
@@ -492,7 +492,7 @@ func TestDeleteStackSetDryRunNoInstances(t *testing.T) {
492492
493493 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
494494
495- output , err := executeCommand (t , "--output" , "json" , "--dry-run" , "cfn " , "delete-stackset" , "--stackset-name" , "empty-stackset" )
495+ output , err := executeCommand (t , "--output" , "json" , "--dry-run" , "cloudformation " , "delete-stackset" , "--stackset-name" , "empty-stackset" )
496496 if err != nil {
497497 t .Fatalf ("unexpected error: %v" , err )
498498 }
@@ -530,7 +530,7 @@ func TestDeleteStackSetEmptyOperationID(t *testing.T) {
530530
531531 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
532532
533- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "my-stackset" )
533+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "my-stackset" )
534534 if err != nil {
535535 t .Fatalf ("unexpected error: %v" , err )
536536 }
@@ -1065,7 +1065,7 @@ func TestFindStackByResourceSubstringMatch(t *testing.T) {
10651065
10661066 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
10671067
1068- output , err := executeCommand (t , "--output" , "json" , "cfn " , "find-stack-by-resource" , "--resource" , "bucket" )
1068+ output , err := executeCommand (t , "--output" , "json" , "cloudformation " , "find-stack-by-resource" , "--resource" , "bucket" )
10691069 if err != nil {
10701070 t .Fatalf ("unexpected error: %v" , err )
10711071 }
@@ -1103,7 +1103,7 @@ func TestFindStackByResourceNoMatches(t *testing.T) {
11031103
11041104 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
11051105
1106- output , err := executeCommand (t , "--output" , "json" , "cfn " , "find-stack-by-resource" , "--resource" , "nonexistent-thing" )
1106+ output , err := executeCommand (t , "--output" , "json" , "cloudformation " , "find-stack-by-resource" , "--resource" , "nonexistent-thing" )
11071107 if err != nil {
11081108 t .Fatalf ("unexpected error: %v" , err )
11091109 }
@@ -1122,7 +1122,7 @@ func TestFindStackByResourceListStacksError(t *testing.T) {
11221122
11231123 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
11241124
1125- _ , err := executeCommand (t , "--output" , "json" , "cfn " , "find-stack-by-resource" , "--resource" , "something" )
1125+ _ , err := executeCommand (t , "--output" , "json" , "cloudformation " , "find-stack-by-resource" , "--resource" , "something" )
11261126 if err == nil || ! strings .Contains (err .Error (), "list stacks" ) {
11271127 t .Fatalf ("expected list stacks error, got %v" , err )
11281128 }
@@ -1144,7 +1144,7 @@ func TestFindStackByResourceListResourcesError(t *testing.T) {
11441144
11451145 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
11461146
1147- _ , err := executeCommand (t , "--output" , "json" , "cfn " , "find-stack-by-resource" , "--resource" , "something" )
1147+ _ , err := executeCommand (t , "--output" , "json" , "cloudformation " , "find-stack-by-resource" , "--resource" , "something" )
11481148 if err == nil || ! strings .Contains (err .Error (), "list resources for stack" ) {
11491149 t .Fatalf ("expected list resources error, got %v" , err )
11501150 }
@@ -1176,7 +1176,7 @@ func TestFindStackByResourceExcludesNestedByDefault(t *testing.T) {
11761176
11771177 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
11781178
1179- output , err := executeCommand (t , "--output" , "json" , "cfn " , "find-stack-by-resource" , "--resource" , "Bucket" )
1179+ output , err := executeCommand (t , "--output" , "json" , "cloudformation " , "find-stack-by-resource" , "--resource" , "Bucket" )
11801180 if err != nil {
11811181 t .Fatalf ("unexpected error: %v" , err )
11821182 }
@@ -1213,7 +1213,7 @@ func TestFindStackByResourceMatchesPhysicalID(t *testing.T) {
12131213
12141214 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
12151215
1216- output , err := executeCommand (t , "--output" , "json" , "cfn " , "find-stack-by-resource" , "--resource" , "prod-users-table" , "--exact" )
1216+ output , err := executeCommand (t , "--output" , "json" , "cloudformation " , "find-stack-by-resource" , "--resource" , "prod-users-table" , "--exact" )
12171217 if err != nil {
12181218 t .Fatalf ("unexpected error: %v" , err )
12191219 }
@@ -1252,7 +1252,7 @@ func TestDeleteStackSetMultipleInstancesPartialFailure(t *testing.T) {
12521252
12531253 withMockDeps (t , defaultMockLoader (), defaultMockClientFactory (client ))
12541254
1255- output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cfn " , "delete-stackset" , "--stackset-name" , "my-stackset" )
1255+ output , err := executeCommand (t , "--output" , "json" , "--no-confirm" , "cloudformation " , "delete-stackset" , "--stackset-name" , "my-stackset" )
12561256 if err != nil {
12571257 t .Fatalf ("command should not return error, got %v" , err )
12581258 }
0 commit comments