From b04c0462347fa4d66915b957f13be097398711dc Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Fri, 12 Mar 2021 18:12:58 -0800 Subject: [PATCH] test: lint cue test files Signed-off-by: Andrea Luzzardi --- Makefile | 1 + tests/dockerbuild/main.cue | 16 ++++++++-------- tests/mounts/valid/component/main.cue | 26 ++++++++++++-------------- tests/mounts/valid/tmpfs/main.cue | 8 ++++---- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index efc5b1f6..839f1019 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ test: cuefmt: @(cue fmt -s ./stdlib/...) @(cue fmt -s ./examples/*) + @(cue fmt -s ./tests/...) .PHONY: lint lint: cuefmt check-buildkit-version diff --git a/tests/dockerbuild/main.cue b/tests/dockerbuild/main.cue index 31cbc3ab..29585dd4 100644 --- a/tests/dockerbuild/main.cue +++ b/tests/dockerbuild/main.cue @@ -23,7 +23,7 @@ TestOpChaining: #compute: [ }, dagger.#Exec & { args: ["sh", "-c", "test $(cat /output) = foobar"] - } + }, ] TestBuildContext: #compute: [ @@ -32,7 +32,7 @@ TestBuildContext: #compute: [ }, dagger.#Exec & { args: ["sh", "-c", "test $(cat /dir/foo) = foobar"] - } + }, ] TestBuildContextAndDockerfile: #compute: [ @@ -45,17 +45,17 @@ TestBuildContextAndDockerfile: #compute: [ }, dagger.#Exec & { args: ["sh", "-c", "test $(cat /override) = foobar"] - } + }, ] TestDockerfilePath: #compute: [ dagger.#DockerBuild & { - context: TestData + context: TestData dockerfilePath: "./dockerfilepath/Dockerfile.custom" }, dagger.#Exec & { args: ["sh", "-c", "test $(cat /test) = dockerfilePath"] - } + }, ] TestBuildArgs: #compute: [ @@ -66,7 +66,7 @@ TestBuildArgs: #compute: [ RUN test "${TEST}" = "bar" """ buildArg: TEST: "bar" - } + }, ] // FIXME: this doesn't test anything beside not crashing @@ -76,7 +76,7 @@ TestBuildLabels: #compute: [ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d """ label: FOO: "bar" - } + }, ] // FIXME: this doesn't test anything beside not crashing @@ -86,5 +86,5 @@ TestBuildPlatform: #compute: [ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d """ platforms: ["linux/amd64"] - } + }, ] diff --git a/tests/mounts/valid/component/main.cue b/tests/mounts/valid/component/main.cue index a4dcf859..7ffa83c4 100644 --- a/tests/mounts/valid/component/main.cue +++ b/tests/mounts/valid/component/main.cue @@ -13,20 +13,18 @@ test: { args: ["sh", "-c", """ cat /mnt/test/lol > /out """] - mount: "/mnt/test": from: { - #compute: [ - { - do: "fetch-container" - ref: "alpine" - }, - { - do: "exec" - args: ["sh", "-c", """ - echo -n "hello world" > /lol - """] - } - ] - } + mount: "/mnt/test": from: #compute: [ + { + do: "fetch-container" + ref: "alpine" + }, + { + do: "exec" + args: ["sh", "-c", """ + echo -n "hello world" > /lol + """] + }, + ] }, { do: "export" diff --git a/tests/mounts/valid/tmpfs/main.cue b/tests/mounts/valid/tmpfs/main.cue index 21af5c98..164a1a7c 100644 --- a/tests/mounts/valid/tmpfs/main.cue +++ b/tests/mounts/valid/tmpfs/main.cue @@ -20,10 +20,10 @@ test: { { do: "exec" args: ["sh", "-c", """ - [ -f /out ] || exit 1 - # content of /cache/tmp must not exist in this layer - [ ! -f /tmpdir/out ] || exit 1 - """] + [ -f /out ] || exit 1 + # content of /cache/tmp must not exist in this layer + [ ! -f /tmpdir/out ] || exit 1 + """] }, { do: "export"