Enhance integration test to check invalid characters for docker images tags

This commit is contained in:
Ettore Di Giacinto
2021-04-21 10:22:41 +02:00
parent ef92f23221
commit 788b889d14
13 changed files with 79 additions and 7 deletions

11
tests/fixtures/docker_repo/c/build.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
prelude:
- echo foo > /test
- echo bar > /test2
steps:
- echo c > /c
- echo c > /cd
requires:
- category: "test"
name: "b"
version: "1.0"

View File

@@ -0,0 +1,3 @@
category: "test"
name: "c"
version: "1.0"

View File

@@ -0,0 +1,9 @@
image: "alpine"
prelude:
- echo foo > /test
- echo bar > /test2
steps:
- echo artifact5 > /test5
- echo artifact6 > /test6
- chmod +x generate.sh
- ./generate.sh

View File

@@ -0,0 +1,3 @@
category: "test"
name: "b"
version: "1.0"

View File

@@ -0,0 +1 @@
echo generated > /artifact42

View File

@@ -0,0 +1,10 @@
prelude:
- echo foo > /test
- echo bar > /test2
steps:
- echo artifact3 > /test3
- echo artifact4 > /test4
requires:
- category: "test"
name: "b"
version: "1.0"

View File

@@ -0,0 +1,8 @@
category: "test"
name: "a"
version: "1.0"
requires:
- category: "test"
name: "b"
version: "1.0"

11
tests/fixtures/docker_repo/d/build.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
prelude:
- echo foo > /test
- echo bar > /test2
steps:
- echo s > /d
- echo dd > /dd
requires:
- category: "test"
name: "c"
version: "1.0"

View File

@@ -0,0 +1,3 @@
category: "test"
name: "d"
version: "1.0"

View File

@@ -0,0 +1,3 @@
steps:
- echo s > /z
image: "alpine"

View File

@@ -0,0 +1,3 @@
category: "test"
name: "z"
version: "1.0+2"

View File

@@ -12,18 +12,19 @@ oneTimeTearDown() {
testBuild() {
mkdir $tmpdir/testbuild
luet build --tree "$ROOT_DIR/tests/fixtures/buildableseed" --destination $tmpdir/testbuild --compression zstd test/c@1.0 > /dev/null
luet build --tree "$ROOT_DIR/tests/fixtures/docker_repo" --destination $tmpdir/testbuild --compression zstd test/c@1.0 test/z > /dev/null
buildst=$?
assertEquals 'builds successfully' "$buildst" "0"
assertTrue 'create package dep B' "[ -e '$tmpdir/testbuild/b-test-1.0.package.tar.zst' ]"
assertTrue 'create package' "[ -e '$tmpdir/testbuild/c-test-1.0.package.tar.zst' ]"
assertTrue 'create package z' "[ -e '$tmpdir/testbuild/z-test-1.0+2.package.tar.zst' ]"
}
testRepo() {
# Disable tests which require a DOCKER registry
[ -z "${TEST_DOCKER_IMAGE:-}" ] && startSkipping
luet create-repo --tree "$ROOT_DIR/tests/fixtures/buildableseed" \
luet create-repo --tree "$ROOT_DIR/tests/fixtures/docker_repo" \
--output "${TEST_DOCKER_IMAGE}" \
--packages $tmpdir/testbuild \
--name "test" \
@@ -65,10 +66,11 @@ testInstall() {
# Disable tests which require a DOCKER registry
[ -z "${TEST_DOCKER_IMAGE:-}" ] && startSkipping
luet install -y --config $tmpdir/luet.yaml test/c@1.0
luet install -y --config $tmpdir/luet.yaml test/c@1.0 test/z
installst=$?
assertEquals 'install test successfully' "$installst" "0"
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
assertTrue 'package Z installed' "[ -e '$tmpdir/testrootfs/z' ]"
}
testReInstall() {
@@ -85,10 +87,11 @@ testUnInstall() {
# Disable tests which require a DOCKER registry
[ -z "${TEST_DOCKER_IMAGE:-}" ] && startSkipping
luet uninstall -y --config $tmpdir/luet.yaml test/c@1.0
luet uninstall -y --config $tmpdir/luet.yaml test/c@1.0 test/z
installst=$?
assertEquals 'uninstall test successfully' "$installst" "0"
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
assertTrue 'package Z uninstalled' "[ ! -e '$tmpdir/testrootfs/z' ]"
}
testInstallAgain() {
@@ -96,11 +99,13 @@ testInstallAgain() {
[ -z "${TEST_DOCKER_IMAGE:-}" ] && startSkipping
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
output=$(luet install -y --config $tmpdir/luet.yaml test/c@1.0)
output=$(luet install -y --config $tmpdir/luet.yaml test/c@1.0 test/z)
installst=$?
assertEquals 'install test successfully' "$installst" "0"
assertNotContains 'contains warning' "$output" 'No packages to install'
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
assertTrue 'package Z installed' "[ -e '$tmpdir/testrootfs/z' ]"
assertTrue 'package Z in cache' "[ -e '$tmpdir/testrootfs/packages/z-test-1.0+2.package.tar.zst' ]"
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.zst' ]"
}

View File

@@ -39,11 +39,12 @@ testBuild() {
mkdir $tmpdir/testbuild
mkdir $tmpdir/empty
luet build --tree "$tmpdir/empty" --config $tmpdir/luet.yaml --from-repositories --destination $tmpdir/testbuild --compression zstd test/c@1.0 > /dev/null
luet build --tree "$tmpdir/empty" --config $tmpdir/luet.yaml --from-repositories --destination $tmpdir/testbuild --compression zstd test/c@1.0 test/z > /dev/null
buildst=$?
assertEquals 'builds successfully' "$buildst" "0"
assertTrue 'create package dep B' "[ -e '$tmpdir/testbuild/b-test-1.0.package.tar.zst' ]"
assertTrue 'create package' "[ -e '$tmpdir/testbuild/c-test-1.0.package.tar.zst' ]"
assertTrue 'create package Z' "[ -e '$tmpdir/testbuild/z-test-1.0+2.package.tar.zst' ]"
}
testRepo() {
@@ -94,10 +95,11 @@ testInstall() {
# Disable tests which require a DOCKER registry
[ -z "${TEST_DOCKER_IMAGE:-}" ] && startSkipping
luet install -y --config $tmpdir/luet-client.yaml test/c@1.0
luet install -y --config $tmpdir/luet-client.yaml test/c@1.0 test/z
installst=$?
assertEquals 'install test successfully' "$installst" "0"
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
assertTrue 'package Z installed' "[ -e '$tmpdir/testrootfs/z' ]"
}
testReInstall() {