Change "arch" into "platform" because it's more accurate.

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2021-11-05 16:21:21 +01:00
parent de6afee89c
commit a63c4e989a
12 changed files with 33 additions and 32 deletions

View File

@@ -159,26 +159,26 @@ setup() {
"$DAGGER" up
}
@test "core: arch config" {
@test "core: platform config" {
dagger init
# Test for amd64 architecture
dagger_new_with_plan test-amd "$TESTDIR"/core/arch-config "linux/amd64"
# Test for amd64 platform
dagger_new_with_plan test-amd "$TESTDIR"/core/platform-config "linux/amd64"
# Set arch expected value
"$DAGGER" -e test-amd input text targetArch "x86_64"
# Up amd
"$DAGGER" -e test-amd up
"$DAGGER" -e test-amd up --no-cache
# Test for amd64 architecture
dagger_new_with_plan test-arm "$TESTDIR"/core/arch-config "linux/arm64"
# Test for amd64 platform
dagger_new_with_plan test-arm "$TESTDIR"/core/platform-config "linux/arm64"
# Set arch expected value
"$DAGGER" -e test-arm input text targetArch "aarch64"
# Up arm
"$DAGGER" -e test-arm up
"$DAGGER" -e test-arm up --no-cache
}
@test "compute: exclude" {

View File

@@ -13,13 +13,13 @@ TestFetch: #up: [
},
op.#Exec & {
args: ["/bin/sh", "-c", "echo $(uname -a) >> /arch.txt"]
args: ["/bin/sh", "-c", "echo $(uname -a) >> /platform.txt"]
always: true
},
op.#Exec & {
args: ["/bin/sh", "-c", """
cat /arch.txt | grep "$TARGET_ARCH"
cat /platform.txt | grep "$TARGET_ARCH"
"""]
env: TARGET_ARCH: targetArch
},
@@ -30,13 +30,13 @@ TestBuild: #up: [
dockerfile: """
FROM alpine
RUN echo $(uname -a) > /arch.txt
RUN echo $(uname -a) > /platform.txt
"""
},
op.#Exec & {
args: ["/bin/sh", "-c", """
cat /arch.txt | grep "$TARGET_ARCH"
cat /platform.txt | grep "$TARGET_ARCH"
"""]
env: TARGET_ARCH: targetArch
},
@@ -49,7 +49,7 @@ TestLoad: #up: [
// Compare arch
op.#Exec & {
args: ["/bin/sh", "-c", "diff /build/arch.txt /fetch/arch.txt"]
args: ["/bin/sh", "-c", "diff /build/platform.txt /fetch/platform.txt"]
mount: {
"/build": from: TestBuild
"/fetch": from: TestFetch

View File

@@ -20,17 +20,17 @@ common_setup() {
dagger_new_with_plan() {
local name="$1"
local sourcePlan="$2"
local arch="$3"
local platform="$3"
cp -a "$sourcePlan"/* "$DAGGER_PROJECT"
local opts=""
if [ -n "$arch" ];
if [ -n "$platform" ];
then
opts="-a $arch"
opts="--platform $platform"
fi
# Need word splitting to take in account "-a" and "$arch"
# Need word splitting to take in account "-a" and "$platform"
# shellcheck disable=SC2086
"$DAGGER" new "$name" ${opts}
}