Skip to content

Commit 779117a

Browse files
authored
test(spanner): fix built-in metrics emulator unit test (#14255)
1 parent 93e0920 commit 779117a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProviderTest.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ private void verifyHash(String hash) {
111111
private SpannerOptions newTestOptions() {
112112
return SpannerOptions.newBuilder()
113113
.setProjectId("host-project")
114+
// The builder picks up SPANNER_EMULATOR_HOST from the environment, and building with an
115+
// emulator host replaces the credentials below with NoCredentials. Built-in metrics are
116+
// disabled for a client without credentials, so leave the emulator out of these tests.
117+
.setEmulatorHost(null)
114118
.setCredentials(
115119
OAuth2Credentials.create(new AccessToken("test-token", new Date(Long.MAX_VALUE))))
116120
.build();

0 commit comments

Comments
 (0)