1004 test implementation
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
parent
ad2f9b3f17
commit
82d45985a5
@ -68,7 +68,7 @@ Although not strictly necessary, for an optimal development experience, we recom
|
||||
|
||||
If you are new to Cue, we recommend keeping the following resources in browser tabs:
|
||||
|
||||
The unofficial but excellent [Cuetorials](https://cuetorials.com/overview/foundations/) in a browser tab, to look up Cue concepts as they appear.
|
||||
- The unofficial but excellent [Cuetorials](https://cuetorials.com/overview/foundations/) in a browser tab, to look up Cue concepts as they appear.
|
||||
|
||||
- The official [Cue interactive sandbox](https://cuelang.org/play) for easy experimentation.
|
||||
|
||||
@ -130,15 +130,7 @@ In Dagger terms, this component has two essential properties:
|
||||
|
||||
Let's write the corresponding Cue code to a new file in our package:
|
||||
|
||||
```cue title="todoapp/multibucket/source.cue"
|
||||
package multibucket
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger"
|
||||
)
|
||||
|
||||
// Source code of the sample application
|
||||
src: dagger.#Artifact & dagger.#Input
|
||||
```cue file=./tests/multibucket/source.cue title="todoapp/cue.mod/multibucket/source.cue"
|
||||
```
|
||||
|
||||
This code defines a component at the key `src` and specifies that it is both an artifact and an input.
|
||||
@ -147,17 +139,7 @@ This code defines a component at the key `src` and specifies that it is both an
|
||||
|
||||
The second component of our plan is the Yarn package built from the app source code:
|
||||
|
||||
```cue title="todoapp/multibucket/yarn.cue"
|
||||
package multibucket
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/js/yarn"
|
||||
)
|
||||
|
||||
// Build the source code using Yarn
|
||||
app: yarn.#Package & {
|
||||
source: src
|
||||
}
|
||||
```cue file=./tests/multibucket/yarn.cue title="todoapp/cue.mod/multibucket/yarn.cue"
|
||||
```
|
||||
|
||||
Let's break it down:
|
||||
@ -176,17 +158,7 @@ _FIXME_: this section is not yet available because the [Amazon S3 package](https
|
||||
|
||||
The third component of our plan is the Netlify site to which the app will be deployed:
|
||||
|
||||
```cue title="todoapp/multibucket/netlify.cue"
|
||||
package multibucket
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/netlify"
|
||||
)
|
||||
|
||||
// Netlify site
|
||||
site: "netlify": netlify.#Site & {
|
||||
contents: app.build
|
||||
}
|
||||
```cue file=./tests/multibucket/netlify.cue title="todoapp/cue.mod/multibucket/netlify.cue"
|
||||
```
|
||||
|
||||
This component is very similar to the previous one:
|
||||
|
2
docs/learn/tests/.dagger/env/multibucket/.gitignore
vendored
Normal file
2
docs/learn/tests/.dagger/env/multibucket/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
28
docs/learn/tests/.dagger/env/multibucket/values.yaml
vendored
Normal file
28
docs/learn/tests/.dagger/env/multibucket/values.yaml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
plan:
|
||||
package: ./multibucket
|
||||
name: multibucket
|
||||
inputs:
|
||||
site.netlify.account.token:
|
||||
secret: ENC[AES256_GCM,data:e5cILcdqbaFdz6ZMM4sNYrChQS+VSMJTZA9cJ0kPvNEDlQj2n7ldlBeO9A==,iv:4SlRRlXyJ8/9ewAPXJ9KdhdVo4FrvVeRwSip2FfMTIM=,tag:JdxkVTR6SOLgzHUWtoSjyw==,type:str]
|
||||
site.netlify.name:
|
||||
text: dagger-test-doc-102
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBOVFI4NU40NXF1Um4vR1No
|
||||
MTByOC9HVWJYUCtzYUc4WGh2UG1EQnJCSm5FCnFrZ1BaMEZJLzBIRUVTUUdhWWRv
|
||||
N2xRYTR4NlhwclBYME9ZZ3JQejJoUFkKLS0tIDEwa0dXbVhzRWMrMFc3U0FtaEdr
|
||||
RERQRVp2VjR3K0VwQlZRWEJrQUNpNkUK78CsKmOJp1kKUcytprs0SKLLuo0YDucp
|
||||
oLuxQQd0X3/8x2c/YfJ3R15e1EQDC73HjSXDbhlgOScR9bxGVqn36A==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-08-12T23:19:07Z"
|
||||
mac: ENC[AES256_GCM,data:9jc3lwlbsJ6CdiSBF4ALNiv/zD7Rv5ZodftuEQpZuJVEpjJCKSq3C7LNyJKxV7fTg/tZ+RDx/q+x0xN9reRRrmvUCsbmLRL2h20rrfsVj3npCSkRiQFcmoHd6ULjf/kbkgUanLt8YmncDzJqNTQfafCxTo1RY3+U2WH/QSIIebQ=,iv:dcXQsq5de6LElOoqvGfs7nmHELkoTs0jddeY3vf4fJg=,tag:j0Eeu5NrNyhBYUzMwarj+w==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
@ -26,4 +26,36 @@ setup() {
|
||||
# Check output
|
||||
run curl $url
|
||||
assert_output --partial "My Todo app"
|
||||
}
|
||||
|
||||
@test "doc-1004-first-env" {
|
||||
setup_example_sandbox "doc"
|
||||
|
||||
# Follow tutorial
|
||||
mkdir multibucket
|
||||
cp $CODEBLOC_SRC/multibucket/source.cue multibucket
|
||||
cp $CODEBLOC_SRC/multibucket/yarn.cue multibucket
|
||||
cp $CODEBLOC_SRC/multibucket/netlify.cue multibucket
|
||||
|
||||
dagger doc alpha.dagger.io/netlify
|
||||
dagger doc alpha.dagger.io/js/yarn
|
||||
|
||||
# Initialize new env
|
||||
dagger new 'multibucket' -p ./multibucket
|
||||
|
||||
# Check inputs
|
||||
dagger input list -e multibucket
|
||||
|
||||
# Copy corresponding env
|
||||
cp -r $CODEBLOC_SRC/.dagger/env/multibucket .dagger/env/
|
||||
# Add missing src input
|
||||
dagger -e multibucket input dir src .
|
||||
|
||||
# Run test
|
||||
dagger -e multibucket up
|
||||
url=$(dagger -e multibucket query -f text site.netlify.deployUrl)
|
||||
|
||||
# Check output :
|
||||
run curl $url
|
||||
assert_output --partial "./static/css/main.9149988f.chunk.css"
|
||||
}
|
10
docs/learn/tests/multibucket/netlify.cue
Normal file
10
docs/learn/tests/multibucket/netlify.cue
Normal file
@ -0,0 +1,10 @@
|
||||
package multibucket
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/netlify"
|
||||
)
|
||||
|
||||
// Netlify site
|
||||
site: "netlify": netlify.#Site & {
|
||||
contents: app.build
|
||||
}
|
8
docs/learn/tests/multibucket/source.cue
Normal file
8
docs/learn/tests/multibucket/source.cue
Normal file
@ -0,0 +1,8 @@
|
||||
package multibucket
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger"
|
||||
)
|
||||
|
||||
// Source code of the sample application
|
||||
src: dagger.#Artifact & dagger.#Input
|
10
docs/learn/tests/multibucket/yarn.cue
Normal file
10
docs/learn/tests/multibucket/yarn.cue
Normal file
@ -0,0 +1,10 @@
|
||||
package multibucket
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/js/yarn"
|
||||
)
|
||||
|
||||
// Build the source code using Yarn
|
||||
app: yarn.#Package & {
|
||||
source: src
|
||||
}
|
Reference in New Issue
Block a user