Merge pull request #530 from samalba/env-outputs

Support Outputs list
This commit is contained in:
Andrea Luzzardi
2021-06-01 19:47:47 -07:00
committed by GitHub
18 changed files with 303 additions and 98 deletions

View File

@@ -296,27 +296,53 @@ setup() {
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"
run bash -c "echo \"$out\" | grep awsConfig.accessKey | grep 'dagger.#Secret' | grep 'AWS access key'"
assert_success
run bash -c "echo \"$out\" | grep cfgInline.source | grep '#Artifact' | grep false | grep 'source dir'"
run bash -c "echo \"$out\" | grep cfgInline.source | grep 'dagger.#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"
run bash -c "echo \"$out\" | grep cfgInline.strDef | grep '*yolo | string' | grep false"
assert_success
run bash -c "echo \"$out\" | grep cfg.num"
assert_failure
run bash -c "echo \"$outAll\" | grep cfg.num | grep int"
run bash -c "echo \"$outAll\" | grep cfg.num | grep 21 | grep -v 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"
run bash -c "echo \"$outAll\" | grep cfg.strSet | grep pipo"
assert_success
}
@test "dagger output list" {
"$DAGGER" init
dagger_new_with_plan list "$TESTDIR"/cli/output/list
out="$("$DAGGER" output list -e "list")"
run bash -c "echo \"$out\" | grep cfgInline.url | grep 'http://this.is.a.test/' | grep 'test url description'"
assert_success
run bash -c "echo \"$out\" | grep cfg.url | grep 'http://this.is.a.test/' | grep 'test url description'"
assert_success
run bash -c "echo \"$out\" | grep cfg2.url | grep 'http://this.is.a.test/' | grep 'test url description'"
assert_success
run bash -c "echo \"$out\" | grep cfg.foo | grep '*42 | int'"
assert_success
run bash -c "echo \"$out\" | grep cfg2.bar | grep 'dagger.#Artifact'"
assert_success
run bash -c "echo \"$out\" | grep cfg2.str | grep 'string'"
assert_success
}

View File

@@ -0,0 +1,26 @@
package main
import (
"dagger.io/dagger"
)
#A: {
// a string
str: string @dagger(output)
strSet: "pipo" @dagger(input)
strDef: *"yolo" | string @dagger(input)
// test url description
url: "http://this.is.a.test/" @dagger(output)
url2: url
foo: int | *42 @dagger(output)
bar: dagger.#Artifact @dagger(output)
}
cfgInline: {
#A
}
cfg: #A
cfg2: cfg