0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-14 09:00:43 +00:00
wp-docker-buildx/cmd/drone-ecr/main_test.go

21 lines
554 B
Go
Raw Normal View History

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