1414 * limitations under the License.
1515 */
1616
17+ import { HOST_ADDRESS } from 'gcp-metadata' ;
1718import * as nock from 'nock' ;
1819
1920const accept = ( ) => true ;
@@ -36,7 +37,7 @@ export function projectId(status: number|(() => string), reply?: () => string) {
3637 reply = status ;
3738 status = 200 ;
3839 }
39- return nock ( 'http://metadata.google.internal' )
40+ return nock ( HOST_ADDRESS )
4041 . get ( '/computeMetadata/v1/project/project-id' )
4142 . once ( )
4243 . reply ( status , reply , { 'Metadata-Flavor' : 'Google' } ) ;
@@ -48,7 +49,7 @@ export function instanceId(
4849 reply = status ;
4950 status = 200 ;
5051 }
51- return nock ( 'http://metadata.google.internal' )
52+ return nock ( HOST_ADDRESS )
5253 . get ( '/computeMetadata/v1/instance/id' )
5354 . once ( )
5455 . reply ( status , reply , { 'Metadata-Flavor' : 'Google' } ) ;
@@ -59,7 +60,7 @@ export function hostname(status: number|(() => string), reply?: () => string) {
5960 reply = status ;
6061 status = 200 ;
6162 }
62- return nock ( 'http://metadata.google.internal' )
63+ return nock ( HOST_ADDRESS )
6364 . get ( '/computeMetadata/v1/instance/hostname' )
6465 . once ( )
6566 . reply ( status , reply , { 'Metadata-Flavor' : 'Google' } ) ;
0 commit comments