Skip to content

Commit bc267d1

Browse files
committed
update ID_TOKEN source
1 parent 95f4d2b commit bc267d1

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

run/system-package/test/system.test.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
const assert = require('assert');
1616
const got = require('got');
1717
const {execSync} = require('child_process');
18-
const {GoogleAuth} = require('google-auth-library');
19-
const auth = new GoogleAuth();
2018

2119
const request = (method, route, base_url, id_token) => {
2220
return got(new URL(route, base_url.trim()), {
@@ -33,6 +31,10 @@ describe('End-to-End Tests', () => {
3331
if (!GOOGLE_CLOUD_PROJECT) {
3432
throw Error('"GOOGLE_CLOUD_PROJECT" env var not found.');
3533
}
34+
const {ID_TOKEN} = process.env;
35+
if (!ID_TOKEN) {
36+
throw Error('"ID_TOKEN" env var not found.');
37+
}
3638
let {SERVICE_NAME} = process.env;
3739
if (!SERVICE_NAME) {
3840
SERVICE_NAME = 'system-package';
@@ -45,7 +47,7 @@ describe('End-to-End Tests', () => {
4547
const PLATFORM = 'managed';
4648
const REGION = 'us-central1';
4749

48-
let BASE_URL, ID_TOKEN;
50+
let BASE_URL;
4951
before(async () => {
5052
// Deploy service using Cloud Build
5153
let buildCmd =
@@ -67,12 +69,6 @@ describe('End-to-End Tests', () => {
6769

6870
BASE_URL = url.toString('utf-8').trim();
6971
if (!BASE_URL) throw Error('Cloud Run service URL not found');
70-
71-
// Retrieve ID token for testing
72-
const client = await auth.getIdTokenClient(BASE_URL);
73-
const clientHeaders = await client.getRequestHeaders();
74-
ID_TOKEN = clientHeaders['Authorization'].trim();
75-
if (!ID_TOKEN) throw Error('Unable to acquire an ID token.');
7672
});
7773

7874
after(() => {

0 commit comments

Comments
 (0)