tests: ops: use proper imports

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-04-14 16:44:34 -07:00
parent 381db37ca3
commit 1f640d3e25
48 changed files with 325 additions and 357 deletions

View File

@ -1,21 +1,24 @@
package testing
import "dagger.io/dagger/op"
test1: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox"
},
{
do: "copy"
from: [{do: "fetch-container", ref: "alpine"}]
op.#Copy & {
from: [
op.#FetchContainer & {
ref: "alpine"
},
]
src: "/etc/issue"
dest: "/"
},
{
do: "export"
op.#Export & {
source: "/issue"
format: "string"
},
@ -26,18 +29,19 @@ test2: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox"
},
{
do: "copy"
from: [{do: "fetch-container", ref: "busybox"}]
op.#Copy & {
from: [
op.#FetchContainer & {
ref: "busybox"
},
]
src: "/etc/issue"
dest: "/"
},
{
do: "export"
op.#Export & {
source: "/issue"
format: "string"
},

View File

@ -1,32 +1,31 @@
package testing
component: #up: [{
do: "fetch-container"
import "dagger.io/dagger/op"
component: #up: [
op.#FetchContainer & {
ref: "alpine"
}, {
do: "exec"
},
op.#Exec & {
args: ["sh", "-c", """
printf lol > /id
"""]
dir: "/"
}]
},
]
test1: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox"
},
{
do: "copy"
op.#Copy & {
from: component
src: "/id"
dest: "/"
},
{
do: "export"
op.#Export & {
source: "/id"
format: "string"
},
@ -37,27 +36,24 @@ test2: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox"
},
{
do: "copy"
from: #up: [{
do: "fetch-container"
op.#Copy & {
from: #up: [
op.#FetchContainer & {
ref: "alpine"
}, {
do: "exec"
},
op.#Exec & {
args: ["sh", "-c", """
printf lol > /id
"""]
dir: "/"
}]
},
]
src: "/id"
dest: "/"
},
{
do: "export"
op.#Export & {
source: "/id"
format: "string"
},

View File

@ -1,21 +1,24 @@
package testing
import "dagger.io/dagger/op"
test: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox"
},
{
do: "copy"
from: [{do: "fetch-container", ref: "alpine"}]
op.#Copy & {
from: [
op.#FetchContainer & {
ref: "alpine"
},
]
src: "/etc/issue"
dest: "/"
},
{
do: "export"
op.#Export & {
source: "/issue"
format: "string"
},

View File

@ -1,12 +1,12 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["echo", "always output"]
always: true
},

View File

@ -1,12 +1,12 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo "pwd is: $(pwd)"
[ "$(pwd)" == "/thisisnonexistent" ] || exit 1

View File

@ -1,12 +1,12 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo "pwd is: $(pwd)"
[ "$(pwd)" == "/etc" ] || exit 1

View File

@ -1,12 +1,12 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", #"""
echo "$foo"
"""#]

View File

@ -1,14 +1,14 @@
package testing
import "dagger.io/dagger/op"
bar: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo "foo: $foo"
[ "$foo" == "overlay environment" ] || exit 1

View File

@ -1,12 +1,13 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
op.#FetchContainer & {
do: "fetch-container"
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
[ "$foo" == "output environment" ] || exit 1
"""]

View File

@ -1,12 +1,12 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["erroringout"]
},
]

View File

@ -1,14 +1,12 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", "exit 123"]
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
dir: "/"
},
]

View File

@ -1,11 +1,11 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
},
]

View File

@ -1,12 +1,12 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["echo", "simple output"]
},
]

View File

@ -1,15 +1,15 @@
package testing
import "dagger.io/dagger/op"
hello: "world"
bar: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
dir: "/"
args: ["sh", "-c", """
echo \(hello)

View File

@ -1,15 +1,15 @@
package testing
import "dagger.io/dagger/op"
hello: "world"
bar: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
dir: "/"
args: ["sh", "-c", """
echo \(bar)

View File

@ -1,12 +1,12 @@
package testing
import (
"dagger.io/dagger/op"
"dagger.io/def"
)
#up: [
{
do: "load",
op.#Load & {
from: def
},
]

View File

@ -2,11 +2,11 @@ package testing
import (
"dagger.io/nonoptional"
"dagger.io/dagger/op"
)
#up: [
{
do: "load",
op.#Load & {
from: nonoptional
},
]

View File

