Rename "deployment" to "environment": tests

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
Solomon Hykes 2021-04-27 19:07:15 +00:00
parent e6e8ab390d
commit d7391fe948
2 changed files with 51 additions and 51 deletions

View File

@ -28,10 +28,10 @@ setup() {
assert_failure assert_failure
# verify the plan works # verify the plan works
"$DAGGER" up -d "simple" "$DAGGER" up -e "simple"
# verify we have the right plan # verify we have the right plan
run "$DAGGER" query -f cue -d "simple" -c -f json run "$DAGGER" query -f cue -e "simple" -c -f json
assert_success assert_success
assert_output --partial '{ assert_output --partial '{
"bar": "another value", "bar": "another value",
@ -42,8 +42,8 @@ setup() {
@test "dagger new --plan-git" { @test "dagger new --plan-git" {
"$DAGGER" new --plan-git https://github.com/samalba/dagger-test.git simple "$DAGGER" new --plan-git https://github.com/samalba/dagger-test.git simple
"$DAGGER" up -d "simple" "$DAGGER" up -e "simple"
run "$DAGGER" query -f cue -d "simple" -c run "$DAGGER" query -f cue -e "simple" -c
assert_success assert_success
assert_output --partial '{ assert_output --partial '{
foo: "value" foo: "value"
@ -53,32 +53,32 @@ setup() {
@test "dagger query" { @test "dagger query" {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/simple simple "$DAGGER" new --plan-dir "$TESTDIR"/cli/simple simple
run "$DAGGER" query -l error -d "simple" run "$DAGGER" query -l error -e "simple"
assert_success assert_success
assert_output '{ assert_output '{
"bar": "another value", "bar": "another value",
"foo": "value" "foo": "value"
}' }'
# concrete should fail at this point since we haven't up'd # concrete should fail at this point since we haven't up'd
run "$DAGGER" query -d "simple" -c run "$DAGGER" query -e "simple" -c
assert_failure assert_failure
# target # target
run "$DAGGER" -l error query -d "simple" foo run "$DAGGER" -l error query -e "simple" foo
assert_success assert_success
assert_output '"value"' assert_output '"value"'
# ensure computed values show up # ensure computed values show up
"$DAGGER" up -d "simple" "$DAGGER" up -e "simple"
run "$DAGGER" -l error query -d "simple" run "$DAGGER" -l error query -e "simple"
assert_success assert_success
assert_output --partial '"computed": "test"' assert_output --partial '"computed": "test"'
# concrete should now work # concrete should now work
"$DAGGER" query -d "simple" -c "$DAGGER" query -e "simple" -c
# --no-computed should yield the same result as before # --no-computed should yield the same result as before
run "$DAGGER" query -l error --no-computed -d "simple" run "$DAGGER" query -l error --no-computed -e "simple"
assert_success assert_success
assert_output '{ assert_output '{
"bar": "another value", "bar": "another value",
@ -86,7 +86,7 @@ setup() {
}' }'
# --no-plan should give us only the computed values # --no-plan should give us only the computed values
run "$DAGGER" query -l error --no-plan -d "simple" run "$DAGGER" query -l error --no-plan -e "simple"
assert_success assert_success
assert_output '{ assert_output '{
"computed": "test" "computed": "test"
@ -97,14 +97,14 @@ setup() {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/simple simple "$DAGGER" new --plan-dir "$TESTDIR"/cli/simple simple
# plan dir # plan dir
"$DAGGER" -d "simple" plan dir "$TESTDIR"/cli/simple "$DAGGER" -e "simple" plan dir "$TESTDIR"/cli/simple
run "$DAGGER" -d "simple" query run "$DAGGER" -e "simple" query
assert_success assert_success
assert_output --partial '"foo": "value"' assert_output --partial '"foo": "value"'
# plan git # plan git
"$DAGGER" -d "simple" plan git https://github.com/samalba/dagger-test.git "$DAGGER" -e "simple" plan git https://github.com/samalba/dagger-test.git
run "$DAGGER" -d "simple" query run "$DAGGER" -e "simple" query
assert_success assert_success
assert_output --partial '"foo": "value"' assert_output --partial '"foo": "value"'
} }
@ -113,36 +113,36 @@ setup() {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input" "$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input"
# simple input # simple input
"$DAGGER" input -d "input" text "input" "my input" "$DAGGER" input -e "input" text "input" "my input"
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" input run "$DAGGER" -l error query -e "input" input
assert_success assert_success
assert_output '"my input"' assert_output '"my input"'
# nested input # nested input
"$DAGGER" input -d "input" text "nested.input" "nested input" "$DAGGER" input -e "input" text "nested.input" "nested input"
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" nested run "$DAGGER" -l error query -e "input" nested
assert_success assert_success
assert_output '{ assert_output '{
"input": "nested input" "input": "nested input"
}' }'
# file input # file input
"$DAGGER" input -d "input" text "input" -f "$TESTDIR"/cli/input/simple/testdata/input.txt "$DAGGER" input -e "input" text "input" -f "$TESTDIR"/cli/input/simple/testdata/input.txt
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" input run "$DAGGER" -l error query -e "input" input
assert_success assert_success
assert_output '"from file\n"' assert_output '"from file\n"'
# invalid file # invalid file
run "$DAGGER" input -d "input" text "input" -f "$TESTDIR"/cli/input/simple/testdata/notexist run "$DAGGER" input -e "input" text "input" -f "$TESTDIR"/cli/input/simple/testdata/notexist
assert_failure assert_failure
# stdin input # stdin input
echo -n "from stdin" | "$DAGGER" input -d "input" text "input" -f - echo -n "from stdin" | "$DAGGER" input -e "input" text "input" -f -
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" input run "$DAGGER" -l error query -e "input" input
assert_success assert_success
assert_output '"from stdin"' assert_output '"from stdin"'
} }
@ -150,18 +150,18 @@ setup() {
@test "dagger input json" { @test "dagger input json" {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input" "$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input"
"$DAGGER" input -d "input" json "structured" '{"a": "foo", "b": 42}' "$DAGGER" input -e "input" json "structured" '{"a": "foo", "b": 42}'
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" structured run "$DAGGER" -l error query -e "input" structured
assert_success assert_success
assert_output '{ assert_output '{
"a": "foo", "a": "foo",
"b": 42 "b": 42
}' }'
"$DAGGER" input -d "input" json "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.json "$DAGGER" input -e "input" json "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.json
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" structured run "$DAGGER" -l error query -e "input" structured
assert_success assert_success
assert_output '{ assert_output '{
"a": "from file", "a": "from file",
@ -172,18 +172,18 @@ setup() {
@test "dagger input yaml" { @test "dagger input yaml" {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input" "$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input"
"$DAGGER" input -d "input" yaml "structured" '{"a": "foo", "b": 42}' "$DAGGER" input -e "input" yaml "structured" '{"a": "foo", "b": 42}'
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" structured run "$DAGGER" -l error query -e "input" structured
assert_success assert_success
assert_output '{ assert_output '{
"a": "foo", "a": "foo",
"b": 42 "b": 42
}' }'
"$DAGGER" input -d "input" yaml "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.yaml "$DAGGER" input -e "input" yaml "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.yaml
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" structured run "$DAGGER" -l error query -e "input" structured
assert_success assert_success
assert_output '{ assert_output '{
"a": "from file", "a": "from file",
@ -194,9 +194,9 @@ setup() {
@test "dagger input dir" { @test "dagger input dir" {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/artifact "input" "$DAGGER" new --plan-dir "$TESTDIR"/cli/input/artifact "input"
"$DAGGER" input -d "input" dir "source" "$TESTDIR"/cli/input/artifact/testdata "$DAGGER" input -e "input" dir "source" "$TESTDIR"/cli/input/artifact/testdata
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" run "$DAGGER" -l error query -e "input"
assert_success assert_success
assert_output '{ assert_output '{
"bar": "thisisatest\n", "bar": "thisisatest\n",
@ -208,9 +208,9 @@ setup() {
@test "dagger input git" { @test "dagger input git" {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/artifact "input" "$DAGGER" new --plan-dir "$TESTDIR"/cli/input/artifact "input"
"$DAGGER" input -d "input" git "source" https://github.com/samalba/dagger-test-simple.git "$DAGGER" input -e "input" git "source" https://github.com/samalba/dagger-test-simple.git
"$DAGGER" up -d "input" "$DAGGER" up -e "input"
run "$DAGGER" -l error query -d "input" run "$DAGGER" -l error query -e "input"
assert_output '{ assert_output '{
"bar": "testgit\n", "bar": "testgit\n",
"foo": "bar", "foo": "bar",
@ -220,7 +220,7 @@ setup() {
@test "dagger input scan" { @test "dagger input scan" {
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/scan "scan" "$DAGGER" new --plan-dir "$TESTDIR"/cli/input/scan "scan"
run "$DAGGER" input scan -d "input" run "$DAGGER" input scan -e "input"
assert_success assert_success
} }

View File

@ -8,11 +8,11 @@ setup() {
skip_unless_secrets_available "$TESTDIR"/examples/react/inputs.yaml skip_unless_secrets_available "$TESTDIR"/examples/react/inputs.yaml
"$DAGGER" new --plan-dir "$TESTDIR"/../examples/react react "$DAGGER" new --plan-dir "$TESTDIR"/../examples/react react
sops -d "$TESTDIR"/examples/react/inputs.yaml | "$DAGGER" -d "react" input yaml "" -f - sops -d "$TESTDIR"/examples/react/inputs.yaml | "$DAGGER" -e "react" input yaml "" -f -
"$DAGGER" up -d "react" "$DAGGER" up -e "react"
# curl the URL we just deployed to check if it worked # curl the URL we just deployed to check if it worked
deployUrl=$("$DAGGER" query -l error -f text -d "react" www.deployUrl) deployUrl=$("$DAGGER" query -l error -f text -e "react" www.deployUrl)
echo "=>$deployUrl<=" echo "=>$deployUrl<="
run curl -sS "$deployUrl" run curl -sS "$deployUrl"
assert_success assert_success