Skip to content

Commit 8d4ea7e

Browse files
committed
test: removed fs span assertion from tests
1 parent 545ac45 commit 8d4ea7e

File tree

5 files changed

+52
-25
lines changed

5 files changed

+52
-25
lines changed

packages/collector/test/tracing/cloud/azure/blob/test.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ if (!storageAccount || !accountKey) {
8888
AZURE_CONNECTION_STRING: connStr,
8989
AZURE_STORAGE_ACCOUNT: storageAccount,
9090
AZURE_ACCOUNT_KEY: accountKey,
91-
AZURE_BLOB_VERSION: version
91+
AZURE_BLOB_VERSION: version,
92+
// We set the following env var to disable the OpenTelemetry instrumentation for this test
93+
INSTANA_DISABLE_USE_OPENTELEMETRY: 'true'
9294
}
9395
});
9496

@@ -140,7 +142,9 @@ if (!storageAccount || !accountKey) {
140142
withError: false,
141143
spans: spans,
142144
op: 'upload',
143-
totalspans: 4 // expects 1 azure upload span, 1 fs span of otel and 2 http spans
145+
// expects 1 azure upload span and 2 http spans
146+
// +1 otel fs also there, but we have disabled otel instrumentation for this test
147+
totalspans: 3
144148
});
145149
});
146150
});
@@ -159,7 +163,9 @@ if (!storageAccount || !accountKey) {
159163
withError: true,
160164
spans: spans,
161165
op: 'upload',
162-
totalspans: 3 // expects 1 azure upload span, 1 fs span of otel and 1 http span
166+
// expects 1 azure upload span and 1 http span
167+
// +1 otel fs also there, but we have disabled otel instrumentation for this test
168+
totalspans: 2
163169
});
164170
});
165171
});
@@ -273,7 +279,8 @@ if (!storageAccount || !accountKey) {
273279
withError: false,
274280
spans: spans,
275281
op: 'download',
276-
totalspans: 6 // expects 3 azure spans( delete, upload, download ), 2 fs spans and 1 http span
282+
// // +1 otel fs also there, but we have disabled otel instrumentation for this test
283+
totalspans: 4 // expects 3 azure spans( delete, upload, download ) and 1 http span
277284
});
278285
});
279286
});
@@ -292,7 +299,9 @@ if (!storageAccount || !accountKey) {
292299
withError: false,
293300
spans: spans,
294301
op: 'download',
295-
totalspans: 7 // expects 3 azure spans( delete, upload, download ), 2 fs spans and 2 http spans
302+
// expects 3 azure spans( delete, upload, download ) and 1 http span
303+
// +2 otel fs also there, but we have disabled otel instrumentation for this test
304+
totalspans: 5
296305
});
297306
});
298307
});
@@ -311,7 +320,9 @@ if (!storageAccount || !accountKey) {
311320
withError: false,
312321
spans: spans,
313322
op: 'download',
314-
totalspans: 7 // expects 3 azure spans( delete, upload, download ), 2 fs spans and 2 http spans
323+
// expects 3 azure spans( delete, upload, download ) and 2 http spans
324+
// +2 otel fs also there, but we have disabled otel instrumentation for this test
325+
totalspans: 5
315326
});
316327
});
317328
});
@@ -330,7 +341,9 @@ if (!storageAccount || !accountKey) {
330341
withError: false,
331342
spans: spans,
332343
op: 'download',
333-
totalspans: 6 // expects 3 azure spans( delete, upload, download ), 2 fs spans and 1 http span
344+
// expects 3 azure spans( delete, upload, download ) and 1 http span
345+
// +2 otel fs also there, but we have disabled otel instrumentation for this test
346+
totalspans: 4
334347
});
335348
});
336349
});

packages/collector/test/tracing/databases/db2/test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ mochaSuiteFn('tracing/db2', function () {
136136
DB2_TABLE_NAME_1: TABLE_NAME_1,
137137
DB2_TABLE_NAME_2: TABLE_NAME_2,
138138
DB2_TABLE_NAME_3: TABLE_NAME_3,
139-
DB2_CLOSE_TIMEOUT_IN_MS
139+
DB2_CLOSE_TIMEOUT_IN_MS,
140+
// We set the following env var to disable the OpenTelemetry instrumentation for this test
141+
INSTANA_DISABLE_USE_OPENTELEMETRY: 'true'
140142
}
141143
});
142144

