Merge pull request #76 from blocklayerhq/output-no-merge

output: merge base/input/output into a single state.cue
This commit is contained in:
Andrea Luzzardi
2021-01-26 16:53:32 -08:00
committed by GitHub
4 changed files with 89 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
package testing
X1=in: string | *"default input"
test: {
string
#dagger: compute: [
{
do: "fetch-container"
ref: "alpine"
},
{
do: "exec"
args: ["sh", "-c", """
echo -n "received: \(X1)" > /out
"""]
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
dir: "/"
},
{
do: "export"
source: "/out"
format: "string"
},
]
}

View File

@@ -0,0 +1,27 @@
package testing
X1=in: string
test: {
string
#dagger: compute: [
{
do: "fetch-container"
ref: "alpine"
},
{
do: "exec"
args: ["sh", "-c", """
echo -n "received: \(X1)" > /out
"""]
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
dir: "/"
},
{
do: "export"
source: "/out"
format: "string"
},
]
}

View File

@@ -186,6 +186,21 @@ test::mount(){
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mount/valid/script
}
test::input() {
test::one "Input: missing input should skip execution" --exit=0 --stdout='{}' \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/simple
test::one "Input: simple input" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input 'in: "foobar"' "$d"/input/simple
test::one "Input: default values" --exit=0 --stdout='{"in":"default input","test":"received: default input"}' \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/input/default
test::one "Input: override default value" --exit=0 --stdout='{"in":"foobar","test":"received: foobar"}' \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input 'in: "foobar"' "$d"/input/default
}
test::all(){
local dagger="$1"
@@ -199,6 +214,7 @@ test::all(){
test::fetchgit "$dagger"
test::exec "$dagger"
test::export "$dagger"
test::input "$dagger"
}
case "${1:-all}" in