Skip to content

Commit

Permalink
Update tests for multi level images
Browse files Browse the repository at this point in the history
  • Loading branch information
inakiabt committed Mar 30, 2017
1 parent e0a0426 commit c5c7575
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,22 @@ setup() {
[ "$output" == "repo/image:v1.2.3" ]
}

@test "test parseImageName repo multilevel image no tag" {
IMAGE="repo/multi/level/image"
TAGVAR=false
run parseImageName
[ ! -z $status ]
[ "$output" == "repo/multi/level/image:latest" ]
}

@test "test parseImageName repo multilevel image with tag" {
IMAGE="repo/multi/level/image:v1.2.3"
TAGVAR=false
run parseImageName
[ ! -z $status ]
[ "$output" == "repo/multi/level/image:v1.2.3" ]
}

@test "test parseImageName domain plus repo image no tag" {
IMAGE="docker.domain.com/repo/image"
TAGVAR=false
Expand All @@ -125,6 +141,22 @@ setup() {
[ "$output" == "docker.domain.com/repo/image:1.2.3" ]
}

@test "test parseImageName domain plus repo multilevel image no tag" {
IMAGE="docker.domain.com/repo/multi/level/image"
TAGVAR=false
run parseImageName
[ ! -z $status ]
[ "$output" == "docker.domain.com/repo/multi/level/image:latest" ]
}

@test "test parseImageName domain plus repo multilevel image with tag" {
IMAGE="docker.domain.com/repo/multi/level/image:1.2.3"
TAGVAR=false
run parseImageName
[ ! -z $status ]
[ "$output" == "docker.domain.com/repo/multi/level/image:1.2.3" ]
}

@test "test parseImageName domain plus port plus repo image no tag" {
IMAGE="docker.domain.com:8080/repo/image"
TAGVAR=false
Expand All @@ -141,6 +173,22 @@ setup() {
[ "$output" == "docker.domain.com:8080/repo/image:1.2.3" ]
}

@test "test parseImageName domain plus port plus repo multilevel image no tag" {
IMAGE="docker.domain.com:8080/repo/multi/level/image"
TAGVAR=false
run parseImageName
[ ! -z $status ]
[ "$output" == "docker.domain.com:8080/repo/multi/level/image:latest" ]
}

@test "test parseImageName domain plus port plus repo multilevel image with tag" {
IMAGE="docker.domain.com:8080/repo/multi/level/image:1.2.3"
TAGVAR=false
run parseImageName
[ ! -z $status ]
[ "$output" == "docker.domain.com:8080/repo/multi/level/image:1.2.3" ]
}

@test "test parseImageName domain plus port plus repo image with tag from var" {
IMAGE="docker.domain.com:8080/repo/image"
TAGVAR="CI_TIMESTAMP"
Expand All @@ -150,6 +198,23 @@ setup() {
[ "$output" == "docker.domain.com:8080/repo/image:1487623908" ]
}

@test "test parseImageName domain plus port plus repo multilevel image with tag from var" {
IMAGE="docker.domain.com:8080/repo/multi/level/image"
TAGVAR="CI_TIMESTAMP"
CI_TIMESTAMP="1487623908"
run parseImageName
[ ! -z $status ]
[ "$output" == "docker.domain.com:8080/repo/multi/level/image:1487623908" ]
}

@test "test parseImageName using ecr style domain" {
IMAGE="121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo"
TAGVAR=false
run parseImageName
[ ! -z $status ]
[ "$output" == "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:latest" ]
}

@test "test parseImageName using ecr style image name and tag from var" {
IMAGE="121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo"
TAGVAR="CI_TIMESTAMP"
Expand Down

0 comments on commit c5c7575

Please sign in to comment.