Files
dokku/tests/unit/10_certs.bats
Jose Diaz-Gonzalez 7ed7202c67 tests: switch to bats-core
This switches from the older, unmaintained version of bats to one that _is_ maintained. In particular, this fork of the community version - bats-core/bats-core - adds junit timing support, which can be used to track down slow tests.

Once the bats-core/bats-core repository merges junit support, we will switch back to upstream.

Note that tests on OS X will still run using a version that _does not_ have junit timing support.
2018-12-29 05:09:30 -05:00

71 lines
1.7 KiB
Bash

#!/usr/bin/env bats
load test_helper
setup_local_tls() {
TLS=$BATS_TMPDIR/tls
mkdir -p $TLS
tar xf $BATS_TEST_DIRNAME/server_ssl.tar -C $TLS
tar xf $BATS_TEST_DIRNAME/domain_ssl.tar -C $TLS
sudo chown -R dokku:dokku $TLS
}
teardown_local_tls() {
TLS=$BATS_TMPDIR/tls
rm -R $TLS
}
setup() {
global_setup
create_app
setup_local_tls
}
teardown() {
destroy_app
teardown_local_tls
global_teardown
}
@test "(certs) certs:add" {
run /bin/bash -c "dokku certs:add $TEST_APP $BATS_TMPDIR/tls/server.crt $BATS_TMPDIR/tls/server.key"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(certs) certs:add with multiple dots in the filename" {
run /bin/bash -c "dokku certs:add $TEST_APP $BATS_TMPDIR/tls/domain.com.crt $BATS_TMPDIR/tls/domain.com.key"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(certs) certs:add tar:in" {
run /bin/bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/server_ssl.tar"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(certs) certs:add tar:in should ignore OSX hidden files" {
run /bin/bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/osx_ssl_tarred.tar"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(certs) certs:info" {
run /bin/bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/server_ssl.tar && dokku certs:info $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(certs) certs:remove" {
run /bin/bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/server_ssl.tar && dokku certs:remove $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
}