[config] test some config oddities
This commit is contained in:
10
tests.mk
10
tests.mk
@@ -91,6 +91,16 @@ else
|
||||
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
|
||||
endif
|
||||
|
||||
unit-tests-config:
|
||||
@echo running config unit tests...
|
||||
@$(QUIET) bats tests/unit/20_config.bats
|
||||
|
||||
unit-tests-config-oddities:
|
||||
@echo running config oddities unit tests...
|
||||
@$(QUIET) bats tests/unit/30_config-oddities.bats
|
||||
|
||||
|
||||
|
||||
deploy-test-go-fail-predeploy:
|
||||
@echo deploying go-fail-predeploy app...
|
||||
cd tests && ./test_deploy ./apps/go-fail-predeploy dokku.me '' true
|
||||
|
||||
47
tests/unit/30_config-oddities.bats
Normal file
47
tests/unit/30_config-oddities.bats
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
[[ -f ${DOKKU_ROOT}/ENV ]] && mv -f ${DOKKU_ROOT}/ENV ${DOKKU_ROOT}/ENV.bak
|
||||
sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > ${DOKKU_ROOT}/ENV"
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
ls -la ${DOKKU_ROOT}
|
||||
if [[ -f ${DOKKU_ROOT}/ENV.bak ]];then
|
||||
mv -f ${DOKKU_ROOT}/ENV.bak ${DOKKU_ROOT}/ENV
|
||||
fi
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(config-oddities) set-local/get with multiple spaces and $" {
|
||||
run dokku config:set --global double_quotes="hello world$" single_quotes='hello$ world'
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
run dokku config:get --global double_quotes
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output 'hello world$'
|
||||
run dokku config:get --global single_quotes
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output 'hello$ world'
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(config-oddities) set-local/get with multiple lines" {
|
||||
multiline='line one
|
||||
line two'
|
||||
run dokku config:set --global double_quotes="$multiline"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
run dokku config:get --global double_quotes
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output "$multiline"
|
||||
assert_success
|
||||
}
|
||||
Reference in New Issue
Block a user