From fb2e140b91abdc92ebad5460eaad563ba220f20e Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Wed, 14 Apr 2021 17:19:27 -0700 Subject: [PATCH] tests: convert react example test to bats Signed-off-by: Andrea Luzzardi --- tests/examples.bats | 16 ++++++++++++++++ tests/test-examples.sh | 12 ------------ tests/test.sh | 3 --- 3 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 tests/examples.bats delete mode 100644 tests/test-examples.sh diff --git a/tests/examples.bats b/tests/examples.bats new file mode 100644 index 00000000..22f93a9c --- /dev/null +++ b/tests/examples.bats @@ -0,0 +1,16 @@ +setup() { + load 'helpers' + + common_setup +} + +@test "example: react" { + skip_unless_secrets_available "$TESTDIR"/examples/react/inputs.yaml + + run "$DAGGER" compute -l fatal "$TESTDIR"/../examples/react --input-yaml "$TESTDIR"/examples/react/inputs.yaml + assert_success + url=$(echo "$output" | jq -r .www.deployUrl) + run curl -sS "$url" + assert_success + assert_output --partial "Todo App" +} diff --git a/tests/test-examples.sh b/tests/test-examples.sh deleted file mode 100644 index 2131f845..00000000 --- a/tests/test-examples.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -o errexit -o errtrace -o functrace -o nounset -o pipefail - -# Test Directory -d=$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd) - -test::examples() { - local dagger="$1" - - test::secret "$d"/examples/react/inputs.yaml "examples: React" --exit=0 \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/../examples/react -} diff --git a/tests/test.sh b/tests/test.sh index 29aff873..f6ac57fc 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -19,15 +19,12 @@ d=$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd) . "$d/test-compute.sh" # shellcheck source=/dev/null . "$d/test-stdlib.sh" -# shellcheck source=/dev/null -. "$d/test-examples.sh" test::all(){ local dagger="$1" test::suite "compute" && test::compute "$dagger" test::suite "stdlib" && test::stdlib "$dagger" - test::suite "examples" && test::examples "$dagger" } test::suite() {