Add simple test environment for core features

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes
2021-06-17 14:11:10 +00:00
committed by Solomon Hykes
parent 21c76f2873
commit 49277af680
5 changed files with 76 additions and 1 deletions

30
tests/core.bats Normal file
View File

@@ -0,0 +1,30 @@
# Test core Dagger features & types
setup() {
load 'helpers'
common_setup
# Use native Dagger environment here
unset DAGGER_WORKSPACE
}
@test "core: inputs" {
# List available inputs
run dagger -e test-core input list
assert_success
assert_output --partial 'name'
assert_output --partial 'dir'
# Set text input
dagger -e test-core input text name Bob
run dagger -e test-core up
assert_success
assert_output --partial 'Hello, Bob!'
# Unset text input
dagger -e test-core input unset name
run dagger -e test-core up
assert_success
assert_output --partial 'Hello, world!'
}

View File

@@ -27,6 +27,11 @@ dagger_new_with_plan() {
}
# dagger helper to execute the right binary
dagger() {
"${DAGGER}" "$@"
}
skip_unless_secrets_available() {
local inputFile="$1"
sops exec-file "$inputFile" echo > /dev/null 2>&1 || skip "$inputFile cannot be decrypted"
@@ -38,4 +43,4 @@ skip_unless_local_kube() {
else
skip "local kubernetes cluster not available"
fi
}
}