Skip to content

Commit 2855d97

Browse files
committed
Start PostgreSQL only for PostgreSQL integration tests
1 parent 284abb4 commit 2855d97

2 files changed

Lines changed: 11 additions & 29 deletions

File tree

‎.github/workflows/odbc.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ jobs:
4545

4646
services:
4747
postgres:
48-
image: postgres:17
48+
image: ${{ matrix.driver == 'postgres' && 'postgres:17' || '' }}
4949
env:
5050
POSTGRES_PASSWORD: postgres
5151
ports:
5252
- 5432:5432
5353
options: >-
54-
--health-cmd pg_isready
54+
--health-cmd "pg_isready -U postgres"
5555
--health-interval 5s
5656
--health-timeout 5s
5757
--health-retries 20

‎scripts/test-driver.sh‎

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,42 +32,24 @@ DUCKDB_SKIP_ARGS=(
3232
--skip sqlx_query_decodes_decimal_integer_in_buffered_mode_when_configured
3333
)
3434

35-
tmp_dir="$(mktemp -d)"
36-
cleanup() {
37-
rm -rf "$tmp_dir"
38-
}
39-
trap cleanup EXIT
40-
4135
case "$driver" in
4236
duckdb)
37+
tmp_dir="$(mktemp -d)"
38+
trap 'rm -rf "$tmp_dir"' EXIT
4339
duckdb_driver="${DUCKDB_ODBC_DRIVER:-DuckDB}"
4440
export ODBC_DATABASE_URL="Driver=${duckdb_driver};Database=${tmp_dir}/sqlx-odbc.duckdb"
45-
cargo_args=()
46-
harness_args=()
47-
found_separator=0
4841

42+
needs_separator=true
4943
for arg in "$@"; do
50-
if [[ "$arg" == "--" && "$found_separator" -eq 0 ]]; then
51-
found_separator=1
52-
continue
53-
fi
54-
55-
if [[ "$found_separator" -eq 0 ]]; then
56-
cargo_args+=("$arg")
57-
else
58-
harness_args+=("$arg")
44+
if [[ "$arg" == -- ]]; then
45+
needs_separator=false
46+
break
5947
fi
6048
done
61-
62-
if [[ "${#cargo_args[@]}" -eq 0 && "${#harness_args[@]}" -eq 0 ]]; then
63-
set -- -- "${DUCKDB_SKIP_ARGS[@]}"
64-
elif [[ "${#cargo_args[@]}" -eq 0 ]]; then
65-
set -- -- "${harness_args[@]}" "${DUCKDB_SKIP_ARGS[@]}"
66-
elif [[ "${#harness_args[@]}" -eq 0 ]]; then
67-
set -- "${cargo_args[@]}" -- "${DUCKDB_SKIP_ARGS[@]}"
68-
else
69-
set -- "${cargo_args[@]}" -- "${harness_args[@]}" "${DUCKDB_SKIP_ARGS[@]}"
49+
if [[ "$needs_separator" == true ]]; then
50+
set -- "$@" --
7051
fi
52+
set -- "$@" "${DUCKDB_SKIP_ARGS[@]}"
7153
;;
7254
postgres)
7355
postgres_driver="${POSTGRES_ODBC_DRIVER:-PostgreSQL Unicode}"

0 commit comments

Comments
 (0)