From f4afe5d12945018e4d6f5e6e2351343add1b31ed Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Mon, 21 Jun 2021 15:14:18 +0200 Subject: [PATCH] test: added test for ignoring .dagger directory in input dir Signed-off-by: Sam Alba --- tests/cli.bats | 14 ++++++++++++++ tests/cli/input/ignore/main.cue | 20 ++++++++++++++++++++ tests/cli/input/ignore/testdata/.dagger/foo | 0 tests/cli/input/ignore/testdata/testfile | 1 + 4 files changed, 35 insertions(+) create mode 100644 tests/cli/input/ignore/main.cue create mode 100644 tests/cli/input/ignore/testdata/.dagger/foo create mode 100644 tests/cli/input/ignore/testdata/testfile diff --git a/tests/cli.bats b/tests/cli.bats index 4dd1e32a..8fcc086e 100644 --- a/tests/cli.bats +++ b/tests/cli.bats @@ -308,6 +308,20 @@ setup() { }' } +@test "dagger input dir: ignore .dagger" { + "$DAGGER" init + + dagger_new_with_plan input "$TESTDIR"/cli/input/ignore + + run [ -d "$TESTDIR"/cli/input/ignore/testdata/.dagger ] + assert_success + + cp -R "$TESTDIR"/cli/input/ignore/testdata/ "$DAGGER_WORKSPACE"/testdata + "$DAGGER" input -e "input" dir "source" "$DAGGER_WORKSPACE"/testdata + "$DAGGER" up -e "input" + assert_success +} + @test "dagger input git" { "$DAGGER" init diff --git a/tests/cli/input/ignore/main.cue b/tests/cli/input/ignore/main.cue new file mode 100644 index 00000000..8cd23563 --- /dev/null +++ b/tests/cli/input/ignore/main.cue @@ -0,0 +1,20 @@ +package testing + +import ( + "dagger.io/dagger/op" + "dagger.io/dagger" +) + +source: dagger.#Artifact + +#up: [ + op.#FetchContainer & {ref: "busybox"}, + op.#Exec & { + args: ["sh", "-c", """ + set -exu + [ -f /source/testfile ] + [ ! -d /source/.dagger ] + """] + mount: "/source": from: source + }, +] diff --git a/tests/cli/input/ignore/testdata/.dagger/foo b/tests/cli/input/ignore/testdata/.dagger/foo new file mode 100644 index 00000000..e69de29b diff --git a/tests/cli/input/ignore/testdata/testfile b/tests/cli/input/ignore/testdata/testfile new file mode 100644 index 00000000..20495ffb --- /dev/null +++ b/tests/cli/input/ignore/testdata/testfile @@ -0,0 +1 @@ +thisisatest