|
10 | 10 | */ |
11 | 11 | /* global describe, it */ |
12 | 12 | process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' |
13 | | -// make sure config has a infra token before spm-agent is laoded first time |
| 13 | +// make sure config has an infra token before spm-agent is laoded first time |
14 | 14 | if (!process.env.INFRA_TOKEN) { |
15 | 15 | process.env.INFRA_TOKEN = 'INFRA_TOKEN' |
16 | 16 | } |
@@ -52,7 +52,7 @@ describe('SPM for Node.js tests', function () { |
52 | 52 | }).listen(port, '127.0.0.1') |
53 | 53 | httpTest(njsAgent, done) |
54 | 54 | setTimeout(function () { |
55 | | - var request = require('request') |
| 55 | + const request = require('request') |
56 | 56 | request.get('http://127.0.0.1:' + (port) + '/', function (err) { |
57 | 57 | if (err) { |
58 | 58 | console.log('Error' + err.stack) |
@@ -149,47 +149,4 @@ describe('SPM for Node.js tests', function () { |
149 | 149 | } |
150 | 150 | NjsAgent.on('metric', checkMetrics) |
151 | 151 | }) |
152 | | - |
153 | | - it('Wait for metrics: Process Agent', function (done) { |
154 | | - this.timeout(30000) |
155 | | - config.maxDataPoints = 1 |
156 | | - config.logger.console = false |
157 | | - config.logger.level = 'debug' |
158 | | - let metricCounter = 0 |
159 | | - let errorReported = false |
160 | | - const ProcessAgent = require('../lib/processAgent.js') |
161 | | - const agent = new ProcessAgent() |
162 | | - agent.start() |
163 | | - |
164 | | - function checkMetrics (metric) { |
165 | | - if (errorReported) { |
166 | | - return |
167 | | - } |
168 | | - if (metric.measurement && metric.measurement.indexOf('process') > -1 && |
169 | | - metric.fields.uptime && |
170 | | - metric.fields.rss && |
171 | | - metric.fields['cpu.usage'] && |
172 | | - metric.fields['thread.count']) { |
173 | | - if (metric.tags.token !== config.tokens.infra) { |
174 | | - done(new Error(`No infra token set ${metric.tags.token} != ${config.tokens.infra}`)) |
175 | | - errorReported = true |
176 | | - } |
177 | | - metricCounter = metricCounter + 1 |
178 | | - } |
179 | | - if (metric.measurement && metric.measurement.indexOf('process') > -1 && metric.fields.count) { |
180 | | - if (metric.tags.token !== config.tokens.infra) { |
181 | | - done(new Error(`No infra token set ${metric.tags.token} != ${config.tokens.infra}`)) |
182 | | - errorReported = true |
183 | | - } |
184 | | - metricCounter = metricCounter + 1 |
185 | | - } |
186 | | - |
187 | | - if (metricCounter > 2) { |
188 | | - agent.removeListener('metric', checkMetrics) |
189 | | - agent.stop() |
190 | | - done() |
191 | | - } |
192 | | - } |
193 | | - agent.on('metric', checkMetrics) |
194 | | - }) |
195 | 152 | }) |
0 commit comments