test: implemented tests for input list
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
6568c4e6d1
commit
42e91c0a30
@ -285,3 +285,36 @@ setup() {
|
||||
"foo": "bar"
|
||||
}'
|
||||
}
|
||||
|
||||
@test "dagger input list" {
|
||||
"$DAGGER" new --plan-dir "$TESTDIR"/cli/input/list "list"
|
||||
"$DAGGER" input text cfg.str "foobar" -e "list"
|
||||
|
||||
out="$("$DAGGER" input list -e "list")"
|
||||
outAll="$("$DAGGER" input list --all -e "list")"
|
||||
|
||||
#note: this is the recommended way to use pipes with bats
|
||||
run bash -c "echo \"$out\" | grep awsConfig.accessKey | grep '#Secret' | grep false"
|
||||
assert_success
|
||||
|
||||
run bash -c "echo \"$out\" | grep cfgInline.source | grep '#Artifact' | grep false | grep 'source dir'"
|
||||
assert_success
|
||||
|
||||
run bash -c "echo \"$outAll\" | grep cfg2"
|
||||
assert_failure
|
||||
|
||||
run bash -c "echo \"$out\" | grep cfgInline.strDef | grep string | grep 'yolo (default)' | grep false"
|
||||
assert_success
|
||||
|
||||
run bash -c "echo \"$out\" | grep cfg.num"
|
||||
assert_failure
|
||||
|
||||
run bash -c "echo \"$outAll\" | grep cfg.num | grep int"
|
||||
assert_success
|
||||
|
||||
run bash -c "echo \"$out\" | grep cfg.strSet"
|
||||
assert_failure
|
||||
|
||||
run bash -c "echo \"$outAll\" | grep cfg.strSet | grep string | grep pipo"
|
||||
assert_success
|
||||
}
|
||||
|
44
tests/cli/input/list/main.cue
Normal file
44
tests/cli/input/list/main.cue
Normal file
@ -0,0 +1,44 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/aws"
|
||||
)
|
||||
|
||||
awsConfig: aws.#Config & {
|
||||
// force region
|
||||
region: "us-east-1"
|
||||
}
|
||||
|
||||
#A: {
|
||||
// source dir
|
||||
source: dagger.#Artifact @dagger(input)
|
||||
sourceNotInput: dagger.#Artifact
|
||||
|
||||
// a secret
|
||||
key: dagger.#Secret @dagger(input)
|
||||
keyNotInput: dagger.#Secret
|
||||
|
||||
// a string
|
||||
str: string @dagger(input)
|
||||
strSet: "pipo" @dagger(input)
|
||||
strDef: *"yolo" | string @dagger(input)
|
||||
|
||||
// a number
|
||||
num: int | *42 @dagger(input)
|
||||
numNotInput: int
|
||||
|
||||
// aws config
|
||||
cfg: awsConfig
|
||||
}
|
||||
|
||||
cfgInline: {
|
||||
#A
|
||||
}
|
||||
|
||||
cfg: #A & {
|
||||
// force this key
|
||||
num: 21
|
||||
}
|
||||
|
||||
cfg2: cfg
|
Reference in New Issue
Block a user