-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore(bigquery-jdbc): enable proxy tests #13617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
91a6a55
chore(bigquery-jdbc): update integration tests to work in dockerized …
logachev 5fb823b
Merge main
logachev 5f8e314
fix all tests in proxy container
logachev 38f7dad
Lint + move getBigQuery to basic package
logachev 55476da
Merge branch 'main' into kirl/proxy_tests
logachev 2b276b5
Update java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdb…
logachev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,6 @@ | |
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| import com.google.cloud.ServiceOptions; | ||
| import com.google.cloud.bigquery.BigQuery; | ||
| import com.google.cloud.bigquery.BigQueryOptions; | ||
| import com.google.cloud.bigquery.Dataset; | ||
| import com.google.cloud.bigquery.DatasetId; | ||
| import java.sql.Connection; | ||
|
|
@@ -36,7 +34,7 @@ | |
| import org.junit.jupiter.api.Disabled; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class ITDriverTest { | ||
| public class ITDriverTest extends ITBase { | ||
|
|
||
| private static final String DEFAULT_CATALOG = ServiceOptions.getDefaultProjectId(); | ||
| static Random random = new Random(); | ||
|
|
@@ -96,14 +94,10 @@ public void testDriverLocation() throws SQLException, InterruptedException { | |
|
|
||
| String datasetUS = "JDBC_DRIVER_US_TEST_DATASET" + random.nextInt(999); | ||
| String tableNameUS = "JDBC_DRIVER_US_TEST_TABLE" + randomNumber; | ||
| String OAUTH_TYPE = "3"; | ||
| String CONNECTION_URL = | ||
| "jdbc:bigquery://https://bigquery.googleapis.com/bigquery/v2/:443;ProjectId=%s;OAuthType=%s;LOCATION=%s;"; | ||
| String CONNECTION_URL = ITBase.connectionUrl + "LOCATION=us-east5;"; | ||
|
|
||
| // US Connection | ||
| Connection connectionUS = | ||
| DriverManager.getConnection( | ||
| String.format(CONNECTION_URL, DEFAULT_CATALOG, OAUTH_TYPE, "us-east5")); | ||
| Connection connectionUS = DriverManager.getConnection(CONNECTION_URL); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: use |
||
| Statement statementUS = connectionUS.createStatement(); | ||
| statementUS.execute(String.format(createDataset, DEFAULT_CATALOG, datasetUS)); | ||
| statementUS.execute(String.format(createQuery, DEFAULT_CATALOG, datasetUS, tableNameUS)); | ||
|
|
@@ -114,7 +108,6 @@ public void testDriverLocation() throws SQLException, InterruptedException { | |
| ResultSet res = statementUS.getResultSet(); | ||
| assertTrue(res.next()); | ||
|
|
||
| BigQuery bigQuery = BigQueryOptions.getDefaultInstance().getService(); | ||
| Dataset retrievedDataset = bigQuery.getDataset(DatasetId.of(DEFAULT_CATALOG, datasetUS)); | ||
| assertEquals("us-east5", retrievedDataset.getLocation()); | ||
| ITBase.cleanUp(datasetUS); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doubt: So here we are unwrapping the BigQuery client from the connection directly. Since we don't save a reference to the Connection itself, how will it get closed later in the tests? I'm just thinking about potential resource leaks or background threads staying open