From aef01399201b04eff282155d0e659d7f5ef6c4f6 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Thu, 4 Mar 2021 14:06:48 -0800 Subject: [PATCH] implemented tmpfs mount test Signed-off-by: Sam Alba --- stdlib/dagger/dagger.cue | 2 +- tests/mounts/valid/tmpfs/main.cue | 13 +++++++++++-- tests/test.sh | 6 +++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/stdlib/dagger/dagger.cue b/stdlib/dagger/dagger.cue index ec86213a..41b27241 100644 --- a/stdlib/dagger/dagger.cue +++ b/stdlib/dagger/dagger.cue @@ -39,7 +39,7 @@ package dagger env?: [string]: string always?: true | *false dir: string | *"/" - mount: [string]: "tmp" | "cache" | {from: _, path: string | *"/"} + mount: [string]: "tmpfs" | "cache" | {from: _, path: string | *"/"} } #FetchContainer: { diff --git a/tests/mounts/valid/tmpfs/main.cue b/tests/mounts/valid/tmpfs/main.cue index 974c3dd8..636a68cc 100644 --- a/tests/mounts/valid/tmpfs/main.cue +++ b/tests/mounts/valid/tmpfs/main.cue @@ -11,10 +11,19 @@ test: { { do: "exec" args: ["sh", "-c", """ - echo "NOT SURE WHAT TO TEST YET" > /out + echo ok > /out + echo ok > /tmpdir/out """] dir: "/" - mount: something: "tmpfs" + mount: "/tmpdir": "tmpfs" + }, + { + do: "exec" + args: ["sh", "-c", """ + [ -f /out ] || exit 1 + # content of /cache/tmp must not exist in this layer + [ ! -f /tmpdir/out ] || exit 1 + """] }, { do: "export" diff --git a/tests/test.sh b/tests/test.sh index fb166a30..55da3338 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -196,13 +196,13 @@ test::local(){ test::mount(){ - disable test::one "Mount: tmpfs (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \ + test::one "Mount: tmpfs" --exit=0 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/tmpfs - test::one "Mount: cache (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \ + test::one "Mount: cache" --exit=0 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/cache - test::one "Mount: component (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 --stdout='{"test":"hello world"}' \ + test::one "Mount: component" --exit=0 --stdout='{"test":"hello world"}' \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/component disable test::one "Mount: script (FIXME https://github.com/blocklayerhq/dagger/issues/46)" --exit=0 \