diff --git a/tests/cli/nonconcrete/main.cue b/tests/cli/nonconcrete/main.cue deleted file mode 100644 index 46d2bfca..00000000 --- a/tests/cli/nonconcrete/main.cue +++ /dev/null @@ -1,3 +0,0 @@ -package testing - -nonConcrete: string diff --git a/tests/cli/simple/main.cue b/tests/cli/simple/main.cue index d2a09c27..42621fef 100644 --- a/tests/cli/simple/main.cue +++ b/tests/cli/simple/main.cue @@ -4,8 +4,18 @@ import "dagger.io/dagger/op" foo: "value" bar: "another value" - -#up: [ - op.#FetchContainer & {ref: "busybox"}, - op.#Exec & {args: ["true"]}, -] +computed: { + string + #up: [ + op.#FetchContainer & {ref: "busybox"}, + op.#Exec & { + args: ["sh", "-c", """ + printf test > /export + """] + }, + op.#Export & { + source: "/export" + format: "string" + }, + ] +} diff --git a/tests/test-cli.sh b/tests/test-cli.sh index 637d450d..e7f92f92 100644 --- a/tests/test-cli.sh +++ b/tests/test-cli.sh @@ -51,10 +51,11 @@ test::cli::newdir() { "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "simple" test::one "CLI: new: verify we have the right plan" --stdout='{ - foo: "value" - bar: "another value" + "bar": "another value", + "computed": "test", + "foo": "value" }' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" -c + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" -c -f json } test::cli::newgit() { @@ -89,20 +90,45 @@ test::cli::query() { test::one "CLI: query: initialize simple" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" new --plan-dir "$d"/cli/simple simple - test::one "CLI: query: concrete" --stdout='{ - foo: "value" - bar: "another value" + test::one "CLI: query: before up" --stdout='{ + "bar": "another value", + "foo": "value" }' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" -c + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" + + test::one "CLI: query: concrete should fail" --exit=1 \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c test::one "CLI: query: target" --stdout='"value"' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" foo + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" foo - test::one "CLI: query: initialize nonconcrete" \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" new --plan-dir "$d"/cli/nonconcrete nonconcrete + test::one "CLI: query: compute missing values" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "simple" - test::one "CLI: query: non concrete" --exit=1 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "nonconcrete" -c + test::one "CLI: query: all values" --stdout='{ + "bar": "another value", + "computed": "test", + "foo": "value" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" + + test::one "CLI: query: concrete should work" --stdout='{ + "bar": "another value", + "computed": "test", + "foo": "value" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c + + test::one "CLI: query --no-computed" --stdout='{ + "bar": "another value", + "foo": "value" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" --no-computed + + test::one "CLI: query: --no-plan" --stdout='{ + "computed": "test" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c --no-plan } test::cli::plan() { @@ -117,19 +143,22 @@ test::cli::plan() { "$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 + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" plan dir "$d"/cli/simple - test::one "CLI: plan dir: query non-concrete" --exit=1 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" query -c + test::one "CLI: plan dir: verify we have the right plan" --stdout='{ + "bar": "another value", + "foo": "value" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" query 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" + "bar": "another value", + "foo": "value" }' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" -c + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c } test::cli::input() {