Skip to content

Commit dc0b66e

Browse files
committed
test(bigquery): support us-east7 regional endpoints in integration tests
1 parent 2413811 commit dc0b66e

33 files changed

Lines changed: 19587 additions & 21 deletions

.kokoro/presubmit/bigquery-graalvm-native-presubmit.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ env_vars: {
2222
value: "gcloud-devel"
2323
}
2424

25+
env_vars: {
26+
key: "BIGQUERY_ENDPOINT"
27+
value: "https://us-east7-bigquery.googleapis.com"
28+
}
29+
30+
env_vars: {
31+
key: "BIGQUERY_STORAGE_ENDPOINT"
32+
value: "us-east7-bigquerystorage.googleapis.com:443"
33+
}
34+
2535
env_vars: {
2636
key: "GOOGLE_APPLICATION_CREDENTIALS"
2737
value: "secret_manager/java-it-service-account"

.kokoro/presubmit/bigquery-integration.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ env_vars: {
2222
value: "gcloud-devel"
2323
}
2424

25+
env_vars: {
26+
key: "INTEGRATION_TEST_ARGS"
27+
value: "-Dbigquery.endpoint=https://us-east7-bigquery.googleapis.com -Dbigquery.storage.endpoint=us-east7-bigquerystorage.googleapis.com:443"
28+
}
29+
2530
env_vars: {
2631
key: "GOOGLE_APPLICATION_CREDENTIALS"
2732
value: "secret_manager/java-it-service-account"

.kokoro/presubmit/bigquerystorage-graalvm-native-presubmit.cfg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ env_vars: {
2222
value: "gcloud-devel"
2323
}
2424

25+
26+
2527
env_vars: {
2628
key: "GOOGLE_APPLICATION_CREDENTIALS"
2729
value: "secret_manager/java-it-service-account"
@@ -46,3 +48,13 @@ env_vars: {
4648
key: "INTEGRATION_TEST_ARGS"
4749
value: "-Dit.test=!ITBigQueryWrite*RetryTest -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false"
4850
}
51+
52+
env_vars: {
53+
key: "BIGQUERY_ENDPOINT"
54+
value: "https://us-east7-bigquery.googleapis.com"
55+
}
56+
57+
env_vars: {
58+
key: "BIGQUERY_STORAGE_ENDPOINT"
59+
value: "us-east7-bigquerystorage.googleapis.com:443"
60+
}

.kokoro/presubmit/bigquerystorage-integration.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ env_vars: {
2222
value: "gcloud-devel"
2323
}
2424

25+
26+
2527
env_vars: {
2628
key: "GOOGLE_APPLICATION_CREDENTIALS"
2729
value: "secret_manager/java-it-service-account"
@@ -39,5 +41,5 @@ env_vars: {
3941

4042
env_vars: {
4143
key: "INTEGRATION_TEST_ARGS"
42-
value: "-Dit.test=!ITBigQueryWrite*RetryTest -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false"
44+
value: "-Dit.test=!ITBigQueryWrite*RetryTest -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dbigquery.storage.endpoint=us-east7-bigquerystorage.googleapis.com:443 -Dbigquery.endpoint=https://us-east7-bigquery.googleapis.com"
4345
}

bigquery_job.log

Whitespace-only changes.

bigquery_job_api.log

Lines changed: 1490 additions & 0 deletions
Large diffs are not rendered by default.

client-library-releases

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 122ac0f95d6ee5ac75e06b6a8bb90b576179c119

discovery-artifact-manager

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 0b5eedd3dd989e77c18e161a1ff41ce1ef224732

google-api-java-client-services

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 941c36024d6b88eb3a610fd2eed3bece551dcb76

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/testing/RemoteBigQueryHelper.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.io.InputStream;
2727
import java.time.Duration;
28+
// Dummy comment to trigger Kokoro presubmit for testing regional endpoints.
2829
import java.util.UUID;
2930
import java.util.logging.Level;
3031
import java.util.logging.Logger;
@@ -105,7 +106,7 @@ public static RemoteBigQueryHelper create(String projectId, InputStream keyStrea
105106
.setProjectId(projectId)
106107
.setRetrySettings(retrySettings())
107108
.setTransportOptions(transportOptions);
108-
String endpoint = System.getenv("BIGQUERY_ENDPOINT");
109+
String endpoint = System.getProperty("bigquery.endpoint", System.getenv("BIGQUERY_ENDPOINT"));
109110
if (endpoint != null) {
110111
builder.setHost(endpoint);
111112
}
@@ -143,7 +144,7 @@ public static RemoteBigQueryHelper create(BigQueryOptions.Builder bigqueryOption
143144
bigqueryOptionsBuilder
144145
.setRetrySettings(retrySettings())
145146
.setTransportOptions(transportOptions);
146-
String endpoint = System.getenv("BIGQUERY_ENDPOINT");
147+
String endpoint = System.getProperty("bigquery.endpoint", System.getenv("BIGQUERY_ENDPOINT"));
147148
if (endpoint != null) {
148149
builder.setHost(endpoint);
149150
}
@@ -184,4 +185,15 @@ public static BigQueryHelperException translate(Exception ex) {
184185
return new BigQueryHelperException(ex.getMessage(), ex);
185186
}
186187
}
188+
189+
/**
190+
* Helper to check if the provided BigQuery client is configured to target a regional endpoint.
191+
*/
192+
public static boolean isRegionalEndpoint(BigQuery bigquery) {
193+
if (bigquery == null || bigquery.getOptions() == null) {
194+
return false;
195+
}
196+
String host = bigquery.getOptions().getHost();
197+
return host != null && (host.contains("-bigquery.googleapis.com") || host.contains("us-east7"));
198+
}
187199
}

0 commit comments

Comments
 (0)