Optimize tests with simpler workflow

Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
Vasek - Tom C 2022-01-28 21:23:20 +01:00
parent 26b2ef8697
commit 32b48f7dce
No known key found for this signature in database
GPG Key ID: 175D82E572427960
4 changed files with 11 additions and 30 deletions

View File

@ -4,36 +4,30 @@ import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/docker"
"universe.dagger.io/alpine"
)
// This test verify that we can correctly build an image
// using docker.#Build with multiple steps executed during
// the building process
dagger.#Plan & {
inputs: directories: testdata: path: "./testdata"
actions: {
image: docker.#Build & {
steps: [
docker.#Pull & {
source: "golang:1.17-alpine"
},
docker.#Copy & {
contents: inputs.directories.testdata.contents
dest: "/input"
},
alpine.#Build,
docker.#Run & {
script: """
# FIXME remove that line when #1517 is merged
export PATH=/go/bin:/usr/local/go/bin:$PATH
go build -o hello ./main.go
mv hello /bin
echo -n hello > /bar.txt
"""
workdir: "/input"
},
docker.#Run & {
script: """
hello >> /test.txt
echo -n $(cat /bar.txt) world > /foo.txt
"""
},
docker.#Run & {
script: """
echo -n $(cat /foo.txt) >> /test.txt
"""
},
]

View File

@ -4,21 +4,18 @@ import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/docker"
"universe.dagger.io/alpine"
)
// This test verify that we can correctly build a simplistic image
// using docker.#Build
dagger.#Plan & {
#alpineImage: "index.docker.io/alpine:3.15.0@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
#testValue: "hello world"
actions: {
image: docker.#Build & {
steps: [
docker.#Pull & {
source: #alpineImage
},
alpine.#Build,
docker.#Run & {
script: """
echo -n $TEST >> /test.txt

View File

@ -1,3 +0,0 @@
module test.com
go 1.17

View File

@ -1,7 +0,0 @@
package main
import "fmt"
func main() {
fmt.Printf("hello world")
}