-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore: move bigquery jdbc external test to monorepo #12360
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f149302
chore: move bigquery jdbc external test to monorepo
Neenu1995 2ccc61c
chore: update package names
Neenu1995 4562e9e
Update java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdb…
Neenu1995 cb055df
make suggested changes
Neenu1995 c2eb847
Merge branch 'ns/move-ext-tests-jdbc' of github.com:googleapis/google…
Neenu1995 bcae02e
change package name
Neenu1995 bb773b2
update license year
Neenu1995 64d970b
chore: add a parent in pom
Neenu1995 7a998bc
chore: skip lint check for jdbc ext test
Neenu1995 5025013
update script
Neenu1995 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Github action job to test core java library features on | ||
| # downstream client libraries before they are released. | ||
|
|
||
| steps: | ||
| - name: 'gcr.io/cloud-devrel-public-resources/java11' | ||
| entrypoint: 'bash' | ||
| args: ['java-bigquery/.cloudbuild/scripts/jdbc-external.sh'', "${_VERSION}"] | ||
| secretEnv: ['SA_SECRET'] | ||
| availableSecrets: | ||
| secretManager: | ||
| - versionName: projects/$PROJECT_ID/secrets/GoogleJDBCServiceAccountSecret/versions/latest | ||
| env: 'SA_SECRET' | ||
| options: | ||
| workerPool: 'projects/bigquery-devtools-drivers/locations/us-east1/workerPools/java-bigquery-jdbc-pool' | ||
| logging: CLOUD_LOGGING_ONLY | ||
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ROOT_FOLDER=$(git rev-parse --show-toplevel) | ||
|
|
||
| cd ${ROOT_FOLDER} | ||
| source .kokoro/common.sh | ||
| install_modules java-bigquery | ||
|
|
||
| cd ${ROOT_FOLDER}/java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests | ||
| make integration-test | ||
|
Neenu1995 marked this conversation as resolved.
Outdated
|
||
19 changes: 19 additions & 0 deletions
19
java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/Dockerfile
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| FROM gcr.io/cloud-devrel-public-resources/java11 | ||
|
|
||
| ARG JDBC_VERSION | ||
| ARG JDBC_JAR_PATH | ||
|
|
||
| ENV container_jdbc_jar_path=/jdbc/simba/GoogleBigQueryJDBC42.jar | ||
|
|
||
| COPY ./pom.xml /src/pom.xml | ||
| COPY ${JDBC_JAR_PATH} ${container_jdbc_jar_path} | ||
|
|
||
| # Override SIMBA_JDBC_JAR_PATH with path inside the container | ||
| ENV JDBC_VERSION=${JDBC_VERSION} | ||
| ENV JDBC_JAR_PATH=${container_jdbc_jar_path} | ||
| ENV JDBC_DOCKER_ENV=true | ||
|
|
||
| WORKDIR /src | ||
| RUN mvn install | ||
|
|
||
| ENTRYPOINT [] |
62 changes: 62 additions & 0 deletions
62
java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/Makefile
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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # GOOGLE_APPLICATION_CREDENTIALS is required when running certain tests | ||
| SECRET=`cat $(GOOGLE_APPLICATION_CREDENTIALS)` | ||
|
|
||
| SIMBA_JDBC_VERSION=${_VERSION} | ||
| SIMBA_ZIP_FILE="SimbaJDBCDriverforGoogleBigQuery42_$(SIMBA_JDBC_VERSION).zip" | ||
|
|
||
| # Driver under test configuration | ||
| JDBC_FOLDER=drivers | ||
| JDBC_JAR_NAME=GoogleBigQueryJDBC42.jar | ||
| JDBC_JAR_PATH="$(JDBC_FOLDER)/$(JDBC_JAR_NAME)" | ||
| JDBC_VERSION=$(SIMBA_JDBC_VERSION) | ||
|
|
||
| skipSurefire ?= true | ||
|
|
||
| # Container name used during this test | ||
| CONTAINER_NAME=jdbc_test | ||
|
|
||
| # no indentation for ifndef\endif due to their evaluation before execution | ||
| .check-env: | | ||
| ifndef GOOGLE_APPLICATION_CREDENTIALS | ||
| $(error GOOGLE_APPLICATION_CREDENTIALS is required to run tests) | ||
| endif | ||
|
|
||
| # Important: By default, this command will skip unittests. | ||
| # To include unit tests, run: make integration-test skipSurefire=false | ||
| integration-test: | ||
| mvn -B -ntp \ | ||
| -Penable-integration-tests \ | ||
| -DtrimStackTrace=false \ | ||
| -DskipSurefire=$(skipSurefire) \ | ||
| -Dclirr.skip=true \ | ||
| -Denforcer.skip=true \ | ||
| -Dit.failIfNoSpecifiedTests=true \ | ||
| -Dit.test=$(test) \ | ||
| integration-test | ||
|
|
||
| .docker-run: | | ||
| docker run -it \ | ||
| -v $(GOOGLE_APPLICATION_CREDENTIALS):/auth/application_creds.json \ | ||
| -e "GOOGLE_APPLICATION_CREDENTIALS=/auth/application_creds.json" \ | ||
| -v "$(GOOGLE_APPLICATION_CREDENTIALS).p12":/auth/application_creds.p12 \ | ||
| -v $(PWD):/src \ | ||
| -e "SA_SECRET=$(SECRET)" \ | ||
| -e "SA_SECRET_P12=/auth/application_creds.p12" \ | ||
| $(CONTAINER_NAME) $(args) | ||
|
|
||
| download-simba: | ||
| mkdir -p $(JDBC_FOLDER) | ||
| gsutil -m cp gs://bq-dev-tools-simba-drivers-testing/simba-jdbc/$(SIMBA_ZIP_FILE) $(JDBC_FOLDER) | ||
| unzip -p ./$(JDBC_FOLDER)/$(SIMBA_ZIP_FILE) $(JDBC_JAR_NAME) > $(JDBC_JAR_PATH) | ||
|
|
||
| docker-build: | | ||
| docker build --build-arg JDBC_JAR_PATH=$(JDBC_JAR_PATH) --build-arg JDBC_VERSION=$(JDBC_VERSION) -t $(CONTAINER_NAME) . | ||
|
|
||
| docker-test-authentication: .check-env | | ||
| $(MAKE) .docker-run args="mvn -Dtest=ITJdbcAuthenticationTest test" | ||
|
|
||
| docker-test test: .check-env | | ||
| $(MAKE) .docker-run args="mvn test -Dtest=$(test)" | ||
|
|
||
| docker-test-all: .check-env | | ||
| $(MAKE) .docker-run args="mvn test" |
107 changes: 107 additions & 0 deletions
107
java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/pom.xml
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 |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| Copyright 2025 Google LLC | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>org.example</groupId> | ||
| <artifactId>bigquery-external-jdbc-tests</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>11</maven.compiler.source> | ||
| <maven.compiler.target>11</maven.compiler.target> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>libraries-bom</artifactId> | ||
| <version>26.58.0</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>google-cloud-bigquery</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>JDBC</artifactId> | ||
| <version>${env.JDBC_VERSION}</version> | ||
| <scope>system</scope> | ||
| <systemPath>${env.JDBC_JAR_PATH}</systemPath> | ||
| </dependency> | ||
|
|
||
| <!-- Test dependencies --> | ||
| <dependency> | ||
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>google-cloud-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.avro</groupId> | ||
| <artifactId>avro</artifactId> | ||
| <version>1.11.4</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <scope>test</scope> | ||
| <version>4.13.2</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.truth</groupId> | ||
| <artifactId>truth</artifactId> | ||
| <scope>test</scope> | ||
| <version>1.1.3</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.mockito</groupId> | ||
| <artifactId>mockito-core</artifactId> | ||
| <scope>test</scope> | ||
| <version>1.10.19</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>joda-time</groupId> | ||
| <artifactId>joda-time</artifactId> | ||
| <scope>test</scope> | ||
| <version>2.14.0</version> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <profiles> | ||
| <!-- Profile used inside docker --> | ||
| <profile> | ||
| <id>docker</id> | ||
| <activation> | ||
| <property> | ||
| <name>env.JDBC_DOCKER_ENV</name> | ||
| </property> | ||
| </activation> | ||
| <build> | ||
| <!-- Ensure it doesn't conflict with local build directories --> | ||
| <directory>/mvn/test-target</directory> | ||
| </build> | ||
| </profile> | ||
| </profiles> | ||
| </project> |
39 changes: 39 additions & 0 deletions
39
...ry/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/main/java/JdbcStarter.java
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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright 2025 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import com.google.cloud.ServiceOptions; | ||
| import java.sql.DriverManager; | ||
| import java.sql.Connection; | ||
| import java.sql.SQLException; | ||
| import java.sql.Statement; | ||
|
|
||
| public class JdbcStarter { | ||
|
|
||
| public static void main(String[] args) throws SQLException { | ||
| final String DEFAULT_CATALOG = ServiceOptions.getDefaultProjectId(); | ||
| final String oauthType = "3"; // Google Application Credentials | ||
|
|
||
| String connectionUrl = | ||
| "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=" | ||
| + DEFAULT_CATALOG | ||
| + ";OAuthType=" | ||
| + oauthType | ||
| + ";Timeout=3600;"; | ||
| Connection connection = DriverManager.getConnection(connectionUrl); | ||
| Statement statement = connection.createStatement(); | ||
| statement.execute("SELECT 1;"); | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.