Add test
Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
parent
b3ac2b7167
commit
43b9df74a8
@ -130,7 +130,13 @@ func doHelp(cmd *cobra.Command, _ []string) {
|
||||
|
||||
p, err := loadPlan()
|
||||
if err != nil {
|
||||
errorMsg = "Error: failed to load plan\n\n"
|
||||
errstring := err.Error()
|
||||
if strings.Contains(errstring, "cannot find package") && strings.Contains(errstring, "alpha.dagger.io") {
|
||||
errorMsg = "Attempting to load a dagger 0.1.0 project. Please upgrade your config to be compatible with this version of dagger. Contact the Dagger team if you need help!\n\n"
|
||||
// lg.Fatal().Msg("Attempting to load a dagger 0.1.0 project. Please upgrade your config to be compatible with this version of dagger. Contact the Dagger team if you need help!")
|
||||
} else {
|
||||
errorMsg = "Error: failed to load plan\n\n"
|
||||
}
|
||||
} else {
|
||||
loadedMsg = "Plan loaded from " + planPath
|
||||
actionLookupPath := getTargetPath(cmd.Flags().Args())
|
||||
|
@ -38,6 +38,11 @@ setup() {
|
||||
refute_output --partial 'client.filesystem."./dependent_do".write'
|
||||
}
|
||||
|
||||
@test "plan/do: Nice error message for 0.1.0 projects" {
|
||||
run "$DAGGER" "do" -p ./plan/do/error_message_for_0.1_projects.cue
|
||||
assert_output --partial "Attempting to load a 0.1.0 plan."
|
||||
}
|
||||
|
||||
@test "plan/hello" {
|
||||
# Europa loader handles the cwd differently, therefore we need to CD into the tree at or below the parent of cue.mod
|
||||
cd "$TESTDIR"
|
||||
|
60
tests/plan/do/error_message_for_0.1_projects.cue
Normal file
60
tests/plan/do/error_message_for_0.1_projects.cue
Normal file
@ -0,0 +1,60 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/aws/s3"
|
||||
"alpha.dagger.io/netlify"
|
||||
"alpha.dagger.io/os"
|
||||
)
|
||||
|
||||
repo: dagger.#Artifact & dagger.#Input
|
||||
|
||||
hello: {
|
||||
|
||||
dir: dagger.#Artifact & dagger.#Input
|
||||
|
||||
ctr: os.#Container & {
|
||||
command: """
|
||||
ls -l /src > /tmp/out
|
||||
"""
|
||||
mount: "/src": from: dir
|
||||
}
|
||||
|
||||
f: os.#File & {
|
||||
from: ctr
|
||||
path: "/tmp/out"
|
||||
}
|
||||
|
||||
message: f.contents & dagger.#Output
|
||||
}
|
||||
|
||||
// Website
|
||||
web: {
|
||||
source: os.#Dir & {
|
||||
from: repo
|
||||
path: "web"
|
||||
}
|
||||
|
||||
url: string & dagger.#Output
|
||||
|
||||
// Where to host the website?
|
||||
provider: *"s3" | "netlify" & dagger.#Input
|
||||
|
||||
// Deploy to AWS S3
|
||||
if provider == "s3" {
|
||||
url: "\(bucket.url)index.html"
|
||||
bucket: s3.#Put & {
|
||||
contentType: "text/html"
|
||||
"source": source
|
||||
}
|
||||
}
|
||||
|
||||
// Deploy to Netlify
|
||||
if provider == "netlify" {
|
||||
url: site.url
|
||||
|
||||
site: netlify.#Site & {
|
||||
contents: source
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user