fix: racy JDBC tests (#7678)

* fix: racing JDBC tests

The JDBC tests have been flaky since adding additional tests. Use
the makefile to build the client to avoid the clients racing.

* chore: pre-download JDBC drive in integration test

* fix: remove stray lockfile
pull/24376/head
Martin Hilton 2023-04-27 10:07:06 +01:00 committed by GitHub
parent 2bf867ea0a
commit f87f4c1869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 13 deletions

View File

@ -271,6 +271,9 @@ jobs:
sudo apt-get install openjdk-11-jdk -y
- rust_components
- cache_restore
- run:
name: Download flight-sql-jdbc-driver-10.0.0.jar
command: make -C influxdb_iox/tests/jdbc_client flight-sql-jdbc-driver-10.0.0.jar
- run:
name: cargo test -p influxdb2_client
command: cargo test -p influxdb2_client

View File

@ -1,3 +1,13 @@
driver_path := org/apache/arrow/flight-sql-jdbc-driver/10.0.0/flight-sql-jdbc-driver-10.0.0.jar
driver_file := $(notdir $(driver_path))
Main.class: Main.java
javac Main.java
$(driver_file): $(driver_file).sha
curl -s -L "https://search.maven.org/remotecontent?filepath=$(driver_path)" -o $(driver_file)
shasum -c $(driver_file).sha
clean:
rm -f flight-sql-jdbc-driver-10.0.0.jar
rm -f $(driver_file)
rm -f Main.class

View File

@ -8,24 +8,16 @@
# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
JDBC_DRIVER_URL="https://search.maven.org/remotecontent?filepath=org/apache/arrow/flight-sql-jdbc-driver/10.0.0/flight-sql-jdbc-driver-10.0.0.jar"
JDBC_DRIVER_PATH="$SCRIPT_DIR/flight-sql-jdbc-driver-10.0.0.jar"
JDBC_DRIVER="flight-sql-jdbc-driver-10.0.0.jar"
# download driver if not present
if [ ! -e "$JDBC_DRIVER_PATH" ]; then
echo "Downloading JDBC driver from $JDBC_DRIVER_URL"
curl -L "$JDBC_DRIVER_URL" --output $JDBC_DRIVER_PATH
fi
make -C $SCRIPT_DIR $JDBC_DRIVER
# Help track down https://github.com/influxdata/influxdb_iox/issues/6967
ls -ltr
# Verify the download
# To update, run: shasum flight-sql-jdbc-driver-10.0.0.jar > flight-sql-jdbc-driver-10.0.0.jar.sha
(cd $SCRIPT_DIR && shasum -c flight-sql-jdbc-driver-10.0.0.jar.sha)
# Compile
(cd "$SCRIPT_DIR" && javac Main.java)
make -C $SCRIPT_DIR Main.class
# Run the code and pass along command line arguments
java --add-opens=java.base/java.nio=ALL-UNNAMED -classpath "$SCRIPT_DIR:$JDBC_DRIVER_PATH" Main "$@"
java --add-opens=java.base/java.nio=ALL-UNNAMED -classpath "$SCRIPT_DIR:$SCRIPT_DIR/$JDBC_DRIVER" Main "$@"