Misc Export fixes
- Temporarily disable export of base.cue as it causes merge errors at the end of compute - Fixes for JSON export for Scalar and Lists - Add YAML export - Removed BOOL and NUMBER support, using JSON for now - Re-enabled all export tests Fixes #36 Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
@@ -20,7 +20,7 @@ test: {
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "bool"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
25
examples/tests/export/float/main.cue
Normal file
25
examples/tests/export/float/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
float
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo -123.5 > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,6 +1,31 @@
|
||||
package testing
|
||||
|
||||
test: #dagger: compute: [
|
||||
testScalar: {
|
||||
bool
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo true > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
testMap: #dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
@@ -20,3 +45,29 @@ test: #dagger: compute: [
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
|
||||
// FIXME: lists are currently broken
|
||||
// testList: {
|
||||
// [...string]
|
||||
|
||||
// #dagger: compute: [
|
||||
// {
|
||||
// do: "fetch-container"
|
||||
// ref: "alpine"
|
||||
// },
|
||||
// {
|
||||
// do: "exec"
|
||||
// args: ["sh", "-c", """
|
||||
// echo '["milk", "pumpkin pie", "eggs", "juice"]' > /tmp/out
|
||||
// """,
|
||||
// ]
|
||||
// dir: "/"
|
||||
// },
|
||||
// {
|
||||
// do: "export"
|
||||
// // Source path in the container
|
||||
// source: "/tmp/out"
|
||||
// format: "json"
|
||||
// },
|
||||
// ]
|
||||
// }
|
||||
|
@@ -19,7 +19,7 @@ test: {
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "number"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@@ -1,6 +1,60 @@
|
||||
package testing
|
||||
|
||||
test: #dagger: compute: [
|
||||
testScalar: {
|
||||
bool
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo true > /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"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// FIXME: lists are currently broken
|
||||
// testList: {
|
||||
// [...string]
|
||||
|
||||
// #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"
|
||||
// },
|
||||
// ]
|
||||
// }
|
||||
|
||||
testMap: #dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
@@ -8,8 +62,7 @@ test: #dagger: compute: [
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "--- # Shopping list
|
||||
[milk, pumpkin pie, eggs, juice]" > /tmp/out
|
||||
echo something: something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
|
@@ -129,7 +129,7 @@ test::exec(){
|
||||
}
|
||||
|
||||
test::export(){
|
||||
test::one "Export: json" --exit=0 --stdout='{"test":{"something":"something"}}' \
|
||||
test::one "Export: json" --exit=0 --stdout='{"testMap":{"something":"something"},"testScalar":true}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/json
|
||||
|
||||
test::one "Export: string" --exit=0 --stdout='{"test":"something"}' \
|
||||
@@ -150,11 +150,16 @@ test::export(){
|
||||
test::one "Export: invalid path" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/invalid/path
|
||||
|
||||
disable test::one "Export: number (FIXME https://github.com/blocklayerhq/dagger/issues/36)" --exit=0 --stdout='{"test": -123.5}' \
|
||||
test::one "Export: number" --exit=0 --stdout='{"test":-123.5}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/float
|
||||
|
||||
disable test::one "Export: number (FIXME: https://github.com/blocklayerhq/dagger/issues/96)" --exit=0 --stdout='{"test":-123.5}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/number
|
||||
disable test::one "Export: yaml (FIXME https://github.com/blocklayerhq/dagger/issues/36)" --exit=0 --stdout='XXXXXX' \
|
||||
|
||||
test::one "Export: yaml" --exit=0 --stdout='{"testMap":{"something":"something"},"testScalar":true}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/yaml
|
||||
disable test::one "Export: bool (FIXME https://github.com/blocklayerhq/dagger/issues/35)" --exit=0 --stdout='{"test": false}' \
|
||||
|
||||
test::one "Export: bool" --exit=0 --stdout='{"test":true}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/bool
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user