Skip to content

Commit

Permalink
test: Fix TPC Tests When Running on GCP (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbankhead authored Jan 29, 2024
1 parent f79a1da commit 7282af8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test/test.googleauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
saEmail,
} from './externalclienthelper';
import {BaseExternalAccountClient} from '../src/auth/baseexternalclient';
import {AuthClient} from '../src/auth/authclient';
import {AuthClient, DEFAULT_UNIVERSE} from '../src/auth/authclient';
import {ExternalAccountAuthorizedUserClient} from '../src/auth/externalAccountAuthorizedUserClient';

nock.disableNetConnect();
Expand Down Expand Up @@ -1386,6 +1386,7 @@ describe('googleauth', () => {
client_email: 'google@auth.library',
private_key: privateKey,
},
universeDomain: DEFAULT_UNIVERSE,
});
const value = await auth.sign(data);
const sign = crypto.createSign('RSA-SHA256');
Expand Down Expand Up @@ -1605,7 +1606,9 @@ describe('googleauth', () => {
// Set up a mock to explicity return the Project ID, as needed for impersonated ADC
mockEnvVar('GCLOUD_PROJECT', STUB_PROJECT);

const auth = new GoogleAuth();
const auth = new GoogleAuth({
universeDomain: DEFAULT_UNIVERSE,
});
const client = await auth.getClient();

const email = 'target@project.iam.gserviceaccount.com';
Expand Down Expand Up @@ -2309,6 +2312,7 @@ describe('googleauth', () => {
it('should reject when no impersonation is used', async () => {
const auth = new GoogleAuth({
credentials: createExternalAccountJSON(),
universeDomain: DEFAULT_UNIVERSE,
});

await assert.rejects(
Expand Down Expand Up @@ -2347,7 +2351,10 @@ describe('googleauth', () => {
)
.reply(200, {signedBlob})
);
const auth = new GoogleAuth({credentials: configWithImpersonation});
const auth = new GoogleAuth({
credentials: configWithImpersonation,
universeDomain: DEFAULT_UNIVERSE,
});

const value = await auth.sign(data);

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

it('getIdTokenClient() should reject', async () => {
const auth = new GoogleAuth({credentials: createExternalAccountJSON()});
const auth = new GoogleAuth({
credentials: createExternalAccountJSON(),
universeDomain: DEFAULT_UNIVERSE,
});

await assert.rejects(
auth.getIdTokenClient('a-target-audience'),
Expand Down Expand Up @@ -2536,6 +2546,7 @@ describe('googleauth', () => {
it('should reject', async () => {
const auth = new GoogleAuth({
credentials: createExternalAccountAuthorizedUserJson(),
universeDomain: DEFAULT_UNIVERSE,
});

await assert.rejects(
Expand Down

0 comments on commit 7282af8

Please sign in to comment.