From 823d03b98463c9c3b6d20471cf2891d373a4cb32 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 14:09:55 -0400 Subject: [PATCH 01/17] Add test for testing tpc --- src/instance.ts | 2 +- src/table.ts | 2 +- system-test/service-path.ts | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/instance.ts b/src/instance.ts index 7d5569bd5..420d9cbf5 100644 --- a/src/instance.ts +++ b/src/instance.ts @@ -1310,7 +1310,7 @@ Please use the format 'my-instance' or '${bigtable.projectName}/instances/my-ins : callback!; if (policy.etag !== null && policy.etag !== undefined) { - (policy.etag as {} as Buffer) = Buffer.from(policy.etag); + (policy.etag as {} as Buffer) = Buffer.from(policy.etag as string); } const reqOpts = { resource: this.name, diff --git a/src/table.ts b/src/table.ts index ea721b3ac..d59eaf0ca 100644 --- a/src/table.ts +++ b/src/table.ts @@ -1042,7 +1042,7 @@ export class Table extends TabularApiSurface { : callback!; if (policy.etag !== null && policy.etag !== undefined) { - (policy.etag as {} as Buffer) = Buffer.from(policy.etag); + (policy.etag as {} as Buffer) = Buffer.from(policy.etag as string); } const reqOpts = { resource: this.name, diff --git a/system-test/service-path.ts b/system-test/service-path.ts index 53f938a22..08376aeb8 100644 --- a/system-test/service-path.ts +++ b/system-test/service-path.ts @@ -192,3 +192,20 @@ describe('Service Path', () => { delete process.env.GOOGLE_CLOUD_UNIVERSE_DOMAIN; }); }); + +describe.only('Service Path2', () => { + it('Experiment with setting the service path', async () => { + const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator + const options = { + universeDomain, + }; + const bigtable = new Bigtable({ + BigtableClient: options, + BigtableInstanceAdminClient: options, + BigtableTableAdminClient: options, + }); + const instance = bigtable.instance('instanceId'); + const table = instance.table('tableId'); + await table.getRows({gaxOptions: {timeout: 1000}}); + }); +}); From 3d9822aeb4aaba2156f9721f73966476ef561849 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 16:02:32 -0400 Subject: [PATCH 02/17] Update the test to create an instance --- system-test/service-path.ts | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/system-test/service-path.ts b/system-test/service-path.ts index 08376aeb8..20ca64bd7 100644 --- a/system-test/service-path.ts +++ b/system-test/service-path.ts @@ -195,6 +195,39 @@ describe('Service Path', () => { describe.only('Service Path2', () => { it('Experiment with setting the service path', async () => { + const instanceId = 'instanceId'; + const tableId = 'tableId'; + const columnFamilyId = 'cf1'; + async function mockBigtable() { + const instance = bigtable.instance(instanceId); + const [instanceInfo] = await instance.exists(); + if (!instanceInfo) { + const [, operation] = await instance.create({ + clusters: { + id: 'fake-cluster3', + location: 'us-west1-c', + nodes: 1, + }, + }); + await operation.promise(); + } + + const table = instance.table(tableId); + const [tableExists] = await table.exists(); + if (!tableExists) { + await table.create({families: [columnFamilyId]}); // Create column family + } else { + // Check if column family exists and create it if not. + const [families] = await table.getFamilies(); + if ( + !families.some((family: {id: string}) => family.id === columnFamilyId) + ) { + await table.createFamily(columnFamilyId); + } + } + } + mockBigtable(); + // Do the universe domain test const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator const options = { universeDomain, @@ -204,8 +237,8 @@ describe.only('Service Path2', () => { BigtableInstanceAdminClient: options, BigtableTableAdminClient: options, }); - const instance = bigtable.instance('instanceId'); - const table = instance.table('tableId'); + const instance = bigtable.instance(instanceId); + const table = instance.table(tableId); await table.getRows({gaxOptions: {timeout: 1000}}); }); }); From bdca46b6405ec7ff61458ea5b648dfcbf7dbbef0 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 16:20:54 -0400 Subject: [PATCH 03/17] Remove TPC aspect and bug persists --- system-test/service-path.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/system-test/service-path.ts b/system-test/service-path.ts index 20ca64bd7..689c6efac 100644 --- a/system-test/service-path.ts +++ b/system-test/service-path.ts @@ -203,11 +203,13 @@ describe.only('Service Path2', () => { const [instanceInfo] = await instance.exists(); if (!instanceInfo) { const [, operation] = await instance.create({ - clusters: { - id: 'fake-cluster3', - location: 'us-west1-c', - nodes: 1, - }, + clusters: [ + { + id: 'fake-cluster3', + location: 'us-west1-c', + nodes: 1, + }, + ], }); await operation.promise(); } @@ -226,19 +228,18 @@ describe.only('Service Path2', () => { } } } - mockBigtable(); // Do the universe domain test const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator + /* const options = { universeDomain, }; - const bigtable = new Bigtable({ - BigtableClient: options, - BigtableInstanceAdminClient: options, - BigtableTableAdminClient: options, - }); + */ + const options = {}; + const bigtable = new Bigtable(); const instance = bigtable.instance(instanceId); const table = instance.table(tableId); - await table.getRows({gaxOptions: {timeout: 1000}}); + await mockBigtable(); + await table.getRows(); }); }); From d93adfa27095f4fbb42ac473457e92d84b26cb31 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 16:37:57 -0400 Subject: [PATCH 04/17] More debugging --- system-test/service-path.ts | 6 ++- system-test/universe-domain-tests.ts | 57 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 system-test/universe-domain-tests.ts diff --git a/system-test/service-path.ts b/system-test/service-path.ts index 689c6efac..1458a257d 100644 --- a/system-test/service-path.ts +++ b/system-test/service-path.ts @@ -193,15 +193,18 @@ describe('Service Path', () => { }); }); -describe.only('Service Path2', () => { +describe('Service Path2', () => { it('Experiment with setting the service path', async () => { const instanceId = 'instanceId'; const tableId = 'tableId'; const columnFamilyId = 'cf1'; async function mockBigtable() { const instance = bigtable.instance(instanceId); + console.log('get instance info'); const [instanceInfo] = await instance.exists(); + console.log('after instance info'); if (!instanceInfo) { + console.log('create instance'); const [, operation] = await instance.create({ clusters: [ { @@ -211,6 +214,7 @@ describe.only('Service Path2', () => { }, ], }); + console.log('create instance done'); await operation.promise(); } diff --git a/system-test/universe-domain-tests.ts b/system-test/universe-domain-tests.ts new file mode 100644 index 000000000..677fa0fad --- /dev/null +++ b/system-test/universe-domain-tests.ts @@ -0,0 +1,57 @@ +import {describe, it} from 'mocha'; +import {Bigtable} from '../src'; + +describe.only('Service Path2', () => { + it('Experiment with setting the service path', async () => { + const instanceId = 'instanceId'; + const tableId = 'tableId'; + const columnFamilyId = 'cf1'; + async function mockBigtable() { + const instance = bigtable.instance(instanceId); + console.log('get instance info'); + const [instanceInfo] = await instance.exists(); + console.log('after instance info'); + if (!instanceInfo) { + console.log('create instance'); + const [, operation] = await instance.create({ + clusters: [ + { + id: 'fake-cluster3', + location: 'us-west1-c', + nodes: 1, + }, + ], + }); + console.log('create instance done'); + await operation.promise(); + } + + const table = instance.table(tableId); + const [tableExists] = await table.exists(); + if (!tableExists) { + await table.create({families: [columnFamilyId]}); // Create column family + } else { + // Check if column family exists and create it if not. + const [families] = await table.getFamilies(); + if ( + !families.some((family: {id: string}) => family.id === columnFamilyId) + ) { + await table.createFamily(columnFamilyId); + } + } + } + // Do the universe domain test + const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator + /* + const options = { + universeDomain, + }; + */ + const options = {}; + const bigtable = new Bigtable(); + const instance = bigtable.instance(instanceId); + const table = instance.table(tableId); + await mockBigtable(); + await table.getRows(); + }); +}); From 52f31af8e1a80e573fab569e7dcf1f6b2b5ae481 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 16:42:26 -0400 Subject: [PATCH 05/17] no universe domain stuff --- system-test/universe-domain-tests.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/system-test/universe-domain-tests.ts b/system-test/universe-domain-tests.ts index 677fa0fad..af6c0838c 100644 --- a/system-test/universe-domain-tests.ts +++ b/system-test/universe-domain-tests.ts @@ -41,13 +41,6 @@ describe.only('Service Path2', () => { } } // Do the universe domain test - const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator - /* - const options = { - universeDomain, - }; - */ - const options = {}; const bigtable = new Bigtable(); const instance = bigtable.instance(instanceId); const table = instance.table(tableId); From a9a1f01d5a1c9472b477e89d6f5649fca417dae4 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 17:01:04 -0400 Subject: [PATCH 06/17] New working test --- system-test/universe-domain-tests-working.ts | 97 ++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 system-test/universe-domain-tests-working.ts diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts new file mode 100644 index 000000000..4f43bbb4d --- /dev/null +++ b/system-test/universe-domain-tests-working.ts @@ -0,0 +1,97 @@ +// 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 {describe, it, before, after} from 'mocha'; +import {Bigtable} from '../src'; +import * as proxyquire from 'proxyquire'; +import * as mocha from 'mocha'; +import * as assert from 'assert'; +import {TestMetricsHandler} from '../test-common/test-metrics-handler'; +import {OnOperationCompleteData} from '../src/client-side-metrics/metrics-handler'; + +describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { + async function mockBigtable(projectId: string, done: mocha.Done) { + const FakeBigtable = proxyquire('../src/index.js', {}).Bigtable; + bigtable = new FakeBigtable(); + + const instance = bigtable.instance(instanceId); + const [instanceInfo] = await instance.exists(); + if (!instanceInfo) { + const [, operation] = await instance.create({ + clusters: { + id: 'fake-cluster3', + location: 'us-west1-c', + nodes: 1, + }, + }); + await operation.promise(); + } + + const table = instance.table(tableId); + const [tableExists] = await table.exists(); + if (!tableExists) { + await table.create({families: [columnFamilyId]}); // Create column family + } else { + // Check if column family exists and create it if not. + const [families] = await table.getFamilies(); + + if ( + !families.some((family: {id: string}) => family.id === columnFamilyId) + ) { + await table.createFamily(columnFamilyId); + } + } + } + + const instanceId = 'emulator-test-instance'; + const tableId = 'my-table'; + const columnFamilyId = 'cf1'; + let bigtable: Bigtable; + + before(async () => { + // This line is added just to make sure the bigtable variable is assigned. + // It is needed to solve a compile time error in the after hook. + bigtable = new Bigtable(); + }); + + after(async () => { + try { + // If the instance has been deleted already by another source, we don't + // want this after hook to block the continuous integration pipeline. + const instance = bigtable.instance(instanceId); + await instance.delete({}); + } catch (e) { + console.warn('The instance has been deleted already'); + } + }); + + it('should send the metrics to the metrics handler for a ReadRows call', done => { + (async () => { + const projectId: string = await new Promise((resolve, reject) => { + bigtable.getProjectId_((err, projectId) => { + if (err) { + reject(err); + } else { + resolve(projectId as string); + } + }); + }); + await mockBigtable(projectId, done); + const instance = bigtable.instance(instanceId); + const table = instance.table(tableId); + await table.getRows(); + done(); + })(); + }); +}); From 0c4e2daf4fd5f7cfeb8eff6477f7f8b8e36996e1 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 17:03:33 -0400 Subject: [PATCH 07/17] Clean file up --- system-test/universe-domain-tests-working.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index 4f43bbb4d..ef4f7446a 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -16,9 +16,6 @@ import {describe, it, before, after} from 'mocha'; import {Bigtable} from '../src'; import * as proxyquire from 'proxyquire'; import * as mocha from 'mocha'; -import * as assert from 'assert'; -import {TestMetricsHandler} from '../test-common/test-metrics-handler'; -import {OnOperationCompleteData} from '../src/client-side-metrics/metrics-handler'; describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { async function mockBigtable(projectId: string, done: mocha.Done) { @@ -47,7 +44,7 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { const [families] = await table.getFamilies(); if ( - !families.some((family: {id: string}) => family.id === columnFamilyId) + !families.some((family: {id: string}) => family.id === columnFamilyId) ) { await table.createFamily(columnFamilyId); } From c441f15b20be825356b294a01b6368d7ff8ffa76 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 17:10:20 -0400 Subject: [PATCH 08/17] Eliminate arguments --- system-test/universe-domain-tests-working.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index ef4f7446a..1c54e5bf9 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -18,7 +18,7 @@ import * as proxyquire from 'proxyquire'; import * as mocha from 'mocha'; describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { - async function mockBigtable(projectId: string, done: mocha.Done) { + async function mockBigtable() { const FakeBigtable = proxyquire('../src/index.js', {}).Bigtable; bigtable = new FakeBigtable(); @@ -84,7 +84,7 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { } }); }); - await mockBigtable(projectId, done); + await mockBigtable(); const instance = bigtable.instance(instanceId); const table = instance.table(tableId); await table.getRows(); From 32fb9436c2317e0dacb72d50047b093f51b3578b Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 17:11:21 -0400 Subject: [PATCH 09/17] This is okay too --- system-test/universe-domain-tests-working.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index 1c54e5bf9..644e02e03 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -84,9 +84,9 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { } }); }); - await mockBigtable(); const instance = bigtable.instance(instanceId); const table = instance.table(tableId); + await mockBigtable(); await table.getRows(); done(); })(); From 2caf336dd856c75150903692ab51d1a326317ea6 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 17:12:33 -0400 Subject: [PATCH 10/17] Eliminating the project fetch is okay too --- system-test/universe-domain-tests-working.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index 644e02e03..c5359d2f4 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -75,15 +75,6 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { it('should send the metrics to the metrics handler for a ReadRows call', done => { (async () => { - const projectId: string = await new Promise((resolve, reject) => { - bigtable.getProjectId_((err, projectId) => { - if (err) { - reject(err); - } else { - resolve(projectId as string); - } - }); - }); const instance = bigtable.instance(instanceId); const table = instance.table(tableId); await mockBigtable(); From 03b2bd3eafd1ca31a2515633e4a125d61bec868b Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Mon, 24 Mar 2025 17:18:35 -0400 Subject: [PATCH 11/17] Override Bigtable options --- system-test/universe-domain-tests-working.ts | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index c5359d2f4..4333c9814 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -59,7 +59,15 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { before(async () => { // This line is added just to make sure the bigtable variable is assigned. // It is needed to solve a compile time error in the after hook. - bigtable = new Bigtable(); + const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator + const options = { + universeDomain, + }; + bigtable = new Bigtable({ + BigtableClient: options, + BigtableInstanceAdminClient: options, + BigtableTableAdminClient: options, + }); }); after(async () => { @@ -75,11 +83,15 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { it('should send the metrics to the metrics handler for a ReadRows call', done => { (async () => { - const instance = bigtable.instance(instanceId); - const table = instance.table(tableId); - await mockBigtable(); - await table.getRows(); - done(); + try { + const instance = bigtable.instance(instanceId); + const table = instance.table(tableId); + await mockBigtable(); + await table.getRows(); + done(); + } catch (e) { + done(e); + } })(); }); }); From f61825240bdb85a3e98e4aef25e48b250a49b7c1 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Tue, 25 Mar 2025 10:09:34 -0400 Subject: [PATCH 12/17] Trying with an environment variable --- system-test/universe-domain-tests-working.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index 4333c9814..e8c26cf46 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -24,6 +24,7 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { const instance = bigtable.instance(instanceId); const [instanceInfo] = await instance.exists(); + console.log('after exists'); if (!instanceInfo) { const [, operation] = await instance.create({ clusters: { @@ -59,15 +60,14 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { before(async () => { // This line is added just to make sure the bigtable variable is assigned. // It is needed to solve a compile time error in the after hook. - const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator + // const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator + /* const options = { universeDomain, }; - bigtable = new Bigtable({ - BigtableClient: options, - BigtableInstanceAdminClient: options, - BigtableTableAdminClient: options, - }); + */ + process.env.GOOGLE_CLOUD_UNIVERSE_DOMAIN = 'apis-tpczero.goog'; + bigtable = new Bigtable(); }); after(async () => { @@ -88,6 +88,7 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { const table = instance.table(tableId); await mockBigtable(); await table.getRows(); + console.log('done'); done(); } catch (e) { done(e); From f00d375e006f295f979a4c6c6c79a9e5e9e85acb Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Tue, 25 Mar 2025 16:46:34 -0400 Subject: [PATCH 13/17] Take one of the tests off of only --- system-test/universe-domain-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/universe-domain-tests.ts b/system-test/universe-domain-tests.ts index af6c0838c..7dba679f4 100644 --- a/system-test/universe-domain-tests.ts +++ b/system-test/universe-domain-tests.ts @@ -1,7 +1,7 @@ import {describe, it} from 'mocha'; import {Bigtable} from '../src'; -describe.only('Service Path2', () => { +describe('Service Path2', () => { it('Experiment with setting the service path', async () => { const instanceId = 'instanceId'; const tableId = 'tableId'; From 94926c80ab705b5c1db010a1f330f412267515ca Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Fri, 4 Apr 2025 10:29:48 -0400 Subject: [PATCH 14/17] Add a fix to allow universe domain option to be passed in --- src/index.ts | 11 +++++++---- system-test/universe-domain-tests-working.ts | 7 ++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index c4c77e822..10c6602fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -100,6 +100,8 @@ export interface BigtableOptions extends gax.GoogleAuthOptions { * Internal only. */ BigtableTableAdminClient?: gax.ClientOptions; + + universeDomain?: string; } /** @@ -111,7 +113,7 @@ export interface BigtableOptions extends gax.GoogleAuthOptions { * @param {gax.ClientOptions} [opts] The gax client options * @returns {string} The universe domain. */ -function getDomain(prefix: string, opts?: gax.ClientOptions) { +function getDomain(prefix: string, options: BigtableOptions, opts?: gax.ClientOptions) { // From https://github.com/googleapis/nodejs-bigtable/blob/589540475b0b2a055018a1cb6e475800fdd46a37/src/v2/bigtable_client.ts#L120-L128. // This code for universe domain was taken from the Gapic Layer. // It is reused here to build the service path. @@ -120,6 +122,7 @@ function getDomain(prefix: string, opts?: gax.ClientOptions) { ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; return `${prefix}.${ + options?.universeDomain ?? opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? @@ -469,7 +472,7 @@ export class Bigtable { { servicePath: customEndpointBaseUrl || - getDomain('bigtable', options.BigtableClient), + getDomain('bigtable', options, options.BigtableClient), 'grpc.callInvocationTransformer': grpcGcp.gcpCallInvocationTransformer, 'grpc.channelFactoryOverride': grpcGcp.gcpChannelFactoryOverride, 'grpc.gcpApiConfig': grpcGcp.createGcpApiConfig({ @@ -490,7 +493,7 @@ export class Bigtable { { servicePath: customEndpointBaseUrl || - getDomain('bigtableadmin', options.BigtableClient), + getDomain('bigtableadmin', options, options.BigtableClient), }, options ); @@ -500,7 +503,7 @@ export class Bigtable { { servicePath: customEndpointBaseUrl || - getDomain('bigtableadmin', options.BigtableClient), + getDomain('bigtableadmin', options, options.BigtableClient), }, options ); diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index e8c26cf46..eebd43e96 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -60,14 +60,11 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { before(async () => { // This line is added just to make sure the bigtable variable is assigned. // It is needed to solve a compile time error in the after hook. - // const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator - /* + const universeDomain = 'apis-tpczero.goog'; // or your universe domain if not using emulator const options = { universeDomain, }; - */ - process.env.GOOGLE_CLOUD_UNIVERSE_DOMAIN = 'apis-tpczero.goog'; - bigtable = new Bigtable(); + bigtable = new Bigtable(options); }); after(async () => { From f5bf88d49ebf26767f7a2753f5d3b5b545145742 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Fri, 4 Apr 2025 11:10:14 -0400 Subject: [PATCH 15/17] Use the bigtable client with the universe domain --- system-test/universe-domain-tests-working.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index eebd43e96..7b21a1d28 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -19,9 +19,6 @@ import * as mocha from 'mocha'; describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { async function mockBigtable() { - const FakeBigtable = proxyquire('../src/index.js', {}).Bigtable; - bigtable = new FakeBigtable(); - const instance = bigtable.instance(instanceId); const [instanceInfo] = await instance.exists(); console.log('after exists'); From 3cc678549403d4e8ba29b067100fadd764a655d4 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Thu, 1 May 2025 14:49:57 -0400 Subject: [PATCH 16/17] Change zone --- system-test/universe-domain-tests-working.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index 7b21a1d28..286499f5f 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -26,7 +26,7 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { const [, operation] = await instance.create({ clusters: { id: 'fake-cluster3', - location: 'us-west1-c', + location: 'u-us-prp1-a', nodes: 1, }, }); From 414cc285a17cc146957aa4cbe9cdbae4f0b13dcc Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Thu, 1 May 2025 14:51:33 -0400 Subject: [PATCH 17/17] Add the Google Application Credentials --- system-test/universe-domain-tests-working.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system-test/universe-domain-tests-working.ts b/system-test/universe-domain-tests-working.ts index 286499f5f..225da3e02 100644 --- a/system-test/universe-domain-tests-working.ts +++ b/system-test/universe-domain-tests-working.ts @@ -61,6 +61,8 @@ describe.only('Bigtable/ClientSideMetricsToMetricsHandler', () => { const options = { universeDomain, }; + process.env.GOOGLE_APPLICATION_CREDENTIALS = + '/Users/djbruce/Documents/Programming/keys/tpc_sa_key.json'; bigtable = new Bigtable(options); });