cue native: environments can reference a module instead of embedding
one. Fixes #631 Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
committed by
Solomon Hykes
parent
8de58eb3d0
commit
f39a88e644
@@ -38,6 +38,52 @@ setup() {
|
||||
assert_failure
|
||||
}
|
||||
|
||||
# create different environments from the same module
|
||||
@test "dagger new: modules" {
|
||||
"$DAGGER" init
|
||||
|
||||
ln -s "$TESTDIR"/cli/input/simple "$DAGGER_WORKSPACE"/plan
|
||||
|
||||
"$DAGGER" new "a" --module "$DAGGER_WORKSPACE"/plan
|
||||
"$DAGGER" new "b" --module "$DAGGER_WORKSPACE"/plan
|
||||
|
||||
"$DAGGER" input -e "a" text "input" "a"
|
||||
"$DAGGER" input -e "b" text "input" "b"
|
||||
|
||||
"$DAGGER" up -e "a"
|
||||
"$DAGGER" up -e "b"
|
||||
|
||||
run "$DAGGER" query -l error -e "a" input -f text
|
||||
assert_success
|
||||
assert_output "a"
|
||||
|
||||
run "$DAGGER" query -l error -e "b" input -f text
|
||||
assert_success
|
||||
assert_output "b"
|
||||
}
|
||||
|
||||
# create different environments from the same module,
|
||||
# using different packages.
|
||||
@test "dagger new: packages" {
|
||||
"$DAGGER" init
|
||||
|
||||
ln -s "$TESTDIR"/cli/packages "$DAGGER_WORKSPACE"/plan
|
||||
|
||||
"$DAGGER" new "a" --module "$DAGGER_WORKSPACE"/plan --package dagger.io/test/a
|
||||
"$DAGGER" new "b" --module "$DAGGER_WORKSPACE"/plan --package dagger.io/test/b
|
||||
|
||||
"$DAGGER" up -e "a"
|
||||
"$DAGGER" up -e "b"
|
||||
|
||||
run "$DAGGER" query -l error -e "a" exp -f text
|
||||
assert_success
|
||||
assert_output "a"
|
||||
|
||||
run "$DAGGER" query -l error -e "b" exp -f text
|
||||
assert_success
|
||||
assert_output "b"
|
||||
}
|
||||
|
||||
@test "dagger query" {
|
||||
"$DAGGER" init
|
||||
|
||||
|
19
tests/cli/packages/a/main.cue
Normal file
19
tests/cli/packages/a/main.cue
Normal file
@@ -0,0 +1,19 @@
|
||||
package a
|
||||
|
||||
import "dagger.io/dagger/op"
|
||||
|
||||
exp: {
|
||||
string
|
||||
#up: [
|
||||
op.#FetchContainer & {ref: "busybox"},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", """
|
||||
printf a > /export
|
||||
"""]
|
||||
},
|
||||
op.#Export & {
|
||||
source: "/export"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
19
tests/cli/packages/b/main.cue
Normal file
19
tests/cli/packages/b/main.cue
Normal file
@@ -0,0 +1,19 @@
|
||||
package b
|
||||
|
||||
import "dagger.io/dagger/op"
|
||||
|
||||
exp: {
|
||||
string
|
||||
#up: [
|
||||
op.#FetchContainer & {ref: "busybox"},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", """
|
||||
printf b > /export
|
||||
"""]
|
||||
},
|
||||
op.#Export & {
|
||||
source: "/export"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
1
tests/cli/packages/cue.mod/module.cue
Normal file
1
tests/cli/packages/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: "dagger.io/test"
|
@@ -20,11 +20,11 @@ common_setup() {
|
||||
dagger_new_with_plan() {
|
||||
local name="$1"
|
||||
local sourcePlan="$2"
|
||||
local targetPlan="$DAGGER_WORKSPACE"/.dagger/env/"$name"/plan
|
||||
local targetPlan="$DAGGER_WORKSPACE"/"$name"
|
||||
|
||||
"$DAGGER" new "$name"
|
||||
rmdir "$targetPlan"
|
||||
ln -s "$sourcePlan" "$targetPlan"
|
||||
"$DAGGER" new "$name" --module "$targetPlan"
|
||||
|
||||
}
|
||||
|
||||
skip_unless_secrets_available() {
|
||||
|
Reference in New Issue
Block a user