Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for the new ECR docker URI domain suffix magic
Browse files Browse the repository at this point in the history
hfinucane-zscaler committed Jan 30, 2025
1 parent 9521ec3 commit 28a15a2
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
@@ -231,3 +231,44 @@ target:
})
}
}

func TestEcrDomain(t *testing.T) {
tests := []struct {
name string
cfg Config
domain string
}{
{
name: "commercial aws",
cfg: Config{
Target: Registry{
Type: "aws",
AWS: AWS{
AccountID: "123456789",
Region: "ap-southeast-2",
},
},
},
domain: "123456789.dkr.ecr.ap-southeast-2.amazonaws.com",
},
{
name: "aws in china",
cfg: Config{
Target: Registry{
Type: "aws",
AWS: AWS{
AccountID: "123456789",
Region: "cn-north-1",
},
},
},
domain: "123456789.dkr.ecr.cn-north-1.amazonaws.com.cn",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
assert := assert.New(t)
assert.Equal(test.cfg.Target.AWS.EcrDomain(), test.domain)
})
}
}

0 comments on commit 28a15a2

Please sign in to comment.