0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-13 02:30:42 +00:00
wp-docker-buildx/cmd/drone-docker-ecr/main_test.go

20 lines
581 B
Go
Raw Normal View History

2018-02-10 16:41:07 +00:00
package main
import "testing"
func TestGetRepoName(t *testing.T) {
// map full repo path to expected repo name
repos := map[string]string{
"000000000000.dkr.ecr.us-east-1.amazonaws.com/repo": "repo",
"000000000000.dkr.ecr.us-east-1.amazonaws.com/namespace/repo": "namespace/repo",
"000000000000.dkr.ecr.us-east-1.amazonaws.com/namespace/namespace/repo": "namespace/namespace/repo",
}
for repo, name := range repos {
splitName := getRepoName(repo)
if splitName != name {
t.Errorf("%s is not equal to %s.", splitName, name)
}
}
}