@ -2,11 +2,11 @@ package testing
import (
"dagger.io/optional"
"dagger.io/dagger/op"
)
#up: [
{
do: "load",
op.#Load & {
from: optional
},
]

View File

@ -1,23 +1,22 @@
package testing
import "dagger.io/dagger/op"
test: {
bool
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
printf "true" > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -1,23 +1,22 @@
package testing
import "dagger.io/dagger/op"
test1: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol1 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -28,20 +27,17 @@ test2: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol2 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -52,20 +48,17 @@ test3: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol3 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -76,20 +69,17 @@ test4: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol4 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -100,20 +90,16 @@ test5: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol5 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -124,20 +110,16 @@ test6: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol6 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -148,20 +130,16 @@ test7: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol7 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -172,20 +150,17 @@ test8: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol8 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -196,20 +171,17 @@ test9: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol9 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},
@ -220,20 +192,17 @@ test10: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo lol10 > /tmp/out
"""]
dir: "/"
always: true
},
{
do: "export"
op.#Export & {
source: "/tmp/out"
format: "string"
},

View File

@ -1,22 +1,21 @@
package testing
import "dagger.io/dagger/op"
test: {
float
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo -123.5 > /tmp/out
""",
]
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -1,22 +1,21 @@
package testing
import "dagger.io/dagger/op"
teststring: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo something > /tmp/out
""",
]
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "lalalalal"

View File

@ -4,12 +4,10 @@ teststring: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/lalala"
format: "string"

View File

@ -1,23 +1,22 @@
package testing
import "dagger.io/dagger/op"
test: {
string
=~"^NAAAA.+"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
printf something > /tmp/out
""",
]
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "string"

View File

@ -1,23 +1,21 @@
package testing
import "dagger.io/dagger/op"
testScalar: {
bool
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo true > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"
@ -26,20 +24,16 @@ testScalar: {
}
testMap: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo '{"something": "something"}' > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -1,22 +1,21 @@
package testing
import "dagger.io/dagger/op"
test: {
number
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo -123.5 > /tmp/out
""",
]
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -1,22 +1,21 @@
package testing
import "dagger.io/dagger/op"
test: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
printf something > /tmp/out
""",
]
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "string"

View File

@ -1,23 +1,22 @@
package testing
import "dagger.io/dagger/op"
test: {
string
=~"^some.+"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
printf something > /tmp/out
""",
]
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "string"

View File

@ -1,24 +1,21 @@
package testing
import "dagger.io/dagger/op"
testScalar: {
bool
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo true > /tmp/out
""",
]
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "yaml"

View File

@ -1,36 +1,33 @@
package testing
import "dagger.io/dagger/op"
busybox1: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox"
},
]
busybox2: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox:latest"
},
]
busybox3: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox:1.33-musl"
},
]
busybox4: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
},
]
busybox5: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busybox:1.33-musl@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
},
]

View File

@ -1,7 +1,8 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
},
]

View File

@ -1,8 +1,9 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine@sha256:c6c7524e2111f22a9f7577211232d89a9e68cf5b9ed4a41ba77957c9771380a5"
},
]

View File

@ -1,10 +1,11 @@
package testing
import "dagger.io/dagger/op"
// XXX WATCHOUT
// Once buildkit has pulled that digest, it will stay cached and happily succeed WHATEVER the image name then is
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "busyboxaaa@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
},
]

View File

@ -1,8 +1,9 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "doesnotexist"
},
]

View File

@ -1,8 +1,9 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine:doesnotexist"
},
]

View File

@ -1,8 +1,9 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-git"
op.#FetchGit & {
remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "master"
},

View File

@ -1,7 +1,8 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-git"
op.#FetchGit & {
},
]

View File

@ -1,8 +1,9 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-git"
op.#FetchGit & {
remote: "pork://pork"
ref: "master"
},

View File

@ -1,8 +1,9 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-git"
op.#FetchGit & {
remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "lalalalal"
},

View File

@ -1,8 +1,9 @@
package testing
import "dagger.io/dagger/op"
#up: [
{
do: "fetch-git"
op.#FetchGit & {
remote: "https://github.com/blocklayerhq/lalalala.git"
ref: "master"
},

View File

