test: implemented cli test for plan *

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-04-02 15:02:14 -07:00
parent 8bb2cfbb21
commit f5afb97d03

View File

@ -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
}