This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/tests/core/arch-config/arch-config.cue
Tom Chauveau 8a3a3028fb
Add tests on architecture configuration
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-10-22 22:25:06 +02:00

59 lines
900 B
CUE

package main
import (
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/dagger"
)
targetArch: dagger.#Input & {string}
TestFetch: #up: [
op.#FetchContainer & {
ref: "docker.io/alpine"
},
op.#Exec & {
args: ["/bin/sh", "-c", "echo $(uname -a) >> /arch.txt"]
always: true
},
op.#Exec & {
args: ["/bin/sh", "-c", """
cat /arch.txt | grep "$TARGET_ARCH"
"""]
env: TARGET_ARCH: targetArch
},
]
TestBuild: #up: [
op.#DockerBuild & {
dockerfile: """
FROM alpine
RUN echo $(uname -a) > /arch.txt
"""
},
op.#Exec & {
args: ["/bin/sh", "-c", """
cat /arch.txt | grep "$TARGET_ARCH"
"""]
env: TARGET_ARCH: targetArch
},
]
TestLoad: #up: [
op.#Load & {
from: TestBuild
},
// Compare arch
op.#Exec & {
args: ["/bin/sh", "-c", "diff /build/arch.txt /fetch/arch.txt"]
mount: {
"/build": from: TestBuild
"/fetch": from: TestFetch
}
},
]