tests: split integration tests
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
51
tests/compute/dependencies/interpolation/main.cue
Normal file
51
tests/compute/dependencies/interpolation/main.cue
Normal file
@@ -0,0 +1,51 @@
|
||||
package testing
|
||||
|
||||
A: {
|
||||
result: string
|
||||
|
||||
#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
|
||||
|
||||
#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"
|
||||
},
|
||||
]
|
||||
}
|
52
tests/compute/dependencies/simple/main.cue
Normal file
52
tests/compute/dependencies/simple/main.cue
Normal file
@@ -0,0 +1,52 @@
|
||||
package testing
|
||||
|
||||
A: {
|
||||
result: string
|
||||
|
||||
#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
|
||||
|
||||
#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"
|
||||
},
|
||||
]
|
||||
}
|
55
tests/compute/dependencies/unmarshal/main.cue
Normal file
55
tests/compute/dependencies/unmarshal/main.cue
Normal file
@@ -0,0 +1,55 @@
|
||||
package testing
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
A: {
|
||||
string
|
||||
|
||||
#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
|
||||
|
||||
#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"
|
||||
},
|
||||
]
|
||||
}
|
41
tests/compute/ignore/main.cue
Normal file
41
tests/compute/ignore/main.cue
Normal file
@@ -0,0 +1,41 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"dagger.io/alpine"
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/llb"
|
||||
)
|
||||
|
||||
TestData: dagger.#Artifact
|
||||
|
||||
_expected: """
|
||||
/src/b.txt
|
||||
|
||||
/src/foo:
|
||||
bar.txt
|
||||
|
||||
"""
|
||||
|
||||
TestIgnore: {
|
||||
string
|
||||
#compute: [
|
||||
llb.#Load & {from: alpine.#Image},
|
||||
llb.#Exec & {
|
||||
args: ["sh", "-c", "ls /src/* > /out.txt"]
|
||||
mount: "/src": from: TestData
|
||||
},
|
||||
llb.#Export & {source: "/out.txt"},
|
||||
llb.#Exec & {
|
||||
args: [
|
||||
"sh",
|
||||
"-ec",
|
||||
"""
|
||||
cat > /test.txt << EOF
|
||||
\(_expected)
|
||||
EOF
|
||||
test "$(cat /out.txt)" = "$(cat /test.txt)"
|
||||
""",
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
2
tests/compute/ignore/testdata/.daggerignore
vendored
Normal file
2
tests/compute/ignore/testdata/.daggerignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
a.txt
|
||||
*/*.json
|
0
tests/compute/ignore/testdata/a.txt
vendored
Normal file
0
tests/compute/ignore/testdata/a.txt
vendored
Normal file
0
tests/compute/ignore/testdata/b.txt
vendored
Normal file
0
tests/compute/ignore/testdata/b.txt
vendored
Normal file
0
tests/compute/ignore/testdata/foo/bar.txt
vendored
Normal file
0
tests/compute/ignore/testdata/foo/bar.txt
vendored
Normal file
0
tests/compute/ignore/testdata/foo/cow.json
vendored
Normal file
0
tests/compute/ignore/testdata/foo/cow.json
vendored
Normal file
Reference in New Issue
Block a user