forked from aws/copilot-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deploy): refactor deployment input so that app-related informat…
…ion is grouped together (aws#2621) Previously only environment deployment input needs `AppDNSName` and `AppDelegationRole`. Now in order to enable alias for RD service, these information are needed for RD service deployment as well. This PR refactors the `deploy` package to avoid repetitive code that would have been added without the refactoring. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
- Loading branch information
1 parent
b32983c
commit 6a758d5
Showing
17 changed files
with
237 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package deploy | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestAppInformation_DNSDelegationRole(t *testing.T) { | ||
testCases := map[string]struct { | ||
in *AppInformation | ||
want string | ||
}{ | ||
"without tools account ARN": { | ||
want: "", | ||
in: &AppInformation{ | ||
AccountPrincipalARN: "", | ||
DNSName: "ecs.aws", | ||
}, | ||
}, | ||
"without DNS": { | ||
want: "", | ||
in: &AppInformation{ | ||
AccountPrincipalARN: "", | ||
DNSName: "ecs.aws", | ||
}, | ||
}, | ||
"with invalid tools principal": { | ||
want: "", | ||
in: &AppInformation{ | ||
AccountPrincipalARN: "0000000", | ||
DNSName: "ecs.aws", | ||
}, | ||
}, | ||
"with dns and tools principal": { | ||
want: "arn:aws:iam::0000000:role/-DNSDelegationRole", | ||
|
||
in: &AppInformation{ | ||
AccountPrincipalARN: "arn:aws:iam::0000000:root", | ||
DNSName: "ecs.aws", | ||
}, | ||
}, | ||
} | ||
|
||
for name, tc := range testCases { | ||
t.Run(name, func(t *testing.T) { | ||
require.Equal(t, tc.want, tc.in.DNSDelegationRole()) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.