This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/tests/compute.bats
Andrea Luzzardi ce2e00cfa2 tests: migrate compute tests to bats
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-04-15 15:55:51 -07:00

73 lines
2.1 KiB
Bash

setup() {
load 'helpers'
common_setup
}
@test "compute: simple" {
run "$DAGGER" compute "$TESTDIR"/compute/invalid/string
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/bool
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/int
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/struct
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/success/noop
assert_success
assert_line '{"empty":{}}'
run "$DAGGER" compute "$TESTDIR"/compute/success/simple
assert_success
assert_line '{}'
run "$DAGGER" compute "$TESTDIR"/compute/success/overload/flat
assert_success
run "$DAGGER" compute "$TESTDIR"/compute/success/overload/wrapped
assert_success
run "$DAGGER" compute "$TESTDIR"/compute/success/exec-nocache
assert_success
}
@test "compute: dependencies" {
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/simple
assert_success
assert_line '{"A":{"result":"from A"},"B":{"result":"dependency from A"}}'
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/interpolation
assert_success
assert_line '{"A":{"result":"from A"},"B":{"result":"dependency from A"}}'
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/unmarshal
assert_success
assert_line '{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}'
}
@test "compute: inputs" {
run "$DAGGER" compute "$TESTDIR"/compute/input/simple
assert_success
assert_line '{}'
run "$DAGGER" compute --input-string 'in=foobar' "$TESTDIR"/compute/input/simple
assert_success
assert_line '{"in":"foobar","test":"received: foobar"}'
run "$DAGGER" compute "$TESTDIR"/compute/input/default
assert_success
assert_line '{"in":"default input","test":"received: default input"}'
run "$DAGGER" compute --input-string 'in=foobar' "$TESTDIR"/compute/input/default
assert_success
assert_line '{"in":"foobar","test":"received: foobar"}'
}
@test ".daggerignore" {
"$DAGGER" compute --input-dir TestData="$TESTDIR"/compute/ignore/testdata "$TESTDIR"/compute/ignore
}