mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
refactor: move plugin test helper functions to test_helper.bash
This commit is contained in:
@@ -1,24 +1,12 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
TEST_PLUGIN_NAME=smoke-test-plugin
|
||||
TEST_PLUGIN_GIT_REPO=https://github.com/dokku/${TEST_PLUGIN_NAME}.git
|
||||
TEST_PLUGIN_LOCAL_REPO="$(mktemp -d)/$TEST_PLUGIN_NAME"
|
||||
|
||||
clone_test_plugin() {
|
||||
git clone "$TEST_PLUGIN_GIT_REPO" "$TEST_PLUGIN_LOCAL_REPO"
|
||||
}
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
clone_test_plugin
|
||||
}
|
||||
|
||||
remove_test_plugin() {
|
||||
rm -rf $PLUGIN_ENABLED_PATH/$TEST_PLUGIN_NAME $PLUGIN_AVAILABLE_PATH/$TEST_PLUGIN_NAME
|
||||
rm -rf $TEST_PLUGIN_LOCAL_REPO
|
||||
}
|
||||
|
||||
teardown() {
|
||||
remove_test_plugin || true
|
||||
global_teardown
|
||||
|
||||
@@ -15,6 +15,9 @@ UUID=$(uuidgen)
|
||||
TEST_APP="rdmtestapp-${UUID}"
|
||||
TEST_NETWORK="test-network-${UUID}"
|
||||
SKIPPED_TEST_ERR_MSG="previous test failed! skipping remaining tests..."
|
||||
TEST_PLUGIN_NAME=smoke-test-plugin
|
||||
TEST_PLUGIN_GIT_REPO=https://github.com/dokku/${TEST_PLUGIN_NAME}.git
|
||||
TEST_PLUGIN_LOCAL_REPO="$(mktemp -d)/$TEST_PLUGIN_NAME"
|
||||
|
||||
# global setup() and teardown()
|
||||
# skips remaining tests on first failure
|
||||
@@ -45,6 +48,15 @@ cleanup_containers() {
|
||||
fi
|
||||
}
|
||||
|
||||
clone_test_plugin() {
|
||||
git clone "$TEST_PLUGIN_GIT_REPO" "$TEST_PLUGIN_LOCAL_REPO"
|
||||
}
|
||||
|
||||
remove_test_plugin() {
|
||||
rm -rf $PLUGIN_ENABLED_PATH/$TEST_PLUGIN_NAME $PLUGIN_AVAILABLE_PATH/$TEST_PLUGIN_NAME
|
||||
rm -rf $TEST_PLUGIN_LOCAL_REPO
|
||||
}
|
||||
|
||||
# test functions
|
||||
flunk() {
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user