tests: move compute tests away
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
1
tests/core/compute/invalid/bool/cue.mod/module.cue
Normal file
1
tests/core/compute/invalid/bool/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/invalid/bool/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/invalid/bool/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
3
tests/core/compute/invalid/bool/main.cue
Normal file
3
tests/core/compute/invalid/bool/main.cue
Normal file
@@ -0,0 +1,3 @@
|
||||
package testing
|
||||
|
||||
#up: true
|
1
tests/core/compute/invalid/int/cue.mod/module.cue
Normal file
1
tests/core/compute/invalid/int/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/invalid/int/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/invalid/int/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
3
tests/core/compute/invalid/int/main.cue
Normal file
3
tests/core/compute/invalid/int/main.cue
Normal file
@@ -0,0 +1,3 @@
|
||||
package testing
|
||||
|
||||
#up: 123
|
1
tests/core/compute/invalid/string/cue.mod/module.cue
Normal file
1
tests/core/compute/invalid/string/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/invalid/string/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/invalid/string/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
3
tests/core/compute/invalid/string/main.cue
Normal file
3
tests/core/compute/invalid/string/main.cue
Normal file
@@ -0,0 +1,3 @@
|
||||
package testing
|
||||
|
||||
#up: "whatever"
|
1
tests/core/compute/invalid/struct/cue.mod/module.cue
Normal file
1
tests/core/compute/invalid/struct/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/invalid/struct/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/invalid/struct/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
3
tests/core/compute/invalid/struct/main.cue
Normal file
3
tests/core/compute/invalid/struct/main.cue
Normal file
@@ -0,0 +1,3 @@
|
||||
package testing
|
||||
|
||||
#up: whatever: "wrong"
|
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/success/exec-nocache/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/success/exec-nocache/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
25
tests/core/compute/success/exec-nocache/main.cue
Normal file
25
tests/core/compute/success/exec-nocache/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/alpine"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
rand: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
always: true
|
||||
args: ["sh", "-c", """
|
||||
tr -dc A-Za-z0-9 </dev/urandom | head -c 13 > /id
|
||||
"""]
|
||||
},
|
||||
op.#Export & {source: "/id"},
|
||||
]
|
||||
}
|
||||
|
||||
// If rand is executed twice, cue won't validate
|
||||
ref1: rand
|
||||
ref2: ref1
|
1
tests/core/compute/success/noop/cue.mod/module.cue
Normal file
1
tests/core/compute/success/noop/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/success/noop/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/success/noop/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
6
tests/core/compute/success/noop/main.cue
Normal file
6
tests/core/compute/success/noop/main.cue
Normal file
@@ -0,0 +1,6 @@
|
||||
package testing
|
||||
|
||||
// no-op, should not error
|
||||
empty: {
|
||||
#up: []
|
||||
}
|
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/success/overload/flat/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/success/overload/flat/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
19
tests/core/compute/success/overload/flat/main.cue
Normal file
19
tests/core/compute/success/overload/flat/main.cue
Normal file
@@ -0,0 +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: [
|
||||
op.#FetchContainer & {
|
||||
ref: "busybox"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
},
|
||||
]
|
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/success/overload/wrapped/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/success/overload/wrapped/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
21
tests/core/compute/success/overload/wrapped/main.cue
Normal file
21
tests/core/compute/success/overload/wrapped/main.cue
Normal file
@@ -0,0 +1,21 @@
|
||||
package testing
|
||||
|
||||
import "alpha.dagger.io/dagger/op"
|
||||
|
||||
foo: {
|
||||
new_prop: "lala"
|
||||
#new_def: "lala"
|
||||
|
||||
new_prop_too: string
|
||||
#new_def_too: string
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "busybox"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
},
|
||||
]
|
||||
}
|
1
tests/core/compute/success/simple/cue.mod/module.cue
Normal file
1
tests/core/compute/success/simple/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/compute/success/simple/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/compute/success/simple/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
13
tests/core/compute/success/simple/main.cue
Normal file
13
tests/core/compute/success/simple/main.cue
Normal file
@@ -0,0 +1,13 @@
|
||||
package testing
|
||||
|
||||
import "alpha.dagger.io/dagger/op"
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "busybox"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["true"]
|
||||
dir: "/"
|
||||
},
|
||||
]
|
1
tests/core/dependencies/interpolation/cue.mod/module.cue
Normal file
1
tests/core/dependencies/interpolation/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/dependencies/interpolation/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/dependencies/interpolation/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
47
tests/core/dependencies/interpolation/main.cue
Normal file
47
tests/core/dependencies/interpolation/main.cue
Normal file
@@ -0,0 +1,47 @@
|
||||
package testing
|
||||
|
||||
import "alpha.dagger.io/dagger/op"
|
||||
|
||||
A: {
|
||||
result: string
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "alpine"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", """
|
||||
echo '{"result": "from A"}' > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
op.#Export & {
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
B: {
|
||||
result: string
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "alpine"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", """
|
||||
echo "{\\"result\\": \\"dependency \(A.result)\\"}" > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
op.#Export & {
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
1
tests/core/dependencies/simple/cue.mod/module.cue
Normal file
1
tests/core/dependencies/simple/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/dependencies/simple/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/dependencies/simple/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
47
tests/core/dependencies/simple/main.cue
Normal file
47
tests/core/dependencies/simple/main.cue
Normal file
@@ -0,0 +1,47 @@
|
||||
package testing
|
||||
|
||||
import "alpha.dagger.io/dagger/op"
|
||||
|
||||
A: {
|
||||
result: string
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "alpine"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", """
|
||||
echo '{"result": "from A"}' > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
op.#Export & {
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
B: {
|
||||
result: string
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "alpine"
|
||||
},
|
||||
op.#Exec & {
|
||||
env: DATA: A.result
|
||||
args: ["sh", "-c", """
|
||||
echo "{\\"result\\": \\"dependency $DATA\\"}" > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
op.#Export & {
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
1
tests/core/dependencies/unmarshal/cue.mod/module.cue
Normal file
1
tests/core/dependencies/unmarshal/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/dependencies/unmarshal/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/dependencies/unmarshal/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
52
tests/core/dependencies/unmarshal/main.cue
Normal file
52
tests/core/dependencies/unmarshal/main.cue
Normal file
@@ -0,0 +1,52 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
A: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "alpine"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", """
|
||||
echo '{"hello": "world"}' > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
op.#Export & {
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
unmarshalled: json.Unmarshal(A)
|
||||
|
||||
B: {
|
||||
result: string
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "alpine"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", """
|
||||
echo "{\\"result\\": \\"unmarshalled.hello=\(unmarshalled.hello)\\"}" > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
op.#Export & {
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
2
tests/core/exclude/.dagger/env/default/.gitignore
vendored
Normal file
2
tests/core/exclude/.dagger/env/default/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
1
tests/core/exclude/.dagger/env/default/plan/cue.mod/module.cue
vendored
Normal file
1
tests/core/exclude/.dagger/env/default/plan/cue.mod/module.cue
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/exclude/.dagger/env/default/plan/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/exclude/.dagger/env/default/plan/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
41
tests/core/exclude/.dagger/env/default/plan/main.cue
vendored
Normal file
41
tests/core/exclude/.dagger/env/default/plan/main.cue
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/alpine"
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
TestData: dagger.#Artifact
|
||||
|
||||
_expected: """
|
||||
/src/b.txt
|
||||
|
||||
/src/foo:
|
||||
bar.txt
|
||||
|
||||
"""
|
||||
|
||||
TestIgnore: {
|
||||
string
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "ls /src/* > /out.txt"]
|
||||
mount: "/src": from: TestData
|
||||
},
|
||||
op.#Export & {source: "/out.txt"},
|
||||
op.#Exec & {
|
||||
args: [
|
||||
"sh",
|
||||
"-ec",
|
||||
"""
|
||||
cat > /test.txt << EOF
|
||||
\(_expected)
|
||||
EOF
|
||||
test "$(cat /out.txt)" = "$(cat /test.txt)"
|
||||
""",
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
30
tests/core/exclude/.dagger/env/default/values.yaml
vendored
Normal file
30
tests/core/exclude/.dagger/env/default/values.yaml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
plan:
|
||||
module: .dagger/env/default/plan
|
||||
name: default
|
||||
inputs:
|
||||
TestData:
|
||||
dir:
|
||||
path: ./testdata
|
||||
exclude:
|
||||
- a.txt
|
||||
- '*/*.json'
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSArcmRHMFByQkZSdGhteHhm
|
||||
T2pSWW1UcU5LaFJabFJORllydFk3UkVsSHhVCndQZWNUKzVOeUovTTdCR3FmUXpO
|
||||
c29GQXhpZkxwSmoweWxqZG1CMkcrRGcKLS0tIDhRMTVSc3NXSWIxSm55TGkwT1E1
|
||||
L0NzY0RIMWNkc3k2WStOUGg4SndNRm8Kk7QSP/8spn1Set08VejVW9k4ZwBFqR0T
|
||||
Ff/N73yNvo633hrfEJtTkhA/aZYyG9bPJy9s9vRDoNFkdTLSFcYX5g==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-06-15T16:27:05Z"
|
||||
mac: ENC[AES256_GCM,data:XQyAun4JVQxzV9eqte3dpQb8YP9ylWhnW5gLB3avpOZks/CVUN4Ewgob5tA4FB5S4x1Syk/D8ts32nQoEd0HUkdqTMjnGjcXdNiH/iT+k+LrVX30uAZ3JLXmzBfP9WnfJXlKVYaWXWSokiQJmYjXtmotr9rMl7rQeixGZfYcsns=,iv:LyfYlgbiiTh1oapa/h7FUGjd8xGlrD0M9+bxkP5HT6A=,tag:bhw5k2/4zGCxC0nnV4zwDw==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
0
tests/core/exclude/testdata/a.txt
vendored
Normal file
0
tests/core/exclude/testdata/a.txt
vendored
Normal file
0
tests/core/exclude/testdata/b.txt
vendored
Normal file
0
tests/core/exclude/testdata/b.txt
vendored
Normal file
0
tests/core/exclude/testdata/foo/bar.txt
vendored
Normal file
0
tests/core/exclude/testdata/foo/bar.txt
vendored
Normal file
0
tests/core/exclude/testdata/foo/cow.json
vendored
Normal file
0
tests/core/exclude/testdata/foo/cow.json
vendored
Normal file
1
tests/core/secrets/invalid/env/cue.mod/module.cue
vendored
Normal file
1
tests/core/secrets/invalid/env/cue.mod/module.cue
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/secrets/invalid/env/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/secrets/invalid/env/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
21
tests/core/secrets/invalid/env/env.cue
vendored
Normal file
21
tests/core/secrets/invalid/env/env.cue
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
mySecret: dagger.#Secret
|
||||
|
||||
TestSecrets: #up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
package: bash: "=~5.1"
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
env: foo: mySecret
|
||||
},
|
||||
]
|
1
tests/core/secrets/invalid/string/cue.mod/module.cue
Normal file
1
tests/core/secrets/invalid/string/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/secrets/invalid/string/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/secrets/invalid/string/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
21
tests/core/secrets/invalid/string/string.cue
Normal file
21
tests/core/secrets/invalid/string/string.cue
Normal file
@@ -0,0 +1,21 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
mySecret: dagger.#Secret
|
||||
|
||||
TestString: #up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
package: bash: "=~5.1"
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
mount: "/secret": secret: mySecret
|
||||
args: ["true"]
|
||||
},
|
||||
]
|
1
tests/core/secrets/simple/cue.mod/module.cue
Normal file
1
tests/core/secrets/simple/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: ""
|
2
tests/core/secrets/simple/cue.mod/pkg/.gitignore
vendored
Normal file
2
tests/core/secrets/simple/cue.mod/pkg/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
32
tests/core/secrets/simple/simple.cue
Normal file
32
tests/core/secrets/simple/simple.cue
Normal file
@@ -0,0 +1,32 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
mySecret: dagger.#Secret
|
||||
|
||||
TestSecrets: #up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
package: bash: "=~5.1"
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
mount: "/secret": secret: mySecret
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
test "$(cat /secret)" = "SecretValue"
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
]
|
Reference in New Issue
Block a user