tests: migrate ops test to bats
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
26
tests/ops/export/bool/main.cue
Normal file
26
tests/ops/export/bool/main.cue
Normal file
@@ -0,0 +1,26 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
bool
|
||||
|
||||
#up: [
|
||||
{
|
||||
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: "json"
|
||||
},
|
||||
]
|
||||
}
|
241
tests/ops/export/concurrency/main.cue
Normal file
241
tests/ops/export/concurrency/main.cue
Normal file
@@ -0,0 +1,241 @@
|
||||
package testing
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol1 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol2 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test3: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol3 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test4: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol4 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test5: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol5 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test6: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol6 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test7: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol7 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test8: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol8 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test9: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol9 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test10: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol10 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
25
tests/ops/export/float/main.cue
Normal file
25
tests/ops/export/float/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
float
|
||||
|
||||
#up: [
|
||||
{
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
25
tests/ops/export/invalid/format/main.cue
Normal file
25
tests/ops/export/invalid/format/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "lalalalal"
|
||||
},
|
||||
]
|
||||
}
|
18
tests/ops/export/invalid/path/main.cue
Normal file
18
tests/ops/export/invalid/path/main.cue
Normal file
@@ -0,0 +1,18 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/lalala"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
26
tests/ops/export/invalid/validation/main.cue
Normal file
26
tests/ops/export/invalid/validation/main.cue
Normal file
@@ -0,0 +1,26 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~"^NAAAA.+"
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
73
tests/ops/export/json/main.cue
Normal file
73
tests/ops/export/json/main.cue
Normal file
@@ -0,0 +1,73 @@
|
||||
package testing
|
||||
|
||||
testScalar: {
|
||||
bool
|
||||
|
||||
#up: [
|
||||
{
|
||||
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: #up: [
|
||||
{
|
||||
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"
|
||||
},
|
||||
]
|
||||
|
||||
// FIXME: lists are currently broken
|
||||
// testList: {
|
||||
// [...string]
|
||||
|
||||
// #up: [
|
||||
// {
|
||||
// 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"
|
||||
// },
|
||||
// ]
|
||||
// }
|
25
tests/ops/export/number/main.cue
Normal file
25
tests/ops/export/number/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
number
|
||||
|
||||
#up: [
|
||||
{
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
25
tests/ops/export/string/main.cue
Normal file
25
tests/ops/export/string/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
26
tests/ops/export/withvalidation/main.cue
Normal file
26
tests/ops/export/withvalidation/main.cue
Normal file
@@ -0,0 +1,26 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~"^some.+"
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
75
tests/ops/export/yaml/main.cue
Normal file
75
tests/ops/export/yaml/main.cue
Normal file
@@ -0,0 +1,75 @@
|
||||
package testing
|
||||
|
||||
testScalar: {
|
||||
bool
|
||||
|
||||
#up: [
|
||||
{
|
||||
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]
|
||||
|
||||
// #up: [
|
||||
// {
|
||||
// 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: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo something: something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "yaml"
|
||||
},
|
||||
]
|
Reference in New Issue
Block a user