tests: convert tests to new style

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-10-20 12:03:22 -07:00
parent c08f619b02
commit d763976ea9
13 changed files with 79 additions and 104 deletions

View File

@ -1,23 +1,22 @@
package testing
import "alpha.dagger.io/dagger/op"
A: {
result: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo '{"result": "from A"}' > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"
@ -29,20 +28,17 @@ B: {
result: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo "{\\"result\\": \\"dependency \(A.result)\\"}" > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -1,23 +1,21 @@
package testing
import "alpha.dagger.io/dagger/op"
A: {
result: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo '{"result": "from A"}' > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"
@ -29,12 +27,10 @@ B: {
result: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
env: DATA: A.result
args: ["sh", "-c", """
echo "{\\"result\\": \\"dependency $DATA\\"}" > /tmp/out
@ -42,8 +38,7 @@ B: {
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -1,25 +1,25 @@
package testing
import "encoding/json"
import (
"encoding/json"
"alpha.dagger.io/dagger/op"
)
A: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo '{"hello": "world"}' > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "string"
@ -33,20 +33,17 @@ B: {
result: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo "{\\"result\\": \\"unmarshalled.hello=\(unmarshalled.hello)\\"}" > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -1,25 +1,24 @@
package testing
import "alpha.dagger.io/dagger/op"
X1=in: string | *"default input"
test: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo -n "received: \(X1)" > /out
"""]
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
dir: "/"
},
{
do: "export"
op.#Export & {
source: "/out"
format: "string"
},

View File

@ -1,25 +1,24 @@
package testing
import "alpha.dagger.io/dagger/op"
X1=in: string
test: {
string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo -n "received: \(X1)" > /out
"""]
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
dir: "/"
},
{
do: "export"
op.#Export & {
source: "/out"
format: "string"
},

View File

@ -1,17 +1,19 @@
package testing
import "alpha.dagger.io/dagger/op"
new_prop: "lala"
#new_def: "lala"
new_prop_too: string
#new_def_too: string
#up: [{
do: "fetch-container"
ref: "busybox"
},
{
do: "exec"
#up: [
op.#FetchContainer & {
ref: "busybox"
},
op.#Exec & {
args: ["true"]
dir: "/"
}]
},
]

View File

@ -1,5 +1,7 @@
package testing
import "alpha.dagger.io/dagger/op"
foo: {
new_prop: "lala"
#new_def: "lala"
@ -7,13 +9,13 @@ foo: {
new_prop_too: string
#new_def_too: string
#up: [{
do: "fetch-container"
ref: "busybox"
},
{
do: "exec"
#up: [
op.#FetchContainer & {
ref: "busybox"
},
op.#Exec & {
args: ["true"]
dir: "/"
}]
},
]
}

View File

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

View File

@ -1,15 +1,14 @@
package def
import "alpha.dagger.io/dagger/op"
#dang: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
dir: "/"
op.#Exec & {
args: ["sh", "-c", """
echo success
"""]

View File

@ -1,15 +1,14 @@
package nonoptional
import "alpha.dagger.io/dagger/op"
dang: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
dir: "/"
op.#Exec & {
args: ["sh", "-c", """
echo "This test SHOULD fail, because this SHOULD be executed"
exit 1

View File

@ -1,15 +1,14 @@
package optional
import "alpha.dagger.io/dagger/op"
dang?: string
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
dir: "/"
op.#Exec & {
args: ["sh", "-c", """
echo success
"""]

View File

@ -44,20 +44,16 @@ TestExportList: {
[...string]
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo '["milk", "pumpkin pie", "eggs", "juice"]' > /tmp/out
""",
]
dir: "/"
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "json"

View File

@ -27,22 +27,17 @@ TestExportList: {
[...string]
#up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#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"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "yaml"
@ -51,19 +46,16 @@ TestExportList: {
}
TestExportMap: #up: [
{
do: "fetch-container"
op.#FetchContainer & {
ref: "alpine"
},
{
do: "exec"
op.#Exec & {
args: ["sh", "-c", """
echo something: something > /tmp/out
""",
]
},
{
do: "export"
op.#Export & {
// Source path in the container
source: "/tmp/out"
format: "yaml"