Rename "deployment" to "environment": tests
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
parent
e6e8ab390d
commit
d7391fe948
@ -28,10 +28,10 @@ setup() {
|
||||
assert_failure
|
||||
|
||||
# verify the plan works
|
||||
"$DAGGER" up -d "simple"
|
||||
"$DAGGER" up -e "simple"
|
||||
|
||||
# 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_output --partial '{
|
||||
"bar": "another value",
|
||||
@ -42,8 +42,8 @@ setup() {
|
||||
|
||||
@test "dagger new --plan-git" {
|
||||
"$DAGGER" new --plan-git https://github.com/samalba/dagger-test.git simple
|
||||
"$DAGGER" up -d "simple"
|
||||
run "$DAGGER" query -f cue -d "simple" -c
|
||||
"$DAGGER" up -e "simple"
|
||||
run "$DAGGER" query -f cue -e "simple" -c
|
||||
assert_success
|
||||
assert_output --partial '{
|
||||
foo: "value"
|
||||
@ -53,32 +53,32 @@ setup() {
|
||||
|
||||
@test "dagger query" {
|
||||
"$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_output '{
|
||||
"bar": "another value",
|
||||
"foo": "value"
|
||||
}'
|
||||
# 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
|
||||
|
||||
# target
|
||||
run "$DAGGER" -l error query -d "simple" foo
|
||||
run "$DAGGER" -l error query -e "simple" foo
|
||||
assert_success
|
||||
assert_output '"value"'
|
||||
|
||||
# ensure computed values show up
|
||||
"$DAGGER" up -d "simple"
|
||||
run "$DAGGER" -l error query -d "simple"
|
||||
"$DAGGER" up -e "simple"
|
||||
run "$DAGGER" -l error query -e "simple"
|
||||
assert_success
|
||||
assert_output --partial '"computed": "test"'
|
||||
|
||||
# concrete should now work
|
||||
"$DAGGER" query -d "simple" -c
|
||||
"$DAGGER" query -e "simple" -c
|
||||
|
||||
# --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_output '{
|
||||
"bar": "another value",
|
||||
@ -86,7 +86,7 @@ setup() {
|
||||
}'
|
||||
|
||||
# --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_output '{
|
||||
"computed": "test"
|
||||
@ -97,14 +97,14 @@ setup() {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/simple simple
|
||||
|
||||
# plan dir
|
||||
"$DAGGER" -d "simple" plan dir "$TESTDIR"/cli/simple
|
||||
run "$DAGGER" -d "simple" query
|
||||
"$DAGGER" -e "simple" plan dir "$TESTDIR"/cli/simple
|
||||
run "$DAGGER" -e "simple" query
|
||||
assert_success
|
||||
assert_output --partial '"foo": "value"'
|
||||
|
||||
# plan git
|
||||
"$DAGGER" -d "simple" plan git https://github.com/samalba/dagger-test.git
|
||||
run "$DAGGER" -d "simple" query
|
||||
"$DAGGER" -e "simple" plan git https://github.com/samalba/dagger-test.git
|
||||
run "$DAGGER" -e "simple" query
|
||||
assert_success
|
||||
assert_output --partial '"foo": "value"'
|
||||
}
|
||||
@ -113,36 +113,36 @@ setup() {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input"
|
||||
|
||||
# simple input
|
||||
"$DAGGER" input -d "input" text "input" "my input"
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" input
|
||||
"$DAGGER" input -e "input" text "input" "my input"
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" input
|
||||
assert_success
|
||||
assert_output '"my input"'
|
||||
|
||||
# nested input
|
||||
"$DAGGER" input -d "input" text "nested.input" "nested input"
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" nested
|
||||
"$DAGGER" input -e "input" text "nested.input" "nested input"
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" nested
|
||||
assert_success
|
||||
assert_output '{
|
||||
"input": "nested input"
|
||||
}'
|
||||
|
||||
# file input
|
||||
"$DAGGER" input -d "input" text "input" -f "$TESTDIR"/cli/input/simple/testdata/input.txt
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" input
|
||||
"$DAGGER" input -e "input" text "input" -f "$TESTDIR"/cli/input/simple/testdata/input.txt
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" input
|
||||
assert_success
|
||||
assert_output '"from file\n"'
|
||||
|
||||
# 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
|
||||
|
||||
# stdin input
|
||||
echo -n "from stdin" | "$DAGGER" input -d "input" text "input" -f -
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" input
|
||||
echo -n "from stdin" | "$DAGGER" input -e "input" text "input" -f -
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" input
|
||||
assert_success
|
||||
assert_output '"from stdin"'
|
||||
}
|
||||
@ -150,18 +150,18 @@ setup() {
|
||||
@test "dagger input json" {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input"
|
||||
|
||||
"$DAGGER" input -d "input" json "structured" '{"a": "foo", "b": 42}'
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" structured
|
||||
"$DAGGER" input -e "input" json "structured" '{"a": "foo", "b": 42}'
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" structured
|
||||
assert_success
|
||||
assert_output '{
|
||||
"a": "foo",
|
||||
"b": 42
|
||||
}'
|
||||
|
||||
"$DAGGER" input -d "input" json "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.json
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" structured
|
||||
"$DAGGER" input -e "input" json "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.json
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" structured
|
||||
assert_success
|
||||
assert_output '{
|
||||
"a": "from file",
|
||||
@ -172,18 +172,18 @@ setup() {
|
||||
@test "dagger input yaml" {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/simple "input"
|
||||
|
||||
"$DAGGER" input -d "input" yaml "structured" '{"a": "foo", "b": 42}'
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" structured
|
||||
"$DAGGER" input -e "input" yaml "structured" '{"a": "foo", "b": 42}'
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" structured
|
||||
assert_success
|
||||
assert_output '{
|
||||
"a": "foo",
|
||||
"b": 42
|
||||
}'
|
||||
|
||||
"$DAGGER" input -d "input" yaml "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.yaml
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input" structured
|
||||
"$DAGGER" input -e "input" yaml "structured" -f "$TESTDIR"/cli/input/simple/testdata/input.yaml
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input" structured
|
||||
assert_success
|
||||
assert_output '{
|
||||
"a": "from file",
|
||||
@ -194,9 +194,9 @@ setup() {
|
||||
@test "dagger input dir" {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/artifact "input"
|
||||
|
||||
"$DAGGER" input -d "input" dir "source" "$TESTDIR"/cli/input/artifact/testdata
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input"
|
||||
"$DAGGER" input -e "input" dir "source" "$TESTDIR"/cli/input/artifact/testdata
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input"
|
||||
assert_success
|
||||
assert_output '{
|
||||
"bar": "thisisatest\n",
|
||||
@ -208,9 +208,9 @@ setup() {
|
||||
@test "dagger input git" {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/artifact "input"
|
||||
|
||||
"$DAGGER" input -d "input" git "source" https://github.com/samalba/dagger-test-simple.git
|
||||
"$DAGGER" up -d "input"
|
||||
run "$DAGGER" -l error query -d "input"
|
||||
"$DAGGER" input -e "input" git "source" https://github.com/samalba/dagger-test-simple.git
|
||||
"$DAGGER" up -e "input"
|
||||
run "$DAGGER" -l error query -e "input"
|
||||
assert_output '{
|
||||
"bar": "testgit\n",
|
||||
"foo": "bar",
|
||||
@ -220,7 +220,7 @@ setup() {
|
||||
|
||||
@test "dagger input scan" {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/scan "scan"
|
||||
run "$DAGGER" input scan -d "input"
|
||||
run "$DAGGER" input scan -e "input"
|
||||
assert_success
|
||||
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ setup() {
|
||||
skip_unless_secrets_available "$TESTDIR"/examples/react/inputs.yaml
|
||||
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/../examples/react react
|
||||
sops -d "$TESTDIR"/examples/react/inputs.yaml | "$DAGGER" -d "react" input yaml "" -f -
|
||||
"$DAGGER" up -d "react"
|
||||
sops -d "$TESTDIR"/examples/react/inputs.yaml | "$DAGGER" -e "react" input yaml "" -f -
|
||||
"$DAGGER" up -e "react"
|
||||
|
||||
# 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<="
|
||||
run curl -sS "$deployUrl"
|
||||
assert_success
|
||||
|
Reference in New Issue
Block a user