1515const assert = require ( 'assert' ) ;
1616const got = require ( 'got' ) ;
1717const { execSync} = require ( 'child_process' ) ;
18- const { GoogleAuth} = require ( 'google-auth-library' ) ;
19- const auth = new GoogleAuth ( ) ;
2018
2119const 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