@ -1,15 +1,19 @@
package testing
import "dagger.io/dagger/op"
test1: {
string
#up: [
{
do: "load"
from: [{do: "fetch-container", ref: "alpine"}]
op.#Load & {
from: [
op.#FetchContainer & {
ref: "alpine"
},
{
do: "export"
]
},
op.#Export & {
source: "/etc/issue"
format: "string"
},
@ -20,12 +24,14 @@ test2: {
string
#up: [
{
do: "load"
from: [{do: "fetch-container", ref: "busybox"}]
op.#Load & {
from: [
op.#FetchContainer & {
ref: "busybox"
},
{
do: "export"
]
},
op.#Export & {
source: "/etc/issue"
format: "string"
},

View File

@ -1,26 +1,26 @@
package testing
component: #up: [{
do: "fetch-container"
import "dagger.io/dagger/op"
component: #up: [
op.#FetchContainer & {
ref: "alpine"
}, {
do: "exec"
},
op.#Exec & {
args: ["sh", "-c", """
printf lol > /id
"""]
dir: "/"
}]
},
]
test1: {
string
#up: [
{
do: "load"
op.#Load & {
from: component
},
{
do: "export"
op.#Export & {
source: "/id"
format: "string"
},
@ -31,21 +31,19 @@ test2: {
string
#up: [
{
do: "load"
from: #up: [{
do: "fetch-container"
op.#Load & {
from: #up: [
op.#FetchContainer & {
ref: "alpine"
}, {
do: "exec"
},
op.#Exec & {
args: ["sh", "-c", """
printf lol > /id
"""]
dir: "/"
}]
},
{
do: "export"
]
},
op.#Export & {
source: "/id"
format: "string"
},

View File

@ -1,15 +1,19 @@
package testing
import "dagger.io/dagger/op"
test: {
string
#up: [
{
do: "load"
from: [{do: "fetch-container", ref: "alpine"}]
op.#Load & {
from: [
op.#FetchContainer & {
ref: "alpine"
},
{
do: "export"
]
},
op.#Export & {
source: "/etc/issue"
format: "string"
},

View File

@ -1,23 +1,22 @@
package testing
import "dagger.io/dagger/op"
test: {
string
#up: [
{
do: "load"
op.#Load & {
from: [{do: "fetch-container", ref: "alpine"}]
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo "NOT SURE WHAT TO TEST YET" > /out
"""]
dir: "/"
mount: something: "cache"
},
{
do: "export"
op.#Export & {
source: "/out"
format: "string"
},

View File

@ -1,33 +1,34 @@
package testing
import "dagger.io/dagger/op"
test: {
string
#up: [
{
do: "load"
from: [{do: "fetch-container", ref: "alpine"}]
op.#Load & {
from: [
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
]
},
op.#Exec & {
args: ["sh", "-c", """
cat /mnt/test/lol > /out
"""]
mount: "/mnt/test": from: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo -n "hello world" > /lol
"""]
},
]
},
{
do: "export"
op.#Export & {
source: "/out"
format: "string"
},

View File

@ -1,19 +1,22 @@
package testing
import "dagger.io/dagger/op"
test: {
string
#up: [
{
do: "load"
from: [{do: "fetch-container", ref: "alpine"}]
op.#Load & {
from: [
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
]
},
op.#Exec & {
args: ["sh", "-c", """
ls -lA /lol > /out
"""]
dir: "/"
mount: something: {
input: [{
do: "fetch-container"
@ -22,8 +25,7 @@ test: {
path: "/lol"
}
},
{
do: "export"
op.#Export & {
source: "/out"
format: "string"
},

View File

@ -1,32 +1,33 @@
package testing
import "dagger.io/dagger/op"
test: {
string
#up: [
{
do: "load"
from: [{do: "fetch-container", ref: "alpine"}]
op.#Load & {
from: [
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
]
},
op.#Exec & {
args: ["sh", "-c", """
echo ok > /out
echo ok > /tmpdir/out
"""]
dir: "/"
mount: "/tmpdir": "tmpfs"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
[ -f /out ] || exit 1
# content of /cache/tmp must not exist in this layer
[ ! -f /tmpdir/out ] || exit 1
"""]
},
{
do: "export"
op.#Export & {
source: "/out"
format: "string"
},

View File

@ -1,27 +1,24 @@
package main
import "dagger.io/dagger/op"
hello: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["mkdir", "-p", "/tmp/foo"]
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", "echo -n world > /tmp/foo/hello"]
},
{
do: "subdir"
op.#Subdir & {
dir: "/tmp/foo"
},
{
do: "export"
op.#Export & {
source: "/hello"
format: "string"
},