From c5c7575d1ef7e8c6a453076d9592c93899c2be41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Abete?= Date: Thu, 30 Mar 2017 12:11:14 -0300 Subject: [PATCH] Update tests for multi level images --- test.bats | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/test.bats b/test.bats index 22ba3a0..3dc8acf 100755 --- a/test.bats +++ b/test.bats @@ -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 @@ -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 @@ -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" @@ -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"