From f5afb97d03040a16884c91f8869d896f653a8160 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 15:02:14 -0700 Subject: [PATCH] test: implemented cli test for plan * Signed-off-by: Sam Alba --- tests/test-cli.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test-cli.sh b/tests/test-cli.sh index 22fa040e..31b750fb 100644 --- a/tests/test-cli.sh +++ b/tests/test-cli.sh @@ -11,6 +11,7 @@ test::cli() { test::cli::newdir "$dagger" test::cli::newgit "$dagger" test::cli::query "$dagger" + test::cli::plan "$dagger" } test::cli::list() { @@ -102,3 +103,30 @@ test::cli::query() { test::one "CLI: query: non concrete" --exit=1 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "nonconcrete" -c } + +test::cli::plan() { + local dagger="$1" + + # Create temporary store + local DAGGER_STORE + DAGGER_STORE="$(mktemp -d -t dagger-store-XXXXXX)" + export DAGGER_STORE + + test::one "CLI: new" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" new --plan-dir "$d"/cli/simple simple + + test::one "CLI: plan dir" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" plan dir "$d"/cli/nonconcrete + + test::one "CLI: plan dir: query non-concrete" --exit=1 \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" query -c + + test::one "CLI: plan git" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" plan git https://github.com/samalba/dagger-test.git + + test::one "CLI: plan git: verify we have the right plan" --stdout='{ + foo: "value" + bar: "another value" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c +}