Skip to content

Commit 60e8643

Browse files
authored
Merge pull request #135 from carapace-sh/test-root
test root aws command
2 parents 1a988fe + bcd0d8c commit 60e8643

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/aws.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
cmd/carapace-aws/carapace-aws.test
3232
retention-days: 1
3333

34+
_: {needs: build, uses: ./.github/workflows/aws-template.yml, with: {service: _}} # root
35+
3436
accessanalyzer: {needs: build, uses: ./.github/workflows/aws-template.yml, with: {service: accessanalyzer}}
3537
account: {needs: build, uses: ./.github/workflows/aws-template.yml, with: {service: account}}
3638
acm: {needs: build, uses: ./.github/workflows/aws-template.yml, with: {service: acm}}

cmd/carapace-aws/main_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,27 @@ func TestService(t *testing.T) {
2727
defer os.Remove(testFile.Name())
2828

2929
serviceToTest := os.Getenv("SERVICE")
30+
31+
if serviceToTest == "" || serviceToTest == "_" {
32+
fmt.Printf("\033[2m# %v\033[0m\n", "_")
33+
34+
patch := carapace.DiffPatch(
35+
bridge.ActionAws("aws"),
36+
bridge.ActionCarapace("carapace-aws").Chdir(testDir),
37+
carapace.NewContext(""),
38+
)
39+
for _, line := range patch {
40+
switch {
41+
case strings.HasPrefix(line, "-"):
42+
fmt.Printf("\033[0;31m%v\033[0m\n", line)
43+
t.Fail()
44+
case strings.HasPrefix(line, "+"):
45+
fmt.Printf("\033[0;32m%v\033[0m\n", line)
46+
t.Fail()
47+
}
48+
}
49+
}
50+
3051
for service := range botocore.Services() {
3152
t.Run(service, func(t *testing.T) {
3253
if serviceToTest != "" && service != serviceToTest { // TODO env var to only test a specific service

0 commit comments

Comments
 (0)