Skip to content

Commit e7446c5

Browse files
authored
test(node): Use https version of example.com in Node integration tests (#15060)
Analogously to #15052 this PR switches to the https version of example.com since the http version seems to have become unstable in the last couple of days. These tests failed a lot in CI recently.
1 parent 516f632 commit e7446c5

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

dev-packages/node-integration-tests/suites/tracing/httpIntegration/server-ignoreOutgoingRequests.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { loggingTransport } = require('@sentry-internal/node-integration-tests');
22
const Sentry = require('@sentry/node');
3-
const http = require('http');
43

54
Sentry.init({
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
@@ -11,7 +10,7 @@ Sentry.init({
1110
integrations: [
1211
Sentry.httpIntegration({
1312
ignoreOutgoingRequests: (url, request) => {
14-
if (url === 'http://example.com/blockUrl') {
13+
if (url === 'https://example.com/blockUrl') {
1514
return true;
1615
}
1716

@@ -24,6 +23,8 @@ Sentry.init({
2423
],
2524
});
2625

26+
const https = require('https');
27+
2728
// express must be required after Sentry is initialized
2829
const express = require('express');
2930
const cors = require('cors');
@@ -34,16 +35,16 @@ const app = express();
3435
app.use(cors());
3536

3637
app.get('/testUrl', (_req, response) => {
37-
makeHttpRequest('http://example.com/blockUrl').then(() => {
38-
makeHttpRequest('http://example.com/pass').then(() => {
38+
makeHttpRequest('https://example.com/blockUrl').then(() => {
39+
makeHttpRequest('https://example.com/pass').then(() => {
3940
response.send({ response: 'done' });
4041
});
4142
});
4243
});
4344

4445
app.get('/testRequest', (_req, response) => {
45-
makeHttpRequest('http://example.com/blockRequest').then(() => {
46-
makeHttpRequest('http://example.com/pass').then(() => {
46+
makeHttpRequest('https://example.com/blockRequest').then(() => {
47+
makeHttpRequest('https://example.com/pass').then(() => {
4748
response.send({ response: 'done' });
4849
});
4950
});
@@ -55,7 +56,7 @@ startExpressServerAndSendPortToRunner(app);
5556

5657
function makeHttpRequest(url) {
5758
return new Promise((resolve, reject) => {
58-
http
59+
https
5960
.get(url, res => {
6061
res.on('data', () => {});
6162
res.on('end', () => {

dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ describe('httpIntegration', () => {
137137

138138
const requestSpans = event.spans?.filter(span => span.op === 'http.client');
139139
expect(requestSpans).toHaveLength(1);
140-
expect(requestSpans![0]?.description).toBe('GET http://example.com/pass');
140+
expect(requestSpans![0]?.description).toBe('GET https://example.com/pass');
141141

142142
const breadcrumbs = event.breadcrumbs?.filter(b => b.category === 'http');
143143
expect(breadcrumbs).toHaveLength(1);
144-
expect(breadcrumbs![0]?.data?.url).toEqual('http://example.com/pass');
144+
expect(breadcrumbs![0]?.data?.url).toEqual('https://example.com/pass');
145145
},
146146
})
147147
.start(done);
@@ -157,11 +157,11 @@ describe('httpIntegration', () => {
157157

158158
const requestSpans = event.spans?.filter(span => span.op === 'http.client');
159159
expect(requestSpans).toHaveLength(1);
160-
expect(requestSpans![0]?.description).toBe('GET http://example.com/pass');
160+
expect(requestSpans![0]?.description).toBe('GET https://example.com/pass');
161161

162162
const breadcrumbs = event.breadcrumbs?.filter(b => b.category === 'http');
163163
expect(breadcrumbs).toHaveLength(1);
164-
expect(breadcrumbs![0]?.data?.url).toEqual('http://example.com/pass');
164+
expect(breadcrumbs![0]?.data?.url).toEqual('https://example.com/pass');
165165
},
166166
})
167167
.start(done);

0 commit comments

Comments
 (0)