commit
9a9e3b629f
29
examples/tests/export/bool/main.cue
Normal file
29
examples/tests/export/bool/main.cue
Normal file
@ -0,0 +1,29 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
bool
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf "true" > /tmp/out
|
||||
"""
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "bool"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
29
examples/tests/export/invalid/format/main.cue
Normal file
29
examples/tests/export/invalid/format/main.cue
Normal file
@ -0,0 +1,29 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo something > /tmp/out
|
||||
"""
|
||||
]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "lalalalal"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
20
examples/tests/export/invalid/path/main.cue
Normal file
20
examples/tests/export/invalid/path/main.cue
Normal file
@ -0,0 +1,20 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/lalala"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
30
examples/tests/export/invalid/validation/main.cue
Normal file
30
examples/tests/export/invalid/validation/main.cue
Normal file
@ -0,0 +1,30 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~ "^NAAAA.+"
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
"""
|
||||
]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
27
examples/tests/export/json/main.cue
Normal file
27
examples/tests/export/json/main.cue
Normal file
@ -0,0 +1,27 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo '{"something": "something"}' > /tmp/out
|
||||
"""
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
29
examples/tests/export/number/main.cue
Normal file
29
examples/tests/export/number/main.cue
Normal file
@ -0,0 +1,29 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
number
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo -123.5 > /tmp/out
|
||||
"""
|
||||
]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "number"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
29
examples/tests/export/string/main.cue
Normal file
29
examples/tests/export/string/main.cue
Normal file
@ -0,0 +1,29 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
"""
|
||||
]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
30
examples/tests/export/withvalidation/main.cue
Normal file
30
examples/tests/export/withvalidation/main.cue
Normal file
@ -0,0 +1,30 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~ "^some.+"
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
"""
|
||||
]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
29
examples/tests/export/yaml/main.cue
Normal file
29
examples/tests/export/yaml/main.cue
Normal file
@ -0,0 +1,29 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "--- # Shopping list
|
||||
[milk, pumpkin pie, eggs, juice]" > /tmp/out
|
||||
"""
|
||||
]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "yaml"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
@ -91,6 +91,35 @@ test::exec(){
|
||||
# "$dagger" compute "$d"/exec/dir/exist
|
||||
}
|
||||
|
||||
test::export(){
|
||||
# XXX https://github.com/blocklayerhq/dagger/issues/36
|
||||
#test::one "Export: number" --exit=0 --stdout='{"test": -123.5}' \
|
||||
# "$dagger" compute "$d"/export/number
|
||||
#test::one "Export: yaml" --exit=0 --stdout='XXXXXX' \
|
||||
# "$dagger" compute "$d"/export/yaml
|
||||
# XXX https://github.com/blocklayerhq/dagger/issues/35
|
||||
#test::one "Export: bool" --exit=0 --stdout='{"test": false}' \
|
||||
# "$dagger" compute "$d"/export/bool
|
||||
|
||||
test::one "Export: json" --exit=0 --stdout='{"test":{"something":"something"}}' \
|
||||
"$dagger" compute "$d"/export/json
|
||||
|
||||
test::one "Export: string" --exit=0 --stdout='{"test":"something"}' \
|
||||
"$dagger" compute "$d"/export/string
|
||||
|
||||
test::one "Export: string with additional constraint success" --exit=0 --stdout='{"test":"something"}' \
|
||||
"$dagger" compute "$d"/export/withvalidation
|
||||
|
||||
test::one "Export: does not pass additional validation" --exit=1 --stdout= \
|
||||
"$dagger" compute "$d"/export/invalid/validation
|
||||
|
||||
test::one "Export: invalid format" --exit=1 --stdout= \
|
||||
"$dagger" compute "$d"/export/invalid/format
|
||||
|
||||
test::one "Export: invalid path" --exit=1 --stdout= \
|
||||
"$dagger" compute "$d"/export/invalid/path
|
||||
}
|
||||
|
||||
test::all(){
|
||||
local dagger="$1"
|
||||
|
||||
@ -98,6 +127,7 @@ test::all(){
|
||||
test::fetchcontainer "$dagger"
|
||||
test::fetchgit "$dagger"
|
||||
test::exec "$dagger"
|
||||
test::export "$dagger"
|
||||
|
||||
# TODO: exec mounts
|
||||
# TODO: copy
|
||||
|
Reference in New Issue
Block a user