Skip to content

Commit

Permalink
fix(deps): update dependency gcp-metadata to v1 (#975)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency gcp-metadata to v1

* fix nock paths

* use HOST_ADDRESS
  • Loading branch information
renovate[bot] authored and kjin committed Feb 26, 2019
1 parent 29bb15c commit ea9cb4b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"console-log-level": "^1.4.0",
"continuation-local-storage": "^3.2.1",
"extend": "^3.0.0",
"gcp-metadata": "^0.9.0",
"gcp-metadata": "^1.0.0",
"hex2dec": "^1.0.1",
"is": "^3.2.0",
"methods": "^1.1.1",
Expand Down
7 changes: 4 additions & 3 deletions test/nocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import {HOST_ADDRESS} from 'gcp-metadata';
import * as nock from 'nock';

const accept = () => true;
Expand All @@ -36,7 +37,7 @@ export function projectId(status: number|(() => string), reply?: () => string) {
reply = status;
status = 200;
}
return nock('http://metadata.google.internal')
return nock(HOST_ADDRESS)
.get('/computeMetadata/v1/project/project-id')
.once()
.reply(status, reply, {'Metadata-Flavor': 'Google'});
Expand All @@ -48,7 +49,7 @@ export function instanceId(
reply = status;
status = 200;
}
return nock('http://metadata.google.internal')
return nock(HOST_ADDRESS)
.get('/computeMetadata/v1/instance/id')
.once()
.reply(status, reply, {'Metadata-Flavor': 'Google'});
Expand All @@ -59,7 +60,7 @@ export function hostname(status: number|(() => string), reply?: () => string) {
reply = status;
status = 200;
}
return nock('http://metadata.google.internal')
return nock(HOST_ADDRESS)
.get('/computeMetadata/v1/instance/hostname')
.once()
.reply(status, reply, {'Metadata-Flavor': 'Google'});
Expand Down
5 changes: 3 additions & 2 deletions test/test-no-self-tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'use strict';

import {FORCE_NEW} from '../src/util';
import {HOST_ADDRESS} from 'gcp-metadata';

var assert = require('assert');
var nock = require('nock');
Expand All @@ -32,7 +33,7 @@ nock.disableNetConnect();

describe('test-no-self-tracing', function() {
it('should not trace metadata queries', function(done) {
var scope = nock('http://metadata.google.internal')
var scope = nock(HOST_ADDRESS)
.get('/computeMetadata/v1/instance/hostname').reply(200)
.get('/computeMetadata/v1/instance/id').reply(200);
require('../..').start({[FORCE_NEW]: true});
Expand All @@ -46,7 +47,7 @@ describe('test-no-self-tracing', function() {
});

it('should not trace publishes', function(done) {
var metadataScope = nock('http://metadata.google.internal')
var metadataScope = nock(HOST_ADDRESS)
.get('/computeMetadata/v1/instance/hostname').reply(200)
.get('/computeMetadata/v1/instance/id').reply(200);
var apiScope = nock('https://cloudtrace.googleapis.com')
Expand Down

0 comments on commit ea9cb4b

Please sign in to comment.