refactor: move plugin test helper functions to test_helper.bash

This commit is contained in:
Jose Diaz-Gonzalez committed 2024-03-13 22:21:05 -04:00
1 parent cf742bb3e0
commit ca55f58446
2 files changed
+12 -12

No files matched your search

-12
View File
@@ -1,24 +1,12 @@
#!/usr/bin/env bats #!/usr/bin/env bats
load test_helper 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() { setup() {
global_setup global_setup
clone_test_plugin 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() { teardown() {
remove_test_plugin || true remove_test_plugin || true
global_teardown global_teardown
+12
View File
@@ -15,6 +15,9 @@ UUID=$(uuidgen)
TEST_APP="rdmtestapp-${UUID}" TEST_APP="rdmtestapp-${UUID}"
TEST_NETWORK="test-network-${UUID}" TEST_NETWORK="test-network-${UUID}"
SKIPPED_TEST_ERR_MSG="previous test failed! skipping remaining tests..." 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() # global setup() and teardown()
# skips remaining tests on first failure # skips remaining tests on first failure
@@ -45,6 +48,15 @@ cleanup_containers() {
fi 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 # test functions
flunk() { flunk() {
{ {