Merge pull request #47 from dubo-dubon-duponey/moar

MOAR
This commit is contained in:
Andrea Luzzardi 2021-01-15 16:42:13 -08:00 committed by GitHub
commit 4ea9a18434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 510 additions and 10 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.DS_Store

View File

@ -11,7 +11,7 @@ test: {
},
{
do: "copy"
from: [{do: "fetch-container", ref: "busybox"}]
from: [{do: "fetch-container", ref: "alpine"}]
src: "/etc/issue"
dest: "/"
},

View File

@ -0,0 +1,241 @@
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"
},
]
}

View File

@ -1,7 +1,5 @@
package testing
// XXX https://github.com/blocklayerhq/dagger/issues/10 requires that #dagger are nested under https://github.com/blocklayerhq/dagger/issues/21 makes this very hard to verify
busybox1: {
#dagger: compute: [
{

View File

@ -0,0 +1,37 @@
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"
},
]
}
}

View File

@ -0,0 +1,57 @@
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"
},
]
}
}

View File

@ -0,0 +1,20 @@
package testing
test: {
string
#dagger: {
compute: [
{
do: "load"
from: [{do: "fetch-container", ref: "alpine"}]
},
{
do: "export"
source: "/etc/issue"
format: "string"
},
]
}
}

View File

@ -0,0 +1,27 @@
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"
},
]
}
}

View File

@ -0,0 +1,33 @@
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"
},
]
}
}

View File

@ -0,0 +1,33 @@
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"
},
]
}
}

View File

@ -0,0 +1,27 @@
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"
},
]
}
}

View File

@ -102,6 +102,9 @@ test::export(){
test::one "Export: string with additional constraint success" --exit=0 --stdout='{"test":"something"}' \
"$dagger" compute "$d"/export/withvalidation
test::one "Export: many concurrent" --exit=0 \
"$dagger" compute "$d"/export/concurrency
test::one "Export: does not pass additional validation" --exit=1 --stdout= \
"$dagger" compute "$d"/export/invalid/validation
@ -122,32 +125,55 @@ test::export(){
test::copy(){
test::one "Copy: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \
"$dagger" compute "$d"/copy/valid/component
test::one "Copy: valid script" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \
"$dagger" compute "$d"/copy/valid/component
test::one "Copy: valid script" --exit=0 \
"$dagger" compute "$d"/copy/valid/script
disable test::one "Copy: invalid caching (FIXME https://github.com/blocklayerhq/dagger/issues/44)" --exit=1 --stdout= \
"$dagger" compute "$d"/copy/invalid/cache
}
test::load(){
test::one "Load: valid components" --exit=0 --stdout='{"component":{},"test1":"lol","test2":"lol"}' \
"$dagger" compute "$d"/load/valid/component
test::one "Load: valid script" --exit=0 \
"$dagger" compute "$d"/load/valid/script
test::one "Load: invalid caching (FIXME https://github.com/blocklayerhq/dagger/issues/44)" --exit=1 --stdout= \
"$dagger" 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" compute "$d"/mount/valid/tmpfs
disable test::one "Mount: cache (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \
"$dagger" compute "$d"/mount/valid/cache
disable test::one "Mount: component (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \
"$dagger" compute "$d"/mount/valid/component
disable test::one "Mount: script (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \
"$dagger" compute "$d"/mount/valid/script
}
test::all(){
local dagger="$1"
test::local "$dagger"
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::copy "$dagger"
# TODO: exec mounts
# TODO: load
}
case "${1:-all}" in