Skip to content

Commit 7f2d4ea

Browse files
committed
update call
1 parent 0818fb2 commit 7f2d4ea

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/proxy/cdk-requests-go-through-a-proxy-when-configured.integtest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ integTest('requests go through a proxy when configured',
3030

3131
const connections = JSON.parse(await fs.readFile(path.join(cdkCacheDir, 'connection.json'), 'utf8'));
3232
// eslint-disable-next-line no-console
33-
console.log(connections);
33+
console.log('connections', connections);
3434

3535
const requests = await proxyServer.getSeenRequests();
3636
const urls = requests.map(req => req.url);

packages/@aws-cdk/toolkit-lib/lib/api/notices/web-data-source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class WebsiteNoticeDataSource implements NoticeDataSource {
5858
async fetch(): Promise<Notice[]> {
5959
if (!this.skipNetworkCache) {
6060
await this.ioHelper.notify({
61-
message: `website data source fetch starting, ${JSON.stringify(this.agent)}`,
61+
message: `website data source fetch starting, ${this.agent !== undefined}}`,
6262
time: new Date(Date.now()),
6363
level: 'info',
6464
data: undefined,

packages/@aws-cdk/toolkit-lib/lib/util/network-detector.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class NetworkDetector {
4646
}
4747

4848
private static readonly TIMEOUT_MS = 500;
49+
private static readonly URL = 'https://cli.cdk.dev-tools.aws.dev/notices.json';
4950

5051
private static async load(): Promise<CachedConnectivity> {
5152
const defaultValue = {
@@ -73,9 +74,7 @@ export class NetworkDetector {
7374

7475
private static ping(agent?: https.Agent): Promise<boolean> {
7576
return new Promise((resolve) => {
76-
const req = https.request({
77-
hostname: 'cli.cdk.dev-tools.aws.dev',
78-
path: '/notices.json',
77+
const req = https.request(NetworkDetector.URL, {
7978
method: 'HEAD',
8079
agent,
8180
timeout: this.TIMEOUT_MS,

packages/@aws-cdk/toolkit-lib/test/util/network-detector.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ describe('NetworkDetector', () => {
3131
destroy: jest.fn(),
3232
};
3333

34-
mockRequest.mockImplementation((_options, callback) => {
35-
callback({ statusCode: 200 });
34+
mockRequest.mockImplementation((_url, _options, callback) => {
35+
setTimeout(() => callback({ statusCode: 200 }), 0);
3636
return mockReq;
3737
});
3838

@@ -51,8 +51,8 @@ describe('NetworkDetector', () => {
5151
destroy: jest.fn(),
5252
};
5353

54-
mockRequest.mockImplementation((_options, callback) => {
55-
callback({ statusCode: 500 });
54+
mockRequest.mockImplementation((_url, _options, callback) => {
55+
setTimeout(() => callback({ statusCode: 500 }), 0);
5656
return mockReq;
5757
});
5858

@@ -109,8 +109,8 @@ describe('NetworkDetector', () => {
109109
destroy: jest.fn(),
110110
};
111111

112-
mockRequest.mockImplementation((_options, callback) => {
113-
callback({ statusCode: 200 });
112+
mockRequest.mockImplementation((_url, _options, callback) => {
113+
setTimeout(() => callback({ statusCode: 200 }), 0);
114114
return mockReq;
115115
});
116116

@@ -132,8 +132,8 @@ describe('NetworkDetector', () => {
132132
destroy: jest.fn(),
133133
};
134134

135-
mockRequest.mockImplementation((_options, callback) => {
136-
callback({ statusCode: 200 });
135+
mockRequest.mockImplementation((_url, _options, callback) => {
136+
setTimeout(() => callback({ statusCode: 200 }), 0);
137137
return mockReq;
138138
});
139139

@@ -152,8 +152,8 @@ describe('NetworkDetector', () => {
152152
destroy: jest.fn(),
153153
};
154154

155-
mockRequest.mockImplementation((_options, callback) => {
156-
callback({ statusCode: 200 });
155+
mockRequest.mockImplementation((_url, _options, callback) => {
156+
setTimeout(() => callback({ statusCode: 200 }), 0);
157157
return mockReq;
158158
});
159159

0 commit comments

Comments
 (0)