netlify: cleanup tests
Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
parent
20e1ac9d7f
commit
7502bc876b
@ -1,56 +0,0 @@
|
||||
package yarn
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/netlify"
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/bash"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
inputs: secrets: test: command: {
|
||||
name: "sops"
|
||||
args: ["-d", "../../test_secrets.yaml"]
|
||||
}
|
||||
|
||||
actions: {
|
||||
testSecrets: dagger.#DecodeSecret & {
|
||||
input: inputs.secrets.test.contents
|
||||
format: "yaml"
|
||||
}
|
||||
|
||||
marker: "hello world"
|
||||
|
||||
data: engine.#WriteFile & {
|
||||
input: engine.#Scratch
|
||||
path: "index.html"
|
||||
contents: marker
|
||||
}
|
||||
|
||||
// Deploy to netlify
|
||||
deploy: netlify.#Deploy & {
|
||||
team: "blocklayer"
|
||||
token: testSecrets.output.netlifyToken.contents
|
||||
|
||||
site: "dagger-test"
|
||||
contents: data.output
|
||||
}
|
||||
|
||||
image: alpine.#Build & {
|
||||
packages: {
|
||||
bash: {}
|
||||
curl: {}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the website was deployed
|
||||
verify: bash.#Run & {
|
||||
input: image.output
|
||||
script: contents: #"""
|
||||
test "$(curl \#(deploy.deployUrl))" = "\#(marker)"
|
||||
"""#
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,6 @@ setup() {
|
||||
common_setup
|
||||
}
|
||||
|
||||
@test "netlify.#Deploy" {
|
||||
dagger up ./netlify-test.cue
|
||||
@test "netlify" {
|
||||
dagger up
|
||||
}
|
59
pkg/universe.dagger.io/netlify/test/test.cue
Normal file
59
pkg/universe.dagger.io/netlify/test/test.cue
Normal file
@ -0,0 +1,59 @@
|
||||
package yarn
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/netlify"
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/bash"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
inputs: secrets: test: command: {
|
||||
name: "sops"
|
||||
args: ["-d", "../../test_secrets.yaml"]
|
||||
}
|
||||
|
||||
actions: tests: {
|
||||
// Test: netlify.#Deploy correctly receives API token
|
||||
receiveToken: {
|
||||
testSecrets: dagger.#DecodeSecret & {
|
||||
input: inputs.secrets.test.contents
|
||||
format: "yaml"
|
||||
}
|
||||
|
||||
marker: "hello world"
|
||||
|
||||
data: engine.#WriteFile & {
|
||||
input: engine.#Scratch
|
||||
path: "index.html"
|
||||
contents: marker
|
||||
}
|
||||
|
||||
// Deploy to netlify
|
||||
deploy: netlify.#Deploy & {
|
||||
team: "blocklayer"
|
||||
token: testSecrets.output.netlifyToken.contents
|
||||
|
||||
site: "dagger-test"
|
||||
contents: data.output
|
||||
}
|
||||
|
||||
image: alpine.#Build & {
|
||||
packages: {
|
||||
bash: {}
|
||||
curl: {}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the website was deployed
|
||||
verify: bash.#Run & {
|
||||
input: image.output
|
||||
script: contents: #"""
|
||||
test "$(curl \#(deploy.deployUrl))" = "\#(marker)"
|
||||
"""#
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user