test: clean up yarn test
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
0611eec75b
commit
8ff72a5fa3
@ -8,6 +8,12 @@ import (
|
||||
// This may safely be called from any package
|
||||
#Source: engine.#Source
|
||||
|
||||
// A (best effort) persistent cache dir
|
||||
#CacheDir: engine.#CacheDir
|
||||
|
||||
// A temporary directory for command execution
|
||||
#TempDir: engine.#TempDir
|
||||
|
||||
// Select a subdirectory from a filesystem tree
|
||||
#Subdir: {
|
||||
// Input tree
|
||||
|
@ -2,11 +2,9 @@ package yarn
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/yarn"
|
||||
// "universe.dagger.io/alpine"
|
||||
// "universe.dagger.io/bash"
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/bash"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
@ -16,34 +14,28 @@ dagger.#Plan & {
|
||||
}
|
||||
|
||||
actions: {
|
||||
TestReact: {
|
||||
cache: engine.#CacheDir & {
|
||||
id: "yarn cache"
|
||||
}
|
||||
cache: dagger.#CacheDir & {
|
||||
id: "yarn cache"
|
||||
}
|
||||
|
||||
pkg: yarn.#Build & {
|
||||
source: inputs.directories.testdata.contents
|
||||
"cache": cache
|
||||
}
|
||||
pkg: yarn.#Build & {
|
||||
source: inputs.directories.testdata.contents
|
||||
"cache": cache
|
||||
}
|
||||
|
||||
_image: engine.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
_image: alpine.#Build & {
|
||||
packages: bash: {}
|
||||
}
|
||||
|
||||
// FIXME: use bash.#Script
|
||||
test: engine.#Exec & {
|
||||
input: _image.output
|
||||
mounts: build: {
|
||||
dest: "/build"
|
||||
contents: pkg.output
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /build/test)" = "output"
|
||||
"""#,
|
||||
]
|
||||
test: bash.#Run & {
|
||||
image: _image.output
|
||||
mounts: build: {
|
||||
dest: "/build"
|
||||
contents: pkg.output
|
||||
}
|
||||
script: #"""
|
||||
test "$(cat /build/test)" = "output"
|
||||
"""#
|
||||
}
|
||||
|
||||
// FIXME: re-enable?
|
||||
|
@ -190,7 +190,12 @@ func (t *execTask) mountTmp(_ *plancontext.Context, dest string, _ *compiler.Val
|
||||
|
||||
func (t *execTask) mountCache(_ *plancontext.Context, dest string, mnt *compiler.Value) (llb.RunOption, error) {
|
||||
contents := mnt.Lookup("contents")
|
||||
id, err := contents.Lookup("id").String()
|
||||
|
||||
idValue := contents.Lookup("id")
|
||||
if !idValue.IsConcrete() {
|
||||
return nil, fmt.Errorf("cache %q is not set", mnt.Path().String())
|
||||
}
|
||||
id, err := idValue.String()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user