From 7b91b3fb3039f6de9d615fb0a943be72a5904b28 Mon Sep 17 00:00:00 2001 From: Alexander Radzin Date: Thu, 21 Mar 2024 21:40:16 +0200 Subject: [PATCH] FIR-31506 avoid checking that DB exist for local DB (#363) --- .../jdbc/connection/FireboltConnectionServiceSecret.java | 3 ++- .../connection/FireboltConnectionServiceSecretTest.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecret.java b/src/main/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecret.java index a3f5d3ef3..f1f4496d6 100644 --- a/src/main/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecret.java +++ b/src/main/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecret.java @@ -16,6 +16,7 @@ import com.firebolt.jdbc.service.FireboltEngineVersion2Service; import com.firebolt.jdbc.service.FireboltGatewayUrlService; import com.firebolt.jdbc.service.FireboltStatementService; +import com.firebolt.jdbc.util.PropertyUtil; import lombok.NonNull; import okhttp3.OkHttpClient; @@ -90,7 +91,7 @@ private FireboltProperties getSessionPropertiesForNonSystemEngine() throws SQLEx @Override protected void assertDatabaseExisting(String database) throws SQLException { - if (database != null && !getFireboltEngineService().doesDatabaseExist(database)) { + if (database != null && !PropertyUtil.isLocalDb(loginProperties) && !getFireboltEngineService().doesDatabaseExist(database)) { throw new FireboltException(format("Database %s does not exist", database), RESOURCE_NOT_FOUND); } } diff --git a/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecretTest.java b/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecretTest.java index 5e2d71de2..908c0896b 100644 --- a/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecretTest.java +++ b/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionServiceSecretTest.java @@ -71,6 +71,12 @@ void getMetadata(String testName, String engineParameter, boolean readOnly) thro } } + @Test + void shouldNotFetchTokenNorEngineHostForLocalFirebolt() throws SQLException { + super.shouldNotFetchTokenNorEngineHostForLocalFirebolt(); + verifyNoInteractions(fireboltEngineService); + } + protected FireboltConnection createConnection(String url, Properties props) throws SQLException { return new FireboltConnectionServiceSecret(url, props, fireboltAuthenticationService, fireboltGatewayUrlService, fireboltStatementService, fireboltEngineService, fireboltAccountIdService); }