@@ -878,12 +880,12 @@ mochaSuiteFn('tracing/db2', function () {
878880
.then(() =>
879881
testUtils.retry(() =>
880882
verifySpans(agentControls, controls, {
881-
numberOfSpans: 15,
883+
numberOfSpans: 10,
882884
// Spans:
883885
// 10 queries splitted from the file
884886
// 5 fs operations on top (ours + from db2 internally fs-extra)
885887
// https://github.com/ibmdb/node-ibm_db/blob/fb25937524d74d25917e9aa67fb4737971317986/lib/odbc.js#L916
886-
// If the Otel integration is disabled, we expect 11 spans.
888+
// Since the Otel instrumentation is disabled, we expect 10 spans.
887889
verifyCustom: (entrySpan, spans) => {
888890
const stmtsToExpect = [
889891
`create table ${TABLE_NAME_3}(no integer,name varchar(10))`,

packages/collector/test/tracing/databases/mysql/test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ function registerSuite(agentControls, driverMode, useExecute, mysql2Version) {
7171
describe('suppressed', function () {
7272
const env = {
7373
DRIVER_MODE: driverMode,
74-
MYSQL2_VERSION: mysql2Version
74+
MYSQL2_VERSION: mysql2Version,
75+
// We set the following env var to disable the OpenTelemetry instrumentation for this test
76+
INSTANA_DISABLE_USE_OPENTELEMETRY: 'true'
7577
};
7678
if (useExecute) {
7779
env.USE_EXECUTE = 'true';
@@ -276,8 +278,8 @@ function test(env, agentControls, driverMode) {
276278
// 1 x mysql
277279
// 1 x httpserver
278280
// 1 x httpclient
279-
// 1 x otel fs(included in mysql2/promise)
280-
const expectedSpanCount = driverMode === 'mysql2/promises' ? 4 : 3;
281+
// 1 x otel fs(included in mysql2/promise), but we disable otel for this test
282+
const expectedSpanCount = 3;
281283
expect(spans.length).to.equal(expectedSpanCount);
282284
const postEntrySpan = testUtils.expectAtLeastOneMatching(spans, [
283285
span => expect(span.n).to.equal('node.http.server'),

packages/collector/test/tracing/logging/bunyan/test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ mochaSuiteFn('tracing/logging/bunyan', function () {
2929
before(async () => {
3030
controls = new ProcessControls({
3131
appPath: path.join(__dirname, 'bunyanApp'),
32-
useGlobalAgent: true
32+
useGlobalAgent: true,
33+
env: {
34+
// We set the following env var to disable the OpenTelemetry instrumentation for this test
35+
INSTANA_DISABLE_USE_OPENTELEMETRY: 'true'
36+
}
3337
});
3438

3539
await controls.startAndWaitForAgentConnection();
@@ -87,7 +91,9 @@ mochaSuiteFn('tracing/logging/bunyan', function () {
8791
'{"_id":"638dea148cff492d47e792ea","index":0,"guid":"01b61bfa-fe4c-4d75-9224-389c4c04de10","isActive":false,"balance":"$1,919.18","picture":"http://placehold.it/32x32","age":37,"eyeColor":"blue","name":"Manning Brady","gender":"male","company":"ZYTRAC","email":"[email protected]","phone":"+1 (957) 538-2183","address":"146 Bushwick Court, Gilgo, New York, 2992","about":"Ullamco cillum reprehenderit eu proident veniam laboris tempor voluptate. Officia deserunt velit incididunt consequat la...',
8892
controls,
8993
500,
90-
4
94+
// entry + exit + bunyan log + fs call so total 4
95+
// but we disabled otel instrumentation for this test so total 3
96+
3
9197
));
9298

9399
it("must capture an error object's message and an additional string", () =>

packages/collector/test/tracing/open_tracing/integration_test.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,20 @@ describe('tracing/opentracing/integration', function () {
114114

115115
// OpenTracing lazy loads cls.js, which creates a span via the OTel fs plug-in.
116116
// realpathSync /path/to/repo/nodejs/packages/core/src/tracing/cls.js
117-
testUtils.expectAtLeastOneMatching(spans, [
118-
span => expect(span.t).to.equal(httpSpan.t),
119-
span => expect(span.p).to.equal(httpSpan.s),
120-
span => expect(span.s).to.be.a('string'),
121-
span => expect(span.s).not.to.equal(span.t),
122-
span => expect(span.s).not.to.equal(span.p),
123-
span => expect(span.n).to.equal('otel'),
124-
span => expect(span.f.e).to.equal(String(expressOpentracingControls.getPid())),
125-
span => expect(span.f.h).to.equal('agent-stub-uuid')
126-
]);
117+
118+
// Currently we disable OTel instrumentation for tests due npm workspace issue, so the fs span is not created.
119+
// If we re-enable OTel instrumentation for tests, we need to uncomment the check below.
120+
121+
// testUtils.expectAtLeastOneMatching(spans, [
122+
// span => expect(span.t).to.equal(httpSpan.t),
123+
// span => expect(span.p).to.equal(httpSpan.s),
124+
// span => expect(span.s).to.be.a('string'),
125+
// span => expect(span.s).not.to.equal(span.t),
126+
// span => expect(span.s).not.to.equal(span.p),
127+
// span => expect(span.n).to.equal('otel'),
128+
// span => expect(span.f.e).to.equal(String(expressOpentracingControls.getPid())),
129+
// span => expect(span.f.h).to.equal('agent-stub-uuid')
130+
// ]);
127131
});
128132
});
129133

0 commit comments

Comments
 (0)