tests: migrate ops test to bats

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-04-14 16:07:17 -07:00
parent 5582f92a72
commit 381db37ca3
64 changed files with 220 additions and 190 deletions

View 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"
},
]
}

View 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"
},
]
}

View 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"
},
]
}

View 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"
},
]
}

View 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"
},
]
}

View 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"
},
]
}

View 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"
// },
// ]
// }

View 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"
},
]
}

View 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"
},
]
}

View 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"
},
]
}

View 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"
},
]