aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test.sh')
-rwxr-xr-xscripts/test.sh59
1 files changed, 45 insertions, 14 deletions
diff --git a/scripts/test.sh b/scripts/test.sh
index 7937359..c31038f 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -5,39 +5,42 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib/log.sh"
source "$(dirname "${BASH_SOURCE[0]}")/lib/test.sh"
usage() {
- echo "Usage: $0 [TEST_SUITE]"
+ echo "Usage: $0 [OPTIONS] [TEST_SUITE]"
echo ""
echo "Run database test suites"
echo ""
+ echo "Options:"
+ echo " --keepdb Keep database containers running after tests"
+ echo " Reuses existing containers if already running"
+ echo " Useful for rapid iteration when running tests repeatedly"
+ echo ""
echo "Arguments:"
- echo " TEST_SUITE Test suite to run (mssql, sqlite, postgres, mysql)"
+ echo " TEST_SUITE Test suite to run (mssql, sqlite3, postgresql, mysql)"
echo " If not specified, runs all test suites"
echo ""
echo "Examples:"
- echo " $0 mssql # Run only MSSQL tests"
- echo " $0 # Run all test suites"
+ echo " $0 mssql # Run only MSSQL tests"
+ echo " $0 --keepdb mssql # Run MSSQL tests, keep container running"
+ echo " $0 --keepdb # Run all test suites, keep containers running"
+ echo " $0 # Run all test suites"
}
main() {
- local suite="${1:-}"
- if [[ $suite == "-h" || $suite == "--help" ]]; then
- usage
- exit 0
- fi
+ parse_args "$@"
- if [[ -n "$suite" ]]; then
- if ! test_is_valid_suite "$suite"; then
- log_error "Invalid test suite: $suite"
+ if [[ -n "$SUITE" ]]; then
+ if ! test_is_valid_suite "$SUITE"; then
+ log_error "Invalid test suite: $SUITE"
log_newline
usage
exit 1
fi
- test_run_suite "$suite"
+ test_run_suite "$SUITE" "$KEEPDB"
else
log_header "Running all test suites"
local failed_suites=()
for suite in "${BOLT_TEST_SUITES[@]}"; do
- if ! test_run_suite "$suite"; then
+ if ! test_run_suite "$suite" "$KEEPDB"; then
failed_suites+=("$suite")
fi
done
@@ -51,4 +54,32 @@ main() {
fi
}
+parse_args() {
+ KEEPDB=false
+ SUITE=""
+
+ while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ --keepdb)
+ KEEPDB=true
+ shift
+ ;;
+ -*)
+ log_error "Unknown option: $1"
+ log_newline
+ usage
+ exit 1
+ ;;
+ *)
+ SUITE="$1"
+ shift
+ ;;
+ esac
+ done
+}
+
main "$@"