diff --git a/.github/ubuntu/exasol.sh b/.github/ubuntu/exasol.sh index 1529d335..4f9d4c06 100755 --- a/.github/ubuntu/exasol.sh +++ b/.github/ubuntu/exasol.sh @@ -30,5 +30,5 @@ sudo tar -xzf EXAplus-24.2.1.tar.gz -C /opt/exasol --strip-comp # Add to the path. if [[ -n "$GITHUB_PATH" ]]; then - echo "/opt/exasol" >> $GITHUB_PATH + echo "/opt/exasol" >> "$GITHUB_PATH" fi diff --git a/.github/ubuntu/firebird.sh b/.github/ubuntu/firebird.sh index 90a968f2..de1e7cd1 100755 --- a/.github/ubuntu/firebird.sh +++ b/.github/ubuntu/firebird.sh @@ -9,6 +9,6 @@ if [ -z "$SKIP_DEPENDS" ]; then fi # Tell DBD::Firebird where to find the libraries. -if [[ ! -z "$GITHUB_ENV" ]]; then - echo "FIREBIRD_HOME=/usr" >> $GITHUB_ENV +if [[ -n "$GITHUB_ENV" ]]; then + echo "FIREBIRD_HOME=/usr" >> "$GITHUB_ENV" fi diff --git a/.github/ubuntu/oracle.sh b/.github/ubuntu/oracle.sh index d8942b8d..a258a06a 100755 --- a/.github/ubuntu/oracle.sh +++ b/.github/ubuntu/oracle.sh @@ -28,15 +28,15 @@ bsdtar -C /opt/instantclient --strip-components 1 -zxf "instantclient-basic-linu bsdtar -C /opt/instantclient --strip-components 1 -zxf "instantclient-sqlplus-linux.x64-${version}.zip" bsdtar -C /opt/instantclient --strip-components 1 -zxf "instantclient-sdk-linux.x64-${version}.zip" -if [[ ! -z "$GITHUB_PATH" ]]; then - echo "/opt/instantclient" >> $GITHUB_PATH +if [[ -n "$GITHUB_PATH" ]]; then + echo "/opt/instantclient" >> "$GITHUB_PATH" fi -if [[ ! -z "$GITHUB_ENV" ]]; then - echo "ORACLE_HOME=/opt/instantclient" >> $GITHUB_ENV +if [[ -n "$GITHUB_ENV" ]]; then + echo "ORACLE_HOME=/opt/instantclient" >> "$GITHUB_ENV" if [[ -z "$LD_LIBRARY_PATH" ]]; then - echo "LD_LIBRARY_PATH=/opt/instantclient" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/instantclient" >> "$GITHUB_ENV" else - echo "LD_LIBRARY_PATH=/opt/instantclient:$LD_LIBRARY_PATH" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/instantclient:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" fi fi diff --git a/.github/ubuntu/pg.sh b/.github/ubuntu/pg.sh index 8f35bd05..0b9d2f31 100755 --- a/.github/ubuntu/pg.sh +++ b/.github/ubuntu/pg.sh @@ -9,6 +9,6 @@ curl -O https://salsa.debian.org/postgresql/postgresql-common/-/raw/master/pgdg/ sudo sh apt.postgresql.org.sh -i -t -v $PGVERSION sudo pg_createcluster --start $PGVERSION test -p 5432 --locale=C -- -A trust -E UTF8 -if [[ ! -z "$GITHUB_PATH" ]]; then - echo "/usr/lib/postgresql/$POSTGRES/bin" >> $GITHUB_PATH +if [[ -n "$GITHUB_PATH" ]]; then + echo "/usr/lib/postgresql/$POSTGRES/bin" >> "$GITHUB_PATH" fi diff --git a/.github/ubuntu/snowflake.sh b/.github/ubuntu/snowflake.sh index 667bd905..ff10a3ce 100755 --- a/.github/ubuntu/snowflake.sh +++ b/.github/ubuntu/snowflake.sh @@ -22,14 +22,14 @@ sudo mv /opt/snowflake/ErrorMessages/en-US /opt/snowflake/lib/ # Install, update, and configure SnowSQL. sed -e '1,/^exit$/d' snowsql.bash | sudo tar -C /opt/snowflake -zxf - /opt/snowflake/snowsql -Uv -echo "[options]\nnoup = true" > /opt/snowflake/config +printf "[options]\nnoup = true\n" > /opt/snowflake/config # Add to the path. -if [[ ! -z "$GITHUB_PATH" ]]; then - echo "/opt/snowflake" >> $GITHUB_PATH +if [[ -n "$GITHUB_PATH" ]]; then + echo "/opt/snowflake" >> "$GITHUB_PATH" fi # Tell SnowSQL where to find the config. -if [[ ! -z "$GITHUB_ENV" ]]; then - echo "WORKSPACE=/opt/snowflake" >> $GITHUB_ENV +if [[ -n "$GITHUB_ENV" ]]; then + echo "WORKSPACE=/opt/snowflake" >> "$GITHUB_ENV" fi diff --git a/.github/ubuntu/sqlite.sh b/.github/ubuntu/sqlite.sh index 2b07be07..74ca1820 100755 --- a/.github/ubuntu/sqlite.sh +++ b/.github/ubuntu/sqlite.sh @@ -6,7 +6,7 @@ SQLITE=${SQLITE:=${1:-3.40.1}} echo "Instaling SQLite $SQLITE" # Convert to the SQLITE_VERSION_NUMBER format https://sqlite.org/c3ref/c_source_id.html -SQLITE=$(perl -e 'my @v = split /[.]/, shift; printf "%d%02d%02d%02d\n", @v[0..3]' $SQLITE) +SQLITE=$(perl -e 'my @v = split /[.]/, shift; printf "%d%02d%02d%02d\n", @v[0..3]' "$SQLITE") # Since 3.7.16.1, the URL includes the year in the path. # 3.18.2, 3.18.1, 3.9.3, and 3.7.11 missing. @@ -42,20 +42,20 @@ gcc -shared -o libsqlite3.so -fPIC sqlite3.o -ldl -lpthread # Hand-build DBD::SQLite against the version of SQLite just installed. DIST=$(cpanm --info DBD::SQLite) # ISHIGAKI/DBD-SQLite-1.70.tar.gz URL=https://cpan.metacpan.org/authors/id/${DIST:0:1}/${DIST:0:2}/$DIST -curl -o dbd.tar.gz $URL +curl -o dbd.tar.gz "$URL" tar zxvf dbd.tar.gz --strip-components 1 perl -i -pe 's/^if\s*\(\s*0\s*\)\s\{/if (1) {/' Makefile.PL perl Makefile.PL SQLITE_INC=/opt/sqlite SQLITE_LIB=/opt/sqlite make && make install -if [[ ! -z "$GITHUB_PATH" ]]; then - echo "/opt/sqlite" >> $GITHUB_PATH +if [[ -n "$GITHUB_PATH" ]]; then + echo "/opt/sqlite" >> "$GITHUB_PATH" fi -if [[ ! -z "$GITHUB_ENV" ]]; then +if [[ -n "$GITHUB_ENV" ]]; then if [[ -z "$LD_LIBRARY_PATH" ]]; then - echo "LD_LIBRARY_PATH=/opt/sqlite" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/sqlite" >> "$GITHUB_ENV" else - echo "LD_LIBRARY_PATH=/opt/sqlite:$LD_LIBRARY_PATH" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/sqlite:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" fi fi diff --git a/t/exasol.t b/t/exasol.t index edd41443..392b7e0f 100644 --- a/t/exasol.t +++ b/t/exasol.t @@ -417,18 +417,32 @@ $uri = URI->new( $ENV{EXA_URI} || 'db:dbadmin:password@localhost/dbadmin' ); -my $err = try { - $exa->use_driver; - $dbh = DBI->connect($uri->dbi_dsn, $uri->user, $uri->password, { - PrintError => 0, - RaiseError => 0, - AutoCommit => 1, - HandleError => $exa->_error_handler, - }); - undef; -} catch { - $_; -}; +my $err; +for my $i (1..30) { + $err = try { + $exa->use_driver; + $dbh = DBI->connect($uri->dbi_dsn, $uri->user, $uri->password, { + PrintError => 0, + RaiseError => 0, + AutoCommit => 1, + HandleError => $exa->_error_handler, + }); + undef; + } catch { + $_; + }; + + if ($err) { + diag "DBI::state: ", ($DBI::state || ''), "\nMessage: ", $err->message, "\nOrig: ", $err->previous_exception; + last; + } + # Sleep if it failed but Vertica is still starting up. + # SQL-57V03: `failed: FATAL 4149: Node startup/recovery in progress. Not yet ready to accept connections` + # SQL-08001: `failed: [Vertica][DSI] An error occurred while attempting to retrieve the error message for key 'VConnectFailed' and component ID 101: Could not open error message files` + last unless $err && (($DBI::state || '') eq '57V03' || $err->message =~ /VConnectFailed/); + sleep 1 if $i < 30; +} + DBIEngineTest->run( class => $CLASS,