Optimize tests with simpler workflow
Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
parent
26b2ef8697
commit
32b48f7dce
@ -4,36 +4,30 @@ import (
|
|||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
"dagger.io/dagger/engine"
|
"dagger.io/dagger/engine"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
|
"universe.dagger.io/alpine"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This test verify that we can correctly build an image
|
// This test verify that we can correctly build an image
|
||||||
// using docker.#Build with multiple steps executed during
|
// using docker.#Build with multiple steps executed during
|
||||||
// the building process
|
// the building process
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
inputs: directories: testdata: path: "./testdata"
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: docker.#Build & {
|
image: docker.#Build & {
|
||||||
steps: [
|
steps: [
|
||||||
docker.#Pull & {
|
alpine.#Build,
|
||||||
source: "golang:1.17-alpine"
|
|
||||||
},
|
|
||||||
docker.#Copy & {
|
|
||||||
contents: inputs.directories.testdata.contents
|
|
||||||
dest: "/input"
|
|
||||||
},
|
|
||||||
docker.#Run & {
|
docker.#Run & {
|
||||||
script: """
|
script: """
|
||||||
# FIXME remove that line when #1517 is merged
|
echo -n hello > /bar.txt
|
||||||
export PATH=/go/bin:/usr/local/go/bin:$PATH
|
|
||||||
go build -o hello ./main.go
|
|
||||||
mv hello /bin
|
|
||||||
"""
|
"""
|
||||||
workdir: "/input"
|
|
||||||
},
|
},
|
||||||
docker.#Run & {
|
docker.#Run & {
|
||||||
script: """
|
script: """
|
||||||
hello >> /test.txt
|
echo -n $(cat /bar.txt) world > /foo.txt
|
||||||
|
"""
|
||||||
|
},
|
||||||
|
docker.#Run & {
|
||||||
|
script: """
|
||||||
|
echo -n $(cat /foo.txt) >> /test.txt
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -4,21 +4,18 @@ import (
|
|||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
"dagger.io/dagger/engine"
|
"dagger.io/dagger/engine"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
|
"universe.dagger.io/alpine"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This test verify that we can correctly build a simplistic image
|
// This test verify that we can correctly build a simplistic image
|
||||||
// using docker.#Build
|
// using docker.#Build
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
#alpineImage: "index.docker.io/alpine:3.15.0@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
|
|
||||||
|
|
||||||
#testValue: "hello world"
|
#testValue: "hello world"
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: docker.#Build & {
|
image: docker.#Build & {
|
||||||
steps: [
|
steps: [
|
||||||
docker.#Pull & {
|
alpine.#Build,
|
||||||
source: #alpineImage
|
|
||||||
},
|
|
||||||
docker.#Run & {
|
docker.#Run & {
|
||||||
script: """
|
script: """
|
||||||
echo -n $TEST >> /test.txt
|
echo -n $TEST >> /test.txt
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
module test.com
|
|
||||||
|
|
||||||
go 1.17
|
|
@ -1,7 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Printf("hello world")
|
|
||||||
}
|
|
Reference in New Issue
Block a user