Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 1dae581

Browse files
renovate[bot]mayurkale22
authored andcommitted
Update dependency gcp-metadata to v1 (#346)
* Update dependency gcp-metadata to v1 * fix nocks path
1 parent 8b80a65 commit 1dae581

3 files changed

Lines changed: 43 additions & 20 deletions

File tree

packages/opencensus-exporter-stackdriver/test/nocks.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const HEADERS = {
2525
['metadata-flavor']: 'Google'
2626
};
2727

28+
const HOST_ADDRESS = 'http://metadata.google.internal.';
29+
2830
export function oauth2<T extends {} = {}>(validator?: (body: T) => boolean):
2931
nock.Scope {
3032
validator = validator || accept;
@@ -43,15 +45,15 @@ export function projectId(status: number|(() => string), reply?: () => string) {
4345
reply = status;
4446
status = 200;
4547
}
46-
return nock('http://metadata.google.internal')
48+
return nock(HOST_ADDRESS)
4749
.get('/computeMetadata/v1/project/project-id')
4850
.once()
4951
.reply(status, reply, {'Metadata-Flavor': 'Google'});
5052
}
5153

5254
export function noDetectResource() {
5355
const scopes = [
54-
nock('http://metadata.google.internal')
56+
nock(HOST_ADDRESS)
5557
.get('/computeMetadata/v1/instance')
5658
.once()
5759
.replyWithError({code: 'ENOTFOUND'}),
@@ -63,7 +65,7 @@ export function noDetectResource() {
6365
}
6466

6567
export function detectGceResource() {
66-
return nock('http://metadata.google.internal')
68+
return nock(HOST_ADDRESS)
6769
.get('/computeMetadata/v1/instance')
6870
.reply(200, {}, HEADERS)
6971
.get('/computeMetadata/v1/project/project-id')
@@ -80,7 +82,7 @@ export function instanceId(
8082
reply = status;
8183
status = 200;
8284
}
83-
return nock('http://metadata.google.internal')
85+
return nock(HOST_ADDRESS)
8486
.get('/computeMetadata/v1/instance/id')
8587
.once()
8688
.reply(status, reply, {'Metadata-Flavor': 'Google'});
@@ -91,7 +93,7 @@ export function hostname(status: number|(() => string), reply?: () => string) {
9193
reply = status;
9294
status = 200;
9395
}
94-
return nock('http://metadata.google.internal')
96+
return nock(HOST_ADDRESS)
9597
.get('/computeMetadata/v1/instance/hostname')
9698
.once()
9799
.reply(status, reply, {'Metadata-Flavor': 'Google'});

packages/opencensus-resource-util/package-lock.json

Lines changed: 35 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/opencensus-resource-util/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
},
5353
"dependencies": {
5454
"@opencensus/core": "^0.0.9",
55-
"gcp-metadata": "^0.9.3"
55+
"gcp-metadata": "^1.0.0"
5656
}
5757
}

0 commit comments

Comments
 (0)