Skip to content

Commit 3fb2093

Browse files
committed
test: Fix TPC Tests When Running on GCP
1 parent 422de68 commit 3fb2093

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Diff for: test/test.googleauth.ts

+15-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {
5353
saEmail,
5454
} from './externalclienthelper';
5555
import {BaseExternalAccountClient} from '../src/auth/baseexternalclient';
56-
import {AuthClient} from '../src/auth/authclient';
56+
import {AuthClient, DEFAULT_UNIVERSE} from '../src/auth/authclient';
5757
import {ExternalAccountAuthorizedUserClient} from '../src/auth/externalAccountAuthorizedUserClient';
5858

5959
nock.disableNetConnect();
@@ -1386,6 +1386,7 @@ describe('googleauth', () => {
13861386
client_email: '[email protected]',
13871387
private_key: privateKey,
13881388
},
1389+
universeDomain: DEFAULT_UNIVERSE,
13891390
});
13901391
const value = await auth.sign(data);
13911392
const sign = crypto.createSign('RSA-SHA256');
@@ -1605,7 +1606,9 @@ describe('googleauth', () => {
16051606
// Set up a mock to explicity return the Project ID, as needed for impersonated ADC
16061607
mockEnvVar('GCLOUD_PROJECT', STUB_PROJECT);
16071608

1608-
const auth = new GoogleAuth();
1609+
const auth = new GoogleAuth({
1610+
universeDomain: DEFAULT_UNIVERSE,
1611+
});
16091612
const client = await auth.getClient();
16101613

16111614
const email = '[email protected]';
@@ -2309,6 +2312,7 @@ describe('googleauth', () => {
23092312
it('should reject when no impersonation is used', async () => {
23102313
const auth = new GoogleAuth({
23112314
credentials: createExternalAccountJSON(),
2315+
universeDomain: DEFAULT_UNIVERSE,
23122316
});
23132317

23142318
await assert.rejects(
@@ -2347,7 +2351,10 @@ describe('googleauth', () => {
23472351
)
23482352
.reply(200, {signedBlob})
23492353
);
2350-
const auth = new GoogleAuth({credentials: configWithImpersonation});
2354+
const auth = new GoogleAuth({
2355+
credentials: configWithImpersonation,
2356+
universeDomain: DEFAULT_UNIVERSE,
2357+
});
23512358

23522359
const value = await auth.sign(data);
23532360

@@ -2357,7 +2364,10 @@ describe('googleauth', () => {
23572364
});
23582365

23592366
it('getIdTokenClient() should reject', async () => {
2360-
const auth = new GoogleAuth({credentials: createExternalAccountJSON()});
2367+
const auth = new GoogleAuth({
2368+
credentials: createExternalAccountJSON(),
2369+
universeDomain: DEFAULT_UNIVERSE,
2370+
});
23612371

23622372
await assert.rejects(
23632373
auth.getIdTokenClient('a-target-audience'),
@@ -2536,6 +2546,7 @@ describe('googleauth', () => {
25362546
it('should reject', async () => {
25372547
const auth = new GoogleAuth({
25382548
credentials: createExternalAccountAuthorizedUserJson(),
2549+
universeDomain: DEFAULT_UNIVERSE,
25392550
});
25402551

25412552
await assert.rejects(

0 commit comments

Comments
 (0)