From 93296fa3587397bf826b0017c84d1a00ac052af2 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Wed, 31 Mar 2021 18:49:53 -0700 Subject: [PATCH 1/3] tests: move llb tests into tests/llb Signed-off-by: Andrea Luzzardi --- tests/{ => llb}/copy/invalid/cache/main.cue | 0 tests/{ => llb}/copy/valid/component/main.cue | 0 tests/{ => llb}/copy/valid/script/main.cue | 0 tests/{ => llb}/dockerbuild/main.cue | 0 .../{ => llb}/dockerbuild/testdata/Dockerfile | 0 .../testdata/dockerfilepath/Dockerfile.custom | 0 tests/{ => llb}/dockerbuild/testdata/foo | 0 tests/{ => llb}/exec/always/main.cue | 0 .../{ => llb}/exec/dir/doesnotexist/main.cue | 0 tests/{ => llb}/exec/dir/exist/main.cue | 0 tests/{ => llb}/exec/env/invalid/main.cue | 0 tests/{ => llb}/exec/env/overlay/main.cue | 0 tests/{ => llb}/exec/env/valid/main.cue | 0 tests/{ => llb}/exec/error/main.cue | 0 tests/{ => llb}/exec/exit_code/main.cue | 0 tests/{ => llb}/exec/invalid/main.cue | 0 tests/{ => llb}/exec/simple/main.cue | 0 .../non_concrete_not_referenced/main.cue | 0 .../non_concrete_referenced/main.cue | 0 .../undefined/with_pkg_def/cue.mod/module.cue | 0 .../cue.mod/pkg/dagger.io/def/main.cue | 0 .../exec/undefined/with_pkg_def/main.cue | 0 .../with_pkg_mandatory/cue.mod/module.cue | 0 .../pkg/dagger.io/nonoptional/main.cue | 0 .../undefined/with_pkg_mandatory/main.cue | 0 .../with_pkg_optional/cue.mod/module.cue | 0 .../cue.mod/pkg/dagger.io/optional/main.cue | 0 .../exec/undefined/with_pkg_optional/main.cue | 0 tests/{ => llb}/export/bool/main.cue | 0 tests/{ => llb}/export/concurrency/main.cue | 0 tests/{ => llb}/export/float/main.cue | 0 .../{ => llb}/export/invalid/format/main.cue | 0 tests/{ => llb}/export/invalid/path/main.cue | 0 .../export/invalid/validation/main.cue | 0 tests/{ => llb}/export/json/main.cue | 0 tests/{ => llb}/export/number/main.cue | 0 tests/{ => llb}/export/string/main.cue | 0 .../{ => llb}/export/withvalidation/main.cue | 0 tests/{ => llb}/export/yaml/main.cue | 0 .../{ => llb}/fetch-container/exist/main.cue | 0 .../fetch-container/invalid/main.cue | 0 .../nonexistent/digest/main.cue | 0 .../image-with-valid-digest/main.cue | 0 .../nonexistent/image/main.cue | 0 .../fetch-container/nonexistent/tag/main.cue | 0 tests/{ => llb}/fetch-git/exist/main.cue | 0 tests/{ => llb}/fetch-git/invalid/main.cue | 0 .../fetch-git/nonexistent/bork/main.cue | 0 .../fetch-git/nonexistent/ref/main.cue | 0 .../fetch-git/nonexistent/remote/main.cue | 0 tests/{ => llb}/load/invalid/cache/main.cue | 0 tests/{ => llb}/load/valid/component/main.cue | 0 tests/{ => llb}/load/valid/script/main.cue | 0 tests/{ => llb}/mounts/valid/cache/main.cue | 0 .../{ => llb}/mounts/valid/component/main.cue | 0 tests/{ => llb}/mounts/valid/script/main.cue | 0 tests/{ => llb}/mounts/valid/tmpfs/main.cue | 0 tests/{ => llb}/push-container/inputs.yaml | 0 tests/{ => llb}/push-container/main.cue | 0 tests/{ => llb}/subdir/simple/main.cue | 0 tests/repro-19/main.cue | 15 --- tests/test.sh | 115 +++++++++--------- 62 files changed, 59 insertions(+), 71 deletions(-) rename tests/{ => llb}/copy/invalid/cache/main.cue (100%) rename tests/{ => llb}/copy/valid/component/main.cue (100%) rename tests/{ => llb}/copy/valid/script/main.cue (100%) rename tests/{ => llb}/dockerbuild/main.cue (100%) rename tests/{ => llb}/dockerbuild/testdata/Dockerfile (100%) rename tests/{ => llb}/dockerbuild/testdata/dockerfilepath/Dockerfile.custom (100%) rename tests/{ => llb}/dockerbuild/testdata/foo (100%) rename tests/{ => llb}/exec/always/main.cue (100%) rename tests/{ => llb}/exec/dir/doesnotexist/main.cue (100%) rename tests/{ => llb}/exec/dir/exist/main.cue (100%) rename tests/{ => llb}/exec/env/invalid/main.cue (100%) rename tests/{ => llb}/exec/env/overlay/main.cue (100%) rename tests/{ => llb}/exec/env/valid/main.cue (100%) rename tests/{ => llb}/exec/error/main.cue (100%) rename tests/{ => llb}/exec/exit_code/main.cue (100%) rename tests/{ => llb}/exec/invalid/main.cue (100%) rename tests/{ => llb}/exec/simple/main.cue (100%) rename tests/{ => llb}/exec/undefined/non_concrete_not_referenced/main.cue (100%) rename tests/{ => llb}/exec/undefined/non_concrete_referenced/main.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_def/cue.mod/module.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_def/cue.mod/pkg/dagger.io/def/main.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_def/main.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_mandatory/cue.mod/module.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_mandatory/cue.mod/pkg/dagger.io/nonoptional/main.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_mandatory/main.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_optional/cue.mod/module.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_optional/cue.mod/pkg/dagger.io/optional/main.cue (100%) rename tests/{ => llb}/exec/undefined/with_pkg_optional/main.cue (100%) rename tests/{ => llb}/export/bool/main.cue (100%) rename tests/{ => llb}/export/concurrency/main.cue (100%) rename tests/{ => llb}/export/float/main.cue (100%) rename tests/{ => llb}/export/invalid/format/main.cue (100%) rename tests/{ => llb}/export/invalid/path/main.cue (100%) rename tests/{ => llb}/export/invalid/validation/main.cue (100%) rename tests/{ => llb}/export/json/main.cue (100%) rename tests/{ => llb}/export/number/main.cue (100%) rename tests/{ => llb}/export/string/main.cue (100%) rename tests/{ => llb}/export/withvalidation/main.cue (100%) rename tests/{ => llb}/export/yaml/main.cue (100%) rename tests/{ => llb}/fetch-container/exist/main.cue (100%) rename tests/{ => llb}/fetch-container/invalid/main.cue (100%) rename tests/{ => llb}/fetch-container/nonexistent/digest/main.cue (100%) rename tests/{ => llb}/fetch-container/nonexistent/image-with-valid-digest/main.cue (100%) rename tests/{ => llb}/fetch-container/nonexistent/image/main.cue (100%) rename tests/{ => llb}/fetch-container/nonexistent/tag/main.cue (100%) rename tests/{ => llb}/fetch-git/exist/main.cue (100%) rename tests/{ => llb}/fetch-git/invalid/main.cue (100%) rename tests/{ => llb}/fetch-git/nonexistent/bork/main.cue (100%) rename tests/{ => llb}/fetch-git/nonexistent/ref/main.cue (100%) rename tests/{ => llb}/fetch-git/nonexistent/remote/main.cue (100%) rename tests/{ => llb}/load/invalid/cache/main.cue (100%) rename tests/{ => llb}/load/valid/component/main.cue (100%) rename tests/{ => llb}/load/valid/script/main.cue (100%) rename tests/{ => llb}/mounts/valid/cache/main.cue (100%) rename tests/{ => llb}/mounts/valid/component/main.cue (100%) rename tests/{ => llb}/mounts/valid/script/main.cue (100%) rename tests/{ => llb}/mounts/valid/tmpfs/main.cue (100%) rename tests/{ => llb}/push-container/inputs.yaml (100%) rename tests/{ => llb}/push-container/main.cue (100%) rename tests/{ => llb}/subdir/simple/main.cue (100%) delete mode 100644 tests/repro-19/main.cue diff --git a/tests/copy/invalid/cache/main.cue b/tests/llb/copy/invalid/cache/main.cue similarity index 100% rename from tests/copy/invalid/cache/main.cue rename to tests/llb/copy/invalid/cache/main.cue diff --git a/tests/copy/valid/component/main.cue b/tests/llb/copy/valid/component/main.cue similarity index 100% rename from tests/copy/valid/component/main.cue rename to tests/llb/copy/valid/component/main.cue diff --git a/tests/copy/valid/script/main.cue b/tests/llb/copy/valid/script/main.cue similarity index 100% rename from tests/copy/valid/script/main.cue rename to tests/llb/copy/valid/script/main.cue diff --git a/tests/dockerbuild/main.cue b/tests/llb/dockerbuild/main.cue similarity index 100% rename from tests/dockerbuild/main.cue rename to tests/llb/dockerbuild/main.cue diff --git a/tests/dockerbuild/testdata/Dockerfile b/tests/llb/dockerbuild/testdata/Dockerfile similarity index 100% rename from tests/dockerbuild/testdata/Dockerfile rename to tests/llb/dockerbuild/testdata/Dockerfile diff --git a/tests/dockerbuild/testdata/dockerfilepath/Dockerfile.custom b/tests/llb/dockerbuild/testdata/dockerfilepath/Dockerfile.custom similarity index 100% rename from tests/dockerbuild/testdata/dockerfilepath/Dockerfile.custom rename to tests/llb/dockerbuild/testdata/dockerfilepath/Dockerfile.custom diff --git a/tests/dockerbuild/testdata/foo b/tests/llb/dockerbuild/testdata/foo similarity index 100% rename from tests/dockerbuild/testdata/foo rename to tests/llb/dockerbuild/testdata/foo diff --git a/tests/exec/always/main.cue b/tests/llb/exec/always/main.cue similarity index 100% rename from tests/exec/always/main.cue rename to tests/llb/exec/always/main.cue diff --git a/tests/exec/dir/doesnotexist/main.cue b/tests/llb/exec/dir/doesnotexist/main.cue similarity index 100% rename from tests/exec/dir/doesnotexist/main.cue rename to tests/llb/exec/dir/doesnotexist/main.cue diff --git a/tests/exec/dir/exist/main.cue b/tests/llb/exec/dir/exist/main.cue similarity index 100% rename from tests/exec/dir/exist/main.cue rename to tests/llb/exec/dir/exist/main.cue diff --git a/tests/exec/env/invalid/main.cue b/tests/llb/exec/env/invalid/main.cue similarity index 100% rename from tests/exec/env/invalid/main.cue rename to tests/llb/exec/env/invalid/main.cue diff --git a/tests/exec/env/overlay/main.cue b/tests/llb/exec/env/overlay/main.cue similarity index 100% rename from tests/exec/env/overlay/main.cue rename to tests/llb/exec/env/overlay/main.cue diff --git a/tests/exec/env/valid/main.cue b/tests/llb/exec/env/valid/main.cue similarity index 100% rename from tests/exec/env/valid/main.cue rename to tests/llb/exec/env/valid/main.cue diff --git a/tests/exec/error/main.cue b/tests/llb/exec/error/main.cue similarity index 100% rename from tests/exec/error/main.cue rename to tests/llb/exec/error/main.cue diff --git a/tests/exec/exit_code/main.cue b/tests/llb/exec/exit_code/main.cue similarity index 100% rename from tests/exec/exit_code/main.cue rename to tests/llb/exec/exit_code/main.cue diff --git a/tests/exec/invalid/main.cue b/tests/llb/exec/invalid/main.cue similarity index 100% rename from tests/exec/invalid/main.cue rename to tests/llb/exec/invalid/main.cue diff --git a/tests/exec/simple/main.cue b/tests/llb/exec/simple/main.cue similarity index 100% rename from tests/exec/simple/main.cue rename to tests/llb/exec/simple/main.cue diff --git a/tests/exec/undefined/non_concrete_not_referenced/main.cue b/tests/llb/exec/undefined/non_concrete_not_referenced/main.cue similarity index 100% rename from tests/exec/undefined/non_concrete_not_referenced/main.cue rename to tests/llb/exec/undefined/non_concrete_not_referenced/main.cue diff --git a/tests/exec/undefined/non_concrete_referenced/main.cue b/tests/llb/exec/undefined/non_concrete_referenced/main.cue similarity index 100% rename from tests/exec/undefined/non_concrete_referenced/main.cue rename to tests/llb/exec/undefined/non_concrete_referenced/main.cue diff --git a/tests/exec/undefined/with_pkg_def/cue.mod/module.cue b/tests/llb/exec/undefined/with_pkg_def/cue.mod/module.cue similarity index 100% rename from tests/exec/undefined/with_pkg_def/cue.mod/module.cue rename to tests/llb/exec/undefined/with_pkg_def/cue.mod/module.cue diff --git a/tests/exec/undefined/with_pkg_def/cue.mod/pkg/dagger.io/def/main.cue b/tests/llb/exec/undefined/with_pkg_def/cue.mod/pkg/dagger.io/def/main.cue similarity index 100% rename from tests/exec/undefined/with_pkg_def/cue.mod/pkg/dagger.io/def/main.cue rename to tests/llb/exec/undefined/with_pkg_def/cue.mod/pkg/dagger.io/def/main.cue diff --git a/tests/exec/undefined/with_pkg_def/main.cue b/tests/llb/exec/undefined/with_pkg_def/main.cue similarity index 100% rename from tests/exec/undefined/with_pkg_def/main.cue rename to tests/llb/exec/undefined/with_pkg_def/main.cue diff --git a/tests/exec/undefined/with_pkg_mandatory/cue.mod/module.cue b/tests/llb/exec/undefined/with_pkg_mandatory/cue.mod/module.cue similarity index 100% rename from tests/exec/undefined/with_pkg_mandatory/cue.mod/module.cue rename to tests/llb/exec/undefined/with_pkg_mandatory/cue.mod/module.cue diff --git a/tests/exec/undefined/with_pkg_mandatory/cue.mod/pkg/dagger.io/nonoptional/main.cue b/tests/llb/exec/undefined/with_pkg_mandatory/cue.mod/pkg/dagger.io/nonoptional/main.cue similarity index 100% rename from tests/exec/undefined/with_pkg_mandatory/cue.mod/pkg/dagger.io/nonoptional/main.cue rename to tests/llb/exec/undefined/with_pkg_mandatory/cue.mod/pkg/dagger.io/nonoptional/main.cue diff --git a/tests/exec/undefined/with_pkg_mandatory/main.cue b/tests/llb/exec/undefined/with_pkg_mandatory/main.cue similarity index 100% rename from tests/exec/undefined/with_pkg_mandatory/main.cue rename to tests/llb/exec/undefined/with_pkg_mandatory/main.cue diff --git a/tests/exec/undefined/with_pkg_optional/cue.mod/module.cue b/tests/llb/exec/undefined/with_pkg_optional/cue.mod/module.cue similarity index 100% rename from tests/exec/undefined/with_pkg_optional/cue.mod/module.cue rename to tests/llb/exec/undefined/with_pkg_optional/cue.mod/module.cue diff --git a/tests/exec/undefined/with_pkg_optional/cue.mod/pkg/dagger.io/optional/main.cue b/tests/llb/exec/undefined/with_pkg_optional/cue.mod/pkg/dagger.io/optional/main.cue similarity index 100% rename from tests/exec/undefined/with_pkg_optional/cue.mod/pkg/dagger.io/optional/main.cue rename to tests/llb/exec/undefined/with_pkg_optional/cue.mod/pkg/dagger.io/optional/main.cue diff --git a/tests/exec/undefined/with_pkg_optional/main.cue b/tests/llb/exec/undefined/with_pkg_optional/main.cue similarity index 100% rename from tests/exec/undefined/with_pkg_optional/main.cue rename to tests/llb/exec/undefined/with_pkg_optional/main.cue diff --git a/tests/export/bool/main.cue b/tests/llb/export/bool/main.cue similarity index 100% rename from tests/export/bool/main.cue rename to tests/llb/export/bool/main.cue diff --git a/tests/export/concurrency/main.cue b/tests/llb/export/concurrency/main.cue similarity index 100% rename from tests/export/concurrency/main.cue rename to tests/llb/export/concurrency/main.cue diff --git a/tests/export/float/main.cue b/tests/llb/export/float/main.cue similarity index 100% rename from tests/export/float/main.cue rename to tests/llb/export/float/main.cue diff --git a/tests/export/invalid/format/main.cue b/tests/llb/export/invalid/format/main.cue similarity index 100% rename from tests/export/invalid/format/main.cue rename to tests/llb/export/invalid/format/main.cue diff --git a/tests/export/invalid/path/main.cue b/tests/llb/export/invalid/path/main.cue similarity index 100% rename from tests/export/invalid/path/main.cue rename to tests/llb/export/invalid/path/main.cue diff --git a/tests/export/invalid/validation/main.cue b/tests/llb/export/invalid/validation/main.cue similarity index 100% rename from tests/export/invalid/validation/main.cue rename to tests/llb/export/invalid/validation/main.cue diff --git a/tests/export/json/main.cue b/tests/llb/export/json/main.cue similarity index 100% rename from tests/export/json/main.cue rename to tests/llb/export/json/main.cue diff --git a/tests/export/number/main.cue b/tests/llb/export/number/main.cue similarity index 100% rename from tests/export/number/main.cue rename to tests/llb/export/number/main.cue diff --git a/tests/export/string/main.cue b/tests/llb/export/string/main.cue similarity index 100% rename from tests/export/string/main.cue rename to tests/llb/export/string/main.cue diff --git a/tests/export/withvalidation/main.cue b/tests/llb/export/withvalidation/main.cue similarity index 100% rename from tests/export/withvalidation/main.cue rename to tests/llb/export/withvalidation/main.cue diff --git a/tests/export/yaml/main.cue b/tests/llb/export/yaml/main.cue similarity index 100% rename from tests/export/yaml/main.cue rename to tests/llb/export/yaml/main.cue diff --git a/tests/fetch-container/exist/main.cue b/tests/llb/fetch-container/exist/main.cue similarity index 100% rename from tests/fetch-container/exist/main.cue rename to tests/llb/fetch-container/exist/main.cue diff --git a/tests/fetch-container/invalid/main.cue b/tests/llb/fetch-container/invalid/main.cue similarity index 100% rename from tests/fetch-container/invalid/main.cue rename to tests/llb/fetch-container/invalid/main.cue diff --git a/tests/fetch-container/nonexistent/digest/main.cue b/tests/llb/fetch-container/nonexistent/digest/main.cue similarity index 100% rename from tests/fetch-container/nonexistent/digest/main.cue rename to tests/llb/fetch-container/nonexistent/digest/main.cue diff --git a/tests/fetch-container/nonexistent/image-with-valid-digest/main.cue b/tests/llb/fetch-container/nonexistent/image-with-valid-digest/main.cue similarity index 100% rename from tests/fetch-container/nonexistent/image-with-valid-digest/main.cue rename to tests/llb/fetch-container/nonexistent/image-with-valid-digest/main.cue diff --git a/tests/fetch-container/nonexistent/image/main.cue b/tests/llb/fetch-container/nonexistent/image/main.cue similarity index 100% rename from tests/fetch-container/nonexistent/image/main.cue rename to tests/llb/fetch-container/nonexistent/image/main.cue diff --git a/tests/fetch-container/nonexistent/tag/main.cue b/tests/llb/fetch-container/nonexistent/tag/main.cue similarity index 100% rename from tests/fetch-container/nonexistent/tag/main.cue rename to tests/llb/fetch-container/nonexistent/tag/main.cue diff --git a/tests/fetch-git/exist/main.cue b/tests/llb/fetch-git/exist/main.cue similarity index 100% rename from tests/fetch-git/exist/main.cue rename to tests/llb/fetch-git/exist/main.cue diff --git a/tests/fetch-git/invalid/main.cue b/tests/llb/fetch-git/invalid/main.cue similarity index 100% rename from tests/fetch-git/invalid/main.cue rename to tests/llb/fetch-git/invalid/main.cue diff --git a/tests/fetch-git/nonexistent/bork/main.cue b/tests/llb/fetch-git/nonexistent/bork/main.cue similarity index 100% rename from tests/fetch-git/nonexistent/bork/main.cue rename to tests/llb/fetch-git/nonexistent/bork/main.cue diff --git a/tests/fetch-git/nonexistent/ref/main.cue b/tests/llb/fetch-git/nonexistent/ref/main.cue similarity index 100% rename from tests/fetch-git/nonexistent/ref/main.cue rename to tests/llb/fetch-git/nonexistent/ref/main.cue diff --git a/tests/fetch-git/nonexistent/remote/main.cue b/tests/llb/fetch-git/nonexistent/remote/main.cue similarity index 100% rename from tests/fetch-git/nonexistent/remote/main.cue rename to tests/llb/fetch-git/nonexistent/remote/main.cue diff --git a/tests/load/invalid/cache/main.cue b/tests/llb/load/invalid/cache/main.cue similarity index 100% rename from tests/load/invalid/cache/main.cue rename to tests/llb/load/invalid/cache/main.cue diff --git a/tests/load/valid/component/main.cue b/tests/llb/load/valid/component/main.cue similarity index 100% rename from tests/load/valid/component/main.cue rename to tests/llb/load/valid/component/main.cue diff --git a/tests/load/valid/script/main.cue b/tests/llb/load/valid/script/main.cue similarity index 100% rename from tests/load/valid/script/main.cue rename to tests/llb/load/valid/script/main.cue diff --git a/tests/mounts/valid/cache/main.cue b/tests/llb/mounts/valid/cache/main.cue similarity index 100% rename from tests/mounts/valid/cache/main.cue rename to tests/llb/mounts/valid/cache/main.cue diff --git a/tests/mounts/valid/component/main.cue b/tests/llb/mounts/valid/component/main.cue similarity index 100% rename from tests/mounts/valid/component/main.cue rename to tests/llb/mounts/valid/component/main.cue diff --git a/tests/mounts/valid/script/main.cue b/tests/llb/mounts/valid/script/main.cue similarity index 100% rename from tests/mounts/valid/script/main.cue rename to tests/llb/mounts/valid/script/main.cue diff --git a/tests/mounts/valid/tmpfs/main.cue b/tests/llb/mounts/valid/tmpfs/main.cue similarity index 100% rename from tests/mounts/valid/tmpfs/main.cue rename to tests/llb/mounts/valid/tmpfs/main.cue diff --git a/tests/push-container/inputs.yaml b/tests/llb/push-container/inputs.yaml similarity index 100% rename from tests/push-container/inputs.yaml rename to tests/llb/push-container/inputs.yaml diff --git a/tests/push-container/main.cue b/tests/llb/push-container/main.cue similarity index 100% rename from tests/push-container/main.cue rename to tests/llb/push-container/main.cue diff --git a/tests/subdir/simple/main.cue b/tests/llb/subdir/simple/main.cue similarity index 100% rename from tests/subdir/simple/main.cue rename to tests/llb/subdir/simple/main.cue diff --git a/tests/repro-19/main.cue b/tests/repro-19/main.cue deleted file mode 100644 index 65694195..00000000 --- a/tests/repro-19/main.cue +++ /dev/null @@ -1,15 +0,0 @@ -package test - -#compute: [ - { - do: "fetch-container" - ref: "busybox" - }, - { - do: "exec" - args: ["sh", "-c", """ - echo hello > /tmp/out - """] - // dir: "/" - }, -] diff --git a/tests/test.sh b/tests/test.sh index 01169718..8ee399ef 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -74,26 +74,26 @@ test::fetchcontainer(){ # Fetch container disable test::one "FetchContainer: missing ref (FIXME: distinguish missing inputs from incorrect config)" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/invalid + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-container/invalid test::one "FetchContainer: non existent container image" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/image + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-container/nonexistent/image test::one "FetchContainer: non existent container tag" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/tag + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-container/nonexistent/tag test::one "FetchContainer: non existent container digest" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/digest + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-container/nonexistent/digest test::one "FetchContainer: valid containers" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/exist + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-container/exist disable test::one "FetchContainer: non existent container image with valid digest (FIXME https://github.com/blocklayerhq/dagger/issues/32)" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/image-with-valid-digest + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-container/nonexistent/image-with-valid-digest } test::pushcontainer(){ local dagger="$1" test::secret "$d"/push-container/inputs.yaml "PushContainer: simple" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/push-container + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/push-container } test::fetchgit(){ @@ -101,110 +101,110 @@ test::fetchgit(){ # Fetch git test::one "FetchGit: valid" --exit=0 --stdout="{}" \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/exist + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-git/exist disable test::one "FetchGit: invalid (FIXME: distinguish missing inputs from incorrect config) " --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/invalid + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-git/invalid test::one "FetchGit: non existent remote" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/nonexistent/remote + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-git/nonexistent/remote test::one "FetchGit: non existent ref" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/nonexistent/ref + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-git/nonexistent/ref test::one "FetchGit: non existent bork" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/nonexistent/bork + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-git/nonexistent/bork } test::exec(){ # Exec test::one "Exec: invalid" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/invalid + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/invalid test::one "Exec: error" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/error + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/error test::one "Exec: simple" --exit=0 --stdout={} \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/simple + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/simple # XXX should run twice and test that the string "always output" is visible with DOCKER_OUTPUT=1 # Alternatively, use export, but this would test multiple things then... test::one "Exec: always" --exit=0 --stdout={} \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/always + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/always test::one "Exec: env invalid" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/env/invalid + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/env/invalid test::one "Exec: env valid" --exit=0 --stdout={} \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/env/valid + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/env/valid test::one "Exec: env with overlay" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'bar=overlay environment' "$d"/exec/env/overlay + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'bar=overlay environment' "$d"/llb/exec/env/overlay test::one "Exec: non existent dir" --exit=0 --stdout={} \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/dir/doesnotexist + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/dir/doesnotexist test::one "Exec: valid dir" --exit=0 --stdout={} \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/dir/exist + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/dir/exist disable test::one "Exec: exit code propagation (FIXME https://github.com/blocklayerhq/dagger/issues/74)" --exit=123 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/exit_code + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/exit_code test::one "Exec: script with referenced non-concrete property should not be executed, and should succeed overall" --exit=0 --stdout='{"hello":"world"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/non_concrete_referenced + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/undefined/non_concrete_referenced # NOTE: the exec is meant to fail - and we test that as a way to confirm it has been executed test::one "Exec: script with unreferenced undefined properties should be executed" --exit=1 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/non_concrete_not_referenced + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/undefined/non_concrete_not_referenced test::one "Exec: package with optional def, not referenced, should be executed" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/with_pkg_def + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/undefined/with_pkg_def test::one "Exec: script with optional prop, not referenced, should be executed" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/with_pkg_optional + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/undefined/with_pkg_optional disable test::one "Exec: script with non-optional prop, not referenced, should be executed (FIXME https://github.com/blocklayerhq/dagger/issues/70)" --exit=1 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/with_pkg_mandatory + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/undefined/with_pkg_mandatory } test::export(){ test::one "Export: json" --exit=0 --stdout='{"testMap":{"something":"something"},"testScalar":true}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/json + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/json test::one "Export: string" --exit=0 --stdout='{"test":"something"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/string + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/string test::one "Export: string with additional constraint success" --exit=0 --stdout='{"test":"something"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/withvalidation + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/withvalidation test::one "Export: many concurrent" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/concurrency + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/concurrency test::one "Export: does not pass additional validation" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/invalid/validation + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/invalid/validation test::one "Export: invalid format" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/invalid/format + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/invalid/format test::one "Export: invalid path" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/invalid/path + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/invalid/path test::one "Export: number" --exit=0 --stdout='{"test":-123.5}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/float + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/float disable test::one "Export: number (FIXME: https://github.com/blocklayerhq/dagger/issues/96)" --exit=0 --stdout='{"test":-123.5}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/number + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/number test::one "Export: yaml" --exit=0 --stdout='{"testMap":{"something":"something"},"testScalar":true}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/yaml + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/yaml test::one "Export: bool" --exit=0 --stdout='{"test":true}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/bool + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/bool } test::copy(){ test::one "Copy: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/copy/valid/component + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/copy/valid/component test::one "Copy: valid script" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/copy/valid/script + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/copy/valid/script disable test::one "Copy: invalid caching (FIXME https://github.com/blocklayerhq/dagger/issues/44)" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/copy/invalid/cache + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/copy/invalid/cache } test::load(){ test::one "Load: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/load/valid/component + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/load/valid/component test::one "Load: valid script" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/load/valid/script + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/load/valid/script test::one "Load: invalid caching (FIXME https://github.com/blocklayerhq/dagger/issues/44)" --exit=1 --stdout= \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/load/invalid/cache + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/load/invalid/cache } test::local(){ @@ -213,16 +213,16 @@ test::local(){ test::mount(){ test::one "Mount: tmpfs" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/tmpfs + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/mounts/valid/tmpfs test::one "Mount: cache" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/cache + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/mounts/valid/cache test::one "Mount: component" --exit=0 --stdout='{"test":"hello world"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/component + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/mounts/valid/component disable test::one "Mount: script (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/script + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/mounts/valid/script } test::input() { @@ -241,12 +241,12 @@ test::input() { test::subdir() { test::one "Subdir: simple usage" --exit=0 --stdout='{"hello":"world"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/subdir/simple + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/subdir/simple } test::dockerbuild() { test::one "Docker Build" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-dir TestData="$d"/dockerbuild/testdata "$d"/dockerbuild + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-dir TestData="$d"/llb/dockerbuild/testdata "$d"/llb/dockerbuild } test::daggerignore() { @@ -254,27 +254,30 @@ test::daggerignore() { "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-dir TestData="$d"/ignore/testdata "$d"/ignore } -test::all(){ +test::llb(){ local dagger="$1" test::load "$dagger" test::mount "$dagger" - test::copy "$dagger" test::local "$dagger" - test::compute "$dagger" test::fetchcontainer "$dagger" test::pushcontainer "$dagger" test::fetchgit "$dagger" test::exec "$dagger" test::export "$dagger" - test::input "$dagger" test::subdir "$dagger" test::dockerbuild "$dagger" +} + +test::all(){ + local dagger="$1" + + test::llb "$dagger" + test::compute "$dagger" + test::input "$dagger" test::daggerignore "$dagger" - test::stdlib "$dagger" - test::examples "$dagger" } From 4b682a8e3f24a2d30ba73749ebd2044c0de621de Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Wed, 31 Mar 2021 19:04:37 -0700 Subject: [PATCH 2/3] tests: reorganize test suite Signed-off-by: Andrea Luzzardi --- tests/test.sh | 147 +++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/tests/test.sh b/tests/test.sh index 8ee399ef..312b1348 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -13,7 +13,46 @@ DAGGER_BINARY_ARGS="${DAGGER_BINARY_ARGS:---log-format json}" read -ra DAGGER_BINARY_ARGS <<< "${DAGGER_BINARY_ARGS:-}" readonly DAGGER_BINARY_ARGS -test::stdlib() { +test::all(){ + local dagger="$1" + + test::llb "$dagger" + test::dependencies "$dagger" + test::stdlib "$dagger" + test::compute "$dagger" + test::input "$dagger" + test::daggerignore "$dagger" + test::examples "$dagger" +} + +test::llb(){ + local dagger="$1" + + test::llb::load "$dagger" + test::llb::mount "$dagger" + test::llb::copy "$dagger" + test::llb::local "$dagger" + test::llb::fetchcontainer "$dagger" + test::llb::pushcontainer "$dagger" + test::llb::fetchgit "$dagger" + test::llb::exec "$dagger" + test::llb::export "$dagger" + test::llb::subdir "$dagger" + test::llb::dockerbuild "$dagger" +} + +test::dependencies(){ + local dagger="$1" + + test::one "Dependencies: simple direct dependency" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/simple + test::one "Dependencies: interpolation" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/interpolation + test::one "Dependencies: json.Unmarshal" --exit=0 --stdout='{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/unmarshal +} + +test::stdlib(){ local dagger="$1" test::one "stdlib: alpine" \ @@ -28,12 +67,6 @@ test::stdlib() { "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/netlify } -test::examples() { - test::secret "$d"/../examples/react-netlify/inputs.yaml "examples: React Netlify" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/../examples/react-netlify - -} - test::compute(){ local dagger="$1" @@ -58,18 +91,32 @@ test::compute(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/success/overload/wrapped } -test::dependencies(){ - local dagger="$1" +test::input() { + test::one "Input: missing input should skip execution" --exit=0 --stdout='{}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/simple - test::one "Dependencies: simple direct dependency" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/simple - test::one "Dependencies: interpolation" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/interpolation - test::one "Dependencies: json.Unmarshal" --exit=0 --stdout='{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/unmarshal + test::one "Input: simple input" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/input/simple + + test::one "Input: default values" --exit=0 --stdout='{"in":"default input","test":"received: default input"}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/default + + test::one "Input: override default value" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/input/default } -test::fetchcontainer(){ +test::daggerignore() { + test::one "Dagger Ignore" --exit=0 \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-dir TestData="$d"/ignore/testdata "$d"/ignore +} + +test::examples() { + test::secret "$d"/../examples/react-netlify/inputs.yaml "examples: React Netlify" --exit=0 \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/../examples/react-netlify + +} + +test::llb::fetchcontainer(){ local dagger="$1" # Fetch container @@ -89,14 +136,14 @@ test::fetchcontainer(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-container/nonexistent/image-with-valid-digest } -test::pushcontainer(){ +test::llb::pushcontainer(){ local dagger="$1" - test::secret "$d"/push-container/inputs.yaml "PushContainer: simple" --exit=0 \ + test::secret "$d"/llb/push-container/inputs.yaml "PushContainer: simple" --exit=0 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/push-container } -test::fetchgit(){ +test::llb::fetchgit(){ local dagger="$1" # Fetch git @@ -112,7 +159,7 @@ test::fetchgit(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/fetch-git/nonexistent/bork } -test::exec(){ +test::llb::exec(){ # Exec test::one "Exec: invalid" --exit=1 --stdout= \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/invalid @@ -152,7 +199,7 @@ test::exec(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/exec/undefined/with_pkg_mandatory } -test::export(){ +test::llb::export(){ test::one "Export: json" --exit=0 --stdout='{"testMap":{"something":"something"},"testScalar":true}' \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/json @@ -187,7 +234,7 @@ test::export(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/export/bool } -test::copy(){ +test::llb::copy(){ test::one "Copy: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/copy/valid/component test::one "Copy: valid script" --exit=0 \ @@ -197,7 +244,7 @@ test::copy(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/copy/invalid/cache } -test::load(){ +test::llb::load(){ test::one "Load: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/load/valid/component test::one "Load: valid script" --exit=0 \ @@ -207,11 +254,11 @@ test::load(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/load/invalid/cache } -test::local(){ +test::llb::local(){ disable "" "There are no local tests right now (the feature is possibly not functioning at all: see https://github.com/blocklayerhq/dagger/issues/41)" } -test::mount(){ +test::llb::mount(){ test::one "Mount: tmpfs" --exit=0 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/mounts/valid/tmpfs @@ -225,62 +272,16 @@ test::mount(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/mounts/valid/script } -test::input() { - test::one "Input: missing input should skip execution" --exit=0 --stdout='{}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/simple - - test::one "Input: simple input" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/input/simple - - test::one "Input: default values" --exit=0 --stdout='{"in":"default input","test":"received: default input"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/default - - test::one "Input: override default value" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/input/default -} - -test::subdir() { +test::llb::subdir() { test::one "Subdir: simple usage" --exit=0 --stdout='{"hello":"world"}' \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/llb/subdir/simple } -test::dockerbuild() { +test::llb::dockerbuild() { test::one "Docker Build" --exit=0 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-dir TestData="$d"/llb/dockerbuild/testdata "$d"/llb/dockerbuild } -test::daggerignore() { - test::one "Dagger Ignore" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-dir TestData="$d"/ignore/testdata "$d"/ignore -} - -test::llb(){ - local dagger="$1" - - test::load "$dagger" - test::mount "$dagger" - test::copy "$dagger" - test::local "$dagger" - test::fetchcontainer "$dagger" - test::pushcontainer "$dagger" - test::fetchgit "$dagger" - test::exec "$dagger" - test::export "$dagger" - test::subdir "$dagger" - test::dockerbuild "$dagger" -} - -test::all(){ - local dagger="$1" - - test::llb "$dagger" - test::compute "$dagger" - test::input "$dagger" - test::daggerignore "$dagger" - test::stdlib "$dagger" - test::examples "$dagger" -} - case "${1:-all}" in # Help --help) From 8917017e166d9a57775831fe9253f6ea96186c0b Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Wed, 31 Mar 2021 19:15:48 -0700 Subject: [PATCH 3/3] tests: move input inside compute Signed-off-by: Andrea Luzzardi --- tests/{ => compute}/input/default/main.cue | 0 tests/{ => compute}/input/simple/main.cue | 0 tests/test.sh | 45 +++++++++++----------- 3 files changed, 22 insertions(+), 23 deletions(-) rename tests/{ => compute}/input/default/main.cue (100%) rename tests/{ => compute}/input/simple/main.cue (100%) diff --git a/tests/input/default/main.cue b/tests/compute/input/default/main.cue similarity index 100% rename from tests/input/default/main.cue rename to tests/compute/input/default/main.cue diff --git a/tests/input/simple/main.cue b/tests/compute/input/simple/main.cue similarity index 100% rename from tests/input/simple/main.cue rename to tests/compute/input/simple/main.cue diff --git a/tests/test.sh b/tests/test.sh index 312b1348..aadfc4b5 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -17,10 +17,9 @@ test::all(){ local dagger="$1" test::llb "$dagger" - test::dependencies "$dagger" test::stdlib "$dagger" + test::dependencies "$dagger" test::compute "$dagger" - test::input "$dagger" test::daggerignore "$dagger" test::examples "$dagger" } @@ -41,17 +40,6 @@ test::llb(){ test::llb::dockerbuild "$dagger" } -test::dependencies(){ - local dagger="$1" - - test::one "Dependencies: simple direct dependency" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/simple - test::one "Dependencies: interpolation" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/interpolation - test::one "Dependencies: json.Unmarshal" --exit=0 --stdout='{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/unmarshal -} - test::stdlib(){ local dagger="$1" @@ -67,6 +55,17 @@ test::stdlib(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/netlify } +test::dependencies(){ + local dagger="$1" + + test::one "Dependencies: simple direct dependency" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/simple + test::one "Dependencies: interpolation" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/interpolation + test::one "Dependencies: json.Unmarshal" --exit=0 --stdout='{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/unmarshal +} + test::compute(){ local dagger="$1" @@ -89,20 +88,20 @@ test::compute(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/success/overload/flat test::one "Compute: overloading #Component should work" --exit=0 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/success/overload/wrapped -} -test::input() { - test::one "Input: missing input should skip execution" --exit=0 --stdout='{}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/simple + # Compute: `--input-*` + test::one "Compute: Input: missing input should skip execution" --exit=0 --stdout='{}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/input/simple - test::one "Input: simple input" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/input/simple + test::one "Compute: Input: simple input" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/compute/input/simple - test::one "Input: default values" --exit=0 --stdout='{"in":"default input","test":"received: default input"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/default + test::one "Compute: Input: default values" --exit=0 --stdout='{"in":"default input","test":"received: default input"}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/input/default + + test::one "Compute: Input: override default value" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/compute/input/default - test::one "Input: override default value" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-string 'in=foobar' "$d"/input/default } test::daggerignore() {