Skip to content

Commit c287b51

Browse files
committed
include and assert error metric
1 parent 9555649 commit c287b51

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/integration/utilization/azurefunction-info.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
'use strict'
77

88
const test = require('node:test')
9-
const assert = require('assert')
10-
const helper = require('../../lib/agent_helper')
11-
const fetchAzureFunctionInfo = require('../../../lib/utilization/azurefunction-info')
9+
const assert = require('node:assert')
10+
const helper = require('#testlib/agent_helper.js')
11+
const fetchAzureFunctionInfo = require('#agentlib/utilization/azurefunction-info.js')
1212

1313
test.beforeEach((ctx) => {
1414
const agent = helper.loadMockedAgent({
@@ -38,12 +38,16 @@ test('should return null if detect_azurefunction is disabled', (ctx, end) => {
3838
})
3939
})
4040

41-
test('should return null if required environment variables are missing', (ctx, end) => {
41+
test('should increment error metric if required environment variables are missing', (ctx, end) => {
4242
const agent = ctx.nr.agent
43+
const azureErrorMetric = agent.metrics.getOrCreateMetric('Supportability/utilization/azure/error')
44+
45+
const initialCallCount = azureErrorMetric.callCount
4346

4447
fetchAzureFunctionInfo(agent, (err, result) => {
4548
assert.strictEqual(err, null)
4649
assert.strictEqual(result, null)
50+
assert.strictEqual(azureErrorMetric.callCount, initialCallCount + 1)
4751
end()
4852
})
4953
})

0 commit comments

Comments
 (0)