tests: move tests top-level
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
# Testing
|
||||
|
||||
## TL;DR
|
||||
|
||||
```
|
||||
# Get help
|
||||
./test.sh --help
|
||||
|
||||
# Run all tests
|
||||
# You can also just call ./test.sh with no argument
|
||||
# Also, `make integration` does exactly that
|
||||
./test.sh all
|
||||
|
||||
# Run one random dagger cue directory, with expectations on exit code, stdout, stderr
|
||||
./test.sh fetch-git/nonexistent/ref --exit=1 --stdout=
|
||||
```
|
||||
|
||||
By default, the dagger binary is expected to be found in ../../cmd/dagger/dagger relative to the test.sh script.
|
||||
|
||||
If you need to change this, pass along `DAGGER_BINARY=somewhere/dagger`
|
@@ -1,3 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: true
|
@@ -1,3 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: 123
|
@@ -1,16 +0,0 @@
|
||||
package testing
|
||||
|
||||
bar: #dagger: {
|
||||
|
||||
#new_def: "lala"
|
||||
|
||||
compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
}]
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package testing
|
||||
|
||||
bar: #dagger: {
|
||||
|
||||
new_prop: "lala"
|
||||
|
||||
compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
}]
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: "whatever"
|
@@ -1,3 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: whatever: "wrong"
|
@@ -1,11 +0,0 @@
|
||||
package testing
|
||||
|
||||
// no-op, should not error
|
||||
realempty: {
|
||||
#dagger: {}
|
||||
}
|
||||
|
||||
// no-op, should not error
|
||||
empty: {
|
||||
#dagger: compute: []
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package testing
|
||||
|
||||
new_prop: "lala"
|
||||
#new_def: "lala"
|
||||
|
||||
new_prop_too: string
|
||||
#new_def_too: string
|
||||
|
||||
#dagger: compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
}]
|
@@ -1,19 +0,0 @@
|
||||
package testing
|
||||
|
||||
foo: {
|
||||
new_prop: "lala"
|
||||
#new_def: "lala"
|
||||
|
||||
new_prop_too: string
|
||||
#new_def_too: string
|
||||
|
||||
#dagger: compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
}]
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
},
|
||||
]
|
45
examples/tests/copy/invalid/cache/main.cue
vendored
45
examples/tests/copy/invalid/cache/main.cue
vendored
@@ -1,45 +0,0 @@
|
||||
package testing
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
src: "/etc/issue"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: [{do: "fetch-container", ref: "busybox"}]
|
||||
src: "/etc/issue"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
package testing
|
||||
|
||||
component: #dagger: compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: component
|
||||
src: "/id"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: #dagger: compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
src: "/id"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
src: "/etc/issue"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
package testing
|
||||
|
||||
A: {
|
||||
result: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo '{"result": "from A"}' > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
B: {
|
||||
result: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "{\\"result\\": \\"dependency \(A.result)\\"}" > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,52 +0,0 @@
|
||||
package testing
|
||||
|
||||
A: {
|
||||
result: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo '{"result": "from A"}' > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
B: {
|
||||
result: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
env: DATA: A.result
|
||||
args: ["sh", "-c", """
|
||||
echo "{\\"result\\": \\"dependency $DATA\\"}" > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,55 +0,0 @@
|
||||
package testing
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
A: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo '{"hello": "world"}' > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
unmarshalled: json.Unmarshal(A)
|
||||
|
||||
B: {
|
||||
result: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "{\\"result\\": \\"unmarshalled.hello=\(unmarshalled.hello)\\"}" > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["echo", "always output"]
|
||||
always: true
|
||||
},
|
||||
]
|
@@ -1,16 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "pwd is: $(pwd)"
|
||||
[ "$(pwd)" == "/thisisnonexistent" ] || exit 1
|
||||
"""]
|
||||
dir: "/thisisnonexistent"
|
||||
},
|
||||
]
|
@@ -1,16 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "pwd is: $(pwd)"
|
||||
[ "$(pwd)" == "/etc" ] || exit 1
|
||||
"""]
|
||||
dir: "/etc"
|
||||
},
|
||||
]
|
15
examples/tests/exec/env/invalid/main.cue
vendored
15
examples/tests/exec/env/invalid/main.cue
vendored
@@ -1,15 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", #"""
|
||||
echo "$foo"
|
||||
"""#]
|
||||
env: foo: lala: "lala"
|
||||
},
|
||||
]
|
18
examples/tests/exec/env/overlay/main.cue
vendored
18
examples/tests/exec/env/overlay/main.cue
vendored
@@ -1,18 +0,0 @@
|
||||
package testing
|
||||
|
||||
bar: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "foo: $foo"
|
||||
[ "$foo" == "overlay environment" ] || exit 1
|
||||
"""]
|
||||
env: foo: bar
|
||||
},
|
||||
]
|
15
examples/tests/exec/env/valid/main.cue
vendored
15
examples/tests/exec/env/valid/main.cue
vendored
@@ -1,15 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
[ "$foo" == "output environment" ] || exit 1
|
||||
"""]
|
||||
env: foo: "output environment"
|
||||
},
|
||||
]
|
@@ -1,12 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["erroringout"]
|
||||
},
|
||||
]
|
@@ -1,14 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", "exit 123"]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
]
|
@@ -1,11 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
},
|
||||
]
|
@@ -1,12 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["echo", "simple output"]
|
||||
},
|
||||
]
|
@@ -1,20 +0,0 @@
|
||||
package testing
|
||||
|
||||
hello: "world"
|
||||
bar: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo \(hello)
|
||||
echo "This test SHOULD fail, because this script SHOULD execute, since bar is not referenced"
|
||||
exit 1
|
||||
"""]
|
||||
},
|
||||
]
|
@@ -1,20 +0,0 @@
|
||||
package testing
|
||||
|
||||
hello: "world"
|
||||
bar: string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo \(bar)
|
||||
echo "This test SHOULD succeed, because this is never going to be executed, as \(bar) is not concrete"
|
||||
exit 1
|
||||
"""]
|
||||
},
|
||||
]
|
@@ -1 +0,0 @@
|
||||
module: "dagger.cloud/testing"
|
@@ -1,19 +0,0 @@
|
||||
package def
|
||||
|
||||
#dang: string
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo success
|
||||
"""]
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"dagger.cloud/def"
|
||||
)
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "load",
|
||||
from: def
|
||||
},
|
||||
]
|
||||
}
|
@@ -1 +0,0 @@
|
||||
module: "dagger.cloud/testing"
|
@@ -1,20 +0,0 @@
|
||||
package nonoptional
|
||||
|
||||
dang: string
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo "This test SHOULD fail, because this SHOULD be executed"
|
||||
exit 1
|
||||
"""]
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"dagger.cloud/nonoptional"
|
||||
)
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "load",
|
||||
from: nonoptional
|
||||
},
|
||||
]
|
||||
}
|
@@ -1 +0,0 @@
|
||||
module: "dagger.cloud/testing"
|
@@ -1,19 +0,0 @@
|
||||
package optional
|
||||
|
||||
dang?: string
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo success
|
||||
"""]
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"dagger.cloud/optional"
|
||||
)
|
||||
|
||||
#dagger: {
|
||||
compute: [
|
||||
{
|
||||
do: "load",
|
||||
from: optional
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
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: "json"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,241 +0,0 @@
|
||||
package testing
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol10 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
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,25 +0,0 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/lalala"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~"^NAAAA.+"
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,73 +0,0 @@
|
||||
package testing
|
||||
|
||||
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"
|
||||
},
|
||||
{
|
||||
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]
|
||||
|
||||
// #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"
|
||||
// },
|
||||
// ]
|
||||
// }
|
@@ -1,25 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
number
|
||||
|
||||
#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,25 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~"^some.+"
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
package testing
|
||||
|
||||
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"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo something: something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "yaml"
|
||||
},
|
||||
]
|
@@ -1,36 +0,0 @@
|
||||
package testing
|
||||
|
||||
busybox1: #dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
]
|
||||
|
||||
busybox2: #dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox:latest"
|
||||
},
|
||||
]
|
||||
|
||||
busybox3: #dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox:1.33-musl"
|
||||
},
|
||||
]
|
||||
|
||||
busybox4: #dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
|
||||
},
|
||||
]
|
||||
|
||||
busybox5: #dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox:1.33-musl@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
|
||||
},
|
||||
]
|
@@ -1,7 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
},
|
||||
]
|
@@ -1,8 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine@sha256:c6c7524e2111f22a9f7577211232d89a9e68cf5b9ed4a41ba77957c9771380a5"
|
||||
},
|
||||
]
|
@@ -1,10 +0,0 @@
|
||||
package testing
|
||||
|
||||
// XXX WATCHOUT
|
||||
// Once buildkit has pulled that digest, it will stay cached and happily succeed WHATEVER the image name then is
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busyboxaaa@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
|
||||
},
|
||||
]
|
@@ -1,8 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "doesnotexist"
|
||||
},
|
||||
]
|
@@ -1,8 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine:doesnotexist"
|
||||
},
|
||||
]
|
@@ -1,9 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||
ref: "master"
|
||||
},
|
||||
]
|
@@ -1,7 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
},
|
||||
]
|
@@ -1,9 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "pork://pork"
|
||||
ref: "master"
|
||||
},
|
||||
]
|
@@ -1,9 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||
ref: "lalalalal"
|
||||
},
|
||||
]
|
@@ -1,9 +0,0 @@
|
||||
package testing
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "https://github.com/blocklayerhq/lalalala.git"
|
||||
ref: "master"
|
||||
},
|
||||
]
|
@@ -1,27 +0,0 @@
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
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"
|
||||
},
|
||||
]
|
||||
}
|
33
examples/tests/load/invalid/cache/main.cue
vendored
33
examples/tests/load/invalid/cache/main.cue
vendored
@@ -1,33 +0,0 @@
|
||||
package testing
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/etc/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "busybox"}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/etc/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
package testing
|
||||
|
||||
component: #dagger: compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: component
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: #dagger: compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/etc/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
25
examples/tests/mounts/valid/cache/main.cue
vendored
25
examples/tests/mounts/valid/cache/main.cue
vendored
@@ -1,25 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "NOT SURE WHAT TO TEST YET" > /out
|
||||
"""]
|
||||
dir: "/"
|
||||
mount: something: "cache"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
ls -lA /lol > /out
|
||||
"""]
|
||||
dir: "/"
|
||||
mount: something: {
|
||||
input: dagger: #compute: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}]
|
||||
path: "/lol"
|
||||
}
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
ls -lA /lol > /out
|
||||
"""]
|
||||
dir: "/"
|
||||
mount: something: {
|
||||
input: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}]
|
||||
path: "/lol"
|
||||
}
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "NOT SURE WHAT TO TEST YET" > /out
|
||||
"""]
|
||||
dir: "/"
|
||||
mount: something: "tmpfs"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package test
|
||||
|
||||
#dagger: compute: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo hello > /tmp/out
|
||||
"""]
|
||||
// dir: "/"
|
||||
},
|
||||
]
|
@@ -1,132 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o errexit -o errtrace -o functrace -o nounset -o pipefail
|
||||
|
||||
########################################################################
|
||||
# Logging helpers
|
||||
########################################################################
|
||||
readonly COLOR_RED=1
|
||||
readonly COLOR_GREEN=2
|
||||
readonly COLOR_YELLOW=3
|
||||
|
||||
# Prefix a date to a log line and output to stderr
|
||||
logger::stamp(){
|
||||
local color="$1"
|
||||
local level="$2"
|
||||
local i
|
||||
shift
|
||||
shift
|
||||
[ ! "$TERM" ] || [ ! -t 2 ] || >&2 tput setaf "$color"
|
||||
for i in "$@"; do
|
||||
>&2 printf "[%s] [%s] %s\\n" "$(date)" "$level" "$i"
|
||||
done
|
||||
[ ! "$TERM" ] || [ ! -t 2 ] || >&2 tput op
|
||||
}
|
||||
|
||||
logger::info(){
|
||||
logger::stamp "$COLOR_GREEN" "INFO" "$@"
|
||||
}
|
||||
|
||||
logger::warning(){
|
||||
logger::stamp "$COLOR_YELLOW" "WARNING" "$@"
|
||||
}
|
||||
|
||||
logger::error(){
|
||||
logger::stamp "$COLOR_RED" "ERROR" "$@"
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Handle exit code and errors of random command
|
||||
########################################################################
|
||||
wrap::err(){
|
||||
local args=()
|
||||
local actualExit=0
|
||||
local expectedExit=0
|
||||
local ret=0
|
||||
|
||||
for i in "$@"; do
|
||||
if [ "${i:0:9}" == "--stderr=" ]; then
|
||||
local expectedStderr="${i:9}"
|
||||
elif [ "${i:0:7}" == "--exit=" ]; then
|
||||
expectedExit="${i:7}"
|
||||
expectedExit="${expectedExit:-0}"
|
||||
else
|
||||
args+=("$i")
|
||||
fi
|
||||
done
|
||||
|
||||
logger::info " -> ${args[*]}"
|
||||
|
||||
exec 3>&1
|
||||
actualStderr="$("${args[@]}" 2>&1 1>&3)" || actualExit="$?"
|
||||
|
||||
[ "$expectedExit" == "$actualExit" ] || {
|
||||
logger::error " -> Expected exit code: $expectedExit" " -> Actual exit code : $actualExit"
|
||||
logger::error " -> Stderr was:"
|
||||
>&2 jq <<<"$actualStderr" 2>/dev/null || {
|
||||
>&2 echo "$actualStderr"
|
||||
logger::error " -> Also, stderr is not json"
|
||||
}
|
||||
ret=1
|
||||
}
|
||||
|
||||
[ -z "${expectedStderr+x}" ] || [ "$expectedStderr" == "$actualStderr" ] || {
|
||||
logger::error " -> Expected stderr:"
|
||||
>&2 jq <<<"$expectedStderr" 2>/dev/null || {
|
||||
>&2 echo "$expectedStderr"
|
||||
}
|
||||
logger::error " -> Actual stderr :"
|
||||
>&2 jq <<<"$actualStderr" 2>/dev/null || {
|
||||
>&2 echo "$actualStderr"
|
||||
logger::error " -> Also, stderr is not json ^"
|
||||
}
|
||||
ret=1
|
||||
}
|
||||
|
||||
exec 3>&-
|
||||
return "$ret"
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Main test function
|
||||
# argument 1 is a test description
|
||||
# to test the exit code, pass --exit=int (if not provided, will test that the command exits succesfully)
|
||||
# to test the value of stderr, pass --stderr=string (if not provided, stderr is not verified)
|
||||
# to test the value of stdout, pass --stdout=string (if not provided, stdout is not verified)
|
||||
# any other argument is the command that is going to be run
|
||||
# Example:
|
||||
# test dagger compute somecue --exit=1 --stderr=expectederror
|
||||
########################################################################
|
||||
test::one(){
|
||||
local testDescription="$1"
|
||||
shift
|
||||
local args=()
|
||||
local ret=0
|
||||
|
||||
for i in "$@"; do
|
||||
if [ "${i:0:9}" == "--stdout=" ]; then
|
||||
local expectedStdout="${i:9}"
|
||||
else
|
||||
args+=("$i")
|
||||
fi
|
||||
done
|
||||
|
||||
logger::info "$testDescription"
|
||||
|
||||
local actualStdout
|
||||
actualStdout="$(wrap::err "${args[@]}")" || {
|
||||
ret=1
|
||||
}
|
||||
|
||||
[ -z "${expectedStdout+x}" ] || [ "$expectedStdout" == "$actualStdout" ] || {
|
||||
exec 3>&-
|
||||
logger::error " -> Expected stdout: $expectedStdout" " -> Actual stdout : $actualStdout"
|
||||
ret=1
|
||||
}
|
||||
|
||||
[ "$ret" != 0 ] || logger::info " -> Success"
|
||||
return "$ret"
|
||||
}
|
||||
|
||||
disable(){
|
||||
logger::warning "Test \"$2\" has been disabled."
|
||||
}
|
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o errexit -o errtrace -o functrace -o nounset -o pipefail
|
||||
|
||||
# The purpose of this is solely to test::one the test::one framework in test-lib.sh
|
||||
|
||||
readonly d=$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd)
|
||||
|
||||
# Performing self-diagnostic linting check first
|
||||
shellcheck "$d/"*.sh
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "$d/test-lib.sh"
|
||||
|
||||
########################################################################
|
||||
# Verifying the test::one framework is working
|
||||
########################################################################
|
||||
self::command(){
|
||||
local stdout="${1:-}"
|
||||
local stderr="${2:-}"
|
||||
local ret="${3:-0}"
|
||||
printf "%s" "$stdout"
|
||||
>&2 printf "%s" "$stderr"
|
||||
exit "$ret"
|
||||
}
|
||||
|
||||
self::test(){
|
||||
# Command success testing
|
||||
test::one "Command success, no expectation should succeed" self::command || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command success, --exit=0 should succeed" self::command --exit=0 || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command success, --exit=1 should fail" self::command --exit=1 && {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command success, matching --stderr should succeed" self::command "" "to err" --stderr="to err" || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command success, non matching --stderr should fail" self::command --stderr="to stderr" && {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command success, matching --stdout foo should succeed" self::command "lol foo" --stdout="lol foo" || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command success, non matching --stdout should fail" self::command "lol foo" --stdout="lol" && {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command success, all expectation match should succeed" self::command "lol" --exit=0 --stdout="lol" --stderr= || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Command failure testing
|
||||
test::one "Command failure, no expectation should fail" self::command "" "" 10 && {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command failure, --exit=0 should fail" self::command "" "" 10 --exit=0 && {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command failure, --exit=10 should succeed" self::command "" "" 10 --exit=10 || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command failure, matching --stderr should succeed" self::command "" "" 10 --exit=10 --stderr= || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command failure, non matching --stderr should fail" self::command "" "" 10 --exit=10 --stderr=lala && {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command failure, matching --stdout should succeed" self::command "to stdout" "" 10 --exit=10 --stdout="to stdout" || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command failure, non matching --stdout should fail" self::command "to stdout" "" 10 --exit=10 --stdout="non matching" && {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test::one "Command failure, all expectation match should succeed" self::command "to stdout" "to stderr" 10 --exit=10 --stdout="to stdout" --stderr="to stderr" || {
|
||||
logger::error "FAIL!"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
>&2 logger::info "Performing self-diagnostic"
|
||||
self::test
|
||||
>&2 logger::info "All tests successful. Test framework is operational."
|
@@ -1,252 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o errexit -o errtrace -o functrace -o nounset -o pipefail
|
||||
|
||||
# Source the lib
|
||||
readonly d=$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd)
|
||||
# shellcheck source=/dev/null
|
||||
. "$d/test-lib.sh"
|
||||
|
||||
# Point this to your dagger binary
|
||||
readonly DAGGER_BINARY="${DAGGER_BINARY:-$d/../../cmd/dagger/dagger}"
|
||||
# The default arguments are a no-op, but having "anything" is a little cheat necessary for "${DAGGER_BINARY_ARGS[@]}" to not be empty down there
|
||||
DAGGER_BINARY_ARGS="${DAGGER_BINARY_ARGS:---log-format json}"
|
||||
read -ra DAGGER_BINARY_ARGS <<< "${DAGGER_BINARY_ARGS:-}"
|
||||
readonly DAGGER_BINARY_ARGS
|
||||
|
||||
test::compute(){
|
||||
local dagger="$1"
|
||||
|
||||
# Compute: invalid syntax
|
||||
test::one "Compute: invalid string should fail" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/invalid/string
|
||||
test::one "Compute: invalid bool should fail" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/invalid/bool
|
||||
test::one "Compute: invalid int should fail" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/invalid/int
|
||||
test::one "Compute: invalid struct should fail" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/invalid/struct
|
||||
test::one "Compute: overloading #ComponentScript with new prop should fail" --exit=1 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/invalid/overload/new_prop
|
||||
test::one "Compute: overloading #ComponentScript with new def should succeed" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/invalid/overload/new_def
|
||||
|
||||
# Compute: success
|
||||
test::one "Compute: noop should succeed" --exit=0 --stdout='{"empty":{},"realempty":{}}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/success/noop
|
||||
test::one "Compute: simple should succeed" --exit=0 --stdout="{}" \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/success/simple
|
||||
test::one "Compute: overloading #Component should work" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/success/overload/flat
|
||||
test::one "Compute: overloading #Component should work" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/compute/success/overload/wrapped
|
||||
}
|
||||
|
||||
test::dependencies(){
|
||||
local dagger="$1"
|
||||
|
||||
test::one "Dependencies: simple direct dependency" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/simple
|
||||
test::one "Dependencies: interpolation" --exit=0 --stdout='{"A":{"result":"from A"},"B":{"result":"dependency from A"}}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/interpolation
|
||||
test::one "Dependencies: json.Unmarshal" --exit=0 --stdout='{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/dependencies/unmarshal
|
||||
}
|
||||
|
||||
test::fetchcontainer(){
|
||||
local dagger="$1"
|
||||
|
||||
# Fetch container
|
||||
disable test::one "FetchContainer: missing ref (FIXME: distinguish missing inputs from incorrect config)" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/invalid
|
||||
test::one "FetchContainer: non existent container image" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/image
|
||||
test::one "FetchContainer: non existent container tag" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/tag
|
||||
test::one "FetchContainer: non existent container digest" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/digest
|
||||
|
||||
test::one "FetchContainer: valid containers" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/exist
|
||||
|
||||
disable test::one "FetchContainer: non existent container image with valid digest (FIXME https://github.com/blocklayerhq/dagger/issues/32)" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/image-with-valid-digest
|
||||
}
|
||||
|
||||
test::fetchgit(){
|
||||
local dagger="$1"
|
||||
|
||||
# Fetch git
|
||||
test::one "FetchGit: valid" --exit=0 --stdout="{}" \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/exist
|
||||
disable test::one "FetchGit: invalid (FIXME: distinguish missing inputs from incorrect config) " --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/invalid
|
||||
test::one "FetchGit: non existent remote" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/nonexistent/remote
|
||||
test::one "FetchGit: non existent ref" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/nonexistent/ref
|
||||
test::one "FetchGit: non existent bork" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-git/nonexistent/bork
|
||||
}
|
||||
|
||||
test::exec(){
|
||||
# Exec
|
||||
test::one "Exec: invalid" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/invalid
|
||||
test::one "Exec: error" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/error
|
||||
test::one "Exec: simple" --exit=0 --stdout={} \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/simple
|
||||
# XXX should run twice and test that the string "always output" is visible with DOCKER_OUTPUT=1
|
||||
# Alternatively, use export, but this would test multiple things then...
|
||||
test::one "Exec: always" --exit=0 --stdout={} \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/always
|
||||
test::one "Exec: env invalid" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/env/invalid
|
||||
test::one "Exec: env valid" --exit=0 --stdout={} \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/env/valid
|
||||
test::one "Exec: env with overlay" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-cue 'bar: "overlay environment"' "$d"/exec/env/overlay
|
||||
|
||||
test::one "Exec: non existent dir" --exit=0 --stdout={} \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/dir/doesnotexist
|
||||
test::one "Exec: valid dir" --exit=0 --stdout={} \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/dir/exist
|
||||
|
||||
disable test::one "Exec: exit code propagation (FIXME https://github.com/blocklayerhq/dagger/issues/74)" --exit=123 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/exit_code
|
||||
|
||||
test::one "Exec: script with referenced non-concrete property should not be executed, and should succeed overall" --exit=0 --stdout='{"hello":"world"}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/non_concrete_referenced
|
||||
# NOTE: the exec is meant to fail - and we test that as a way to confirm it has been executed
|
||||
test::one "Exec: script with unreferenced undefined properties should be executed" --exit=1 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/non_concrete_not_referenced
|
||||
test::one "Exec: package with optional def, not referenced, should be executed" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/with_pkg_def
|
||||
test::one "Exec: script with optional prop, not referenced, should be executed" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/with_pkg_optional
|
||||
disable test::one "Exec: script with non-optional prop, not referenced, should be executed (FIXME https://github.com/blocklayerhq/dagger/issues/70)" --exit=1 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/undefined/with_pkg_mandatory
|
||||
}
|
||||
|
||||
test::export(){
|
||||
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"}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/string
|
||||
|
||||
test::one "Export: string with additional constraint success" --exit=0 --stdout='{"test":"something"}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/withvalidation
|
||||
|
||||
test::one "Export: many concurrent" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/concurrency
|
||||
|
||||
test::one "Export: does not pass additional validation" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/invalid/validation
|
||||
|
||||
test::one "Export: invalid format" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/invalid/format
|
||||
|
||||
test::one "Export: invalid path" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/invalid/path
|
||||
|
||||
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
|
||||
|
||||
test::one "Export: yaml" --exit=0 --stdout='{"testMap":{"something":"something"},"testScalar":true}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/yaml
|
||||
|
||||
test::one "Export: bool" --exit=0 --stdout='{"test":true}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/export/bool
|
||||
}
|
||||
|
||||
test::copy(){
|
||||
test::one "Copy: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/copy/valid/component
|
||||
test::one "Copy: valid script" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/copy/valid/script
|
||||
|
||||
disable test::one "Copy: invalid caching (FIXME https://github.com/blocklayerhq/dagger/issues/44)" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/copy/invalid/cache
|
||||
}
|
||||
|
||||
test::load(){
|
||||
test::one "Load: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/load/valid/component
|
||||
test::one "Load: valid script" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/load/valid/script
|
||||
|
||||
test::one "Load: invalid caching (FIXME https://github.com/blocklayerhq/dagger/issues/44)" --exit=1 --stdout= \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/load/invalid/cache
|
||||
}
|
||||
|
||||
test::local(){
|
||||
disable "" "There are no local tests right now (the feature is possibly not functioning at all: see https://github.com/blocklayerhq/dagger/issues/41)"
|
||||
}
|
||||
|
||||
|
||||
test::mount(){
|
||||
disable test::one "Mount: tmpfs (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mount/valid/tmpfs
|
||||
|
||||
disable test::one "Mount: cache (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mount/valid/cache
|
||||
|
||||
disable test::one "Mount: component (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mount/valid/component
|
||||
|
||||
disable test::one "Mount: script (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \
|
||||
"$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-cue '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-cue 'in: "foobar"' "$d"/input/default
|
||||
}
|
||||
|
||||
|
||||
test::all(){
|
||||
local dagger="$1"
|
||||
|
||||
test::load "$dagger"
|
||||
test::mount "$dagger"
|
||||
|
||||
test::copy "$dagger"
|
||||
test::local "$dagger"
|
||||
test::compute "$dagger"
|
||||
test::fetchcontainer "$dagger"
|
||||
test::fetchgit "$dagger"
|
||||
test::exec "$dagger"
|
||||
test::export "$dagger"
|
||||
test::input "$dagger"
|
||||
}
|
||||
|
||||
case "${1:-all}" in
|
||||
# Help
|
||||
--help)
|
||||
echo "Run all known tests:"
|
||||
echo " ./test.sh"
|
||||
echo "Run a specific cue module with expectations (all flags are optional if you just expect the command to succeed with no output validation:"
|
||||
echo " ./test.sh cuefolder --exit=1 --stderr=lala --stdout=foo"
|
||||
;;
|
||||
# Run all tests
|
||||
"all")
|
||||
test::all "$DAGGER_BINARY"
|
||||
;;
|
||||
# Anything else means a single / custom test
|
||||
*)
|
||||
test::one "on demand $1" "$DAGGER_BINARY" compute "$@"
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user