|
| 1 | +/* |
| 2 | + * (c) Copyright IBM Corp. 2025 |
| 3 | + */ |
| 4 | + |
| 5 | +'use strict'; |
| 6 | + |
| 7 | +const { expect } = require('chai'); |
| 8 | +const supportedVersion = require('@instana/core').tracing.supportedVersion; |
| 9 | +const config = require('../../../../../core/test/config'); |
| 10 | +const testUtils = require('../../../../../core/test/test_util'); |
| 11 | +const ProcessControls = require('../../../test_util/ProcessControls'); |
| 12 | +const globalAgent = require('../../../globalAgent'); |
| 13 | +const agentControls = globalAgent.instance; |
| 14 | + |
| 15 | +const mochaSuiteFn = supportedVersion(process.versions.node) ? describe : describe.skip; |
| 16 | + |
| 17 | +mochaSuiteFn('tracing/agent logs', function () { |
| 18 | + this.timeout(config.getTestTimeout()); |
| 19 | + globalAgent.setUpCleanUpHooks(); |
| 20 | + |
| 21 | + describe('Ensure agent logs are transmitted', function () { |
| 22 | + let controls; |
| 23 | + |
| 24 | + before(async () => { |
| 25 | + controls = new ProcessControls({ |
| 26 | + dirname: __dirname, |
| 27 | + useGlobalAgent: true |
| 28 | + }); |
| 29 | + |
| 30 | + await controls.startAndWaitForAgentConnection(); |
| 31 | + }); |
| 32 | + |
| 33 | + beforeEach(async () => { |
| 34 | + await agentControls.clearReceivedTraceData(); |
| 35 | + }); |
| 36 | + |
| 37 | + after(async () => { |
| 38 | + await controls.stop(); |
| 39 | + }); |
| 40 | + |
| 41 | + it('expect agent logs data', async () => { |
| 42 | + await controls.sendRequest({ |
| 43 | + path: '/trace' |
| 44 | + }); |
| 45 | + |
| 46 | + await testUtils.retry(async () => { |
| 47 | + const spans = await agentControls.getSpans(); |
| 48 | + const agentLogs = await agentControls.getAgentLogs(); |
| 49 | + |
| 50 | + expect(spans.length).to.equal(2); |
| 51 | + expect(agentLogs.length).to.equal(9); |
| 52 | + }); |
| 53 | + }); |
| 54 | + }); |
| 55 | +}); |
0 commit comments