| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { describe, it, before, after } from 'mocha'
- import { expect } from 'chai'
- import { By } from 'selenium-webdriver'
- import {
- takeScreenshotOnFailure,
- } from '../../lib/elements.js'
- let metrics = [
- {'name': 'olivetin_actions_requested_count', 'type': 'counter', 'desc': 'The actions requested count'},
- {'name': 'olivetin_action_executions_total', 'type': 'counter', 'desc': 'Total number of finished action executions grouped by result\\.'},
- {'name': 'olivetin_action_execution_duration_seconds', 'type': 'histogram', 'desc': 'Action execution duration in seconds from start to finish\\.'},
- {'name': 'olivetin_config_action_count', 'type': 'gauge', 'desc': 'The number of actions in the config file'},
- {'name': 'olivetin_config_reloaded_count', 'type': 'counter', 'desc': 'The number of times the config has been reloaded'},
- ]
- describe('config: prometheus', function () {
- before(async function () {
- await runner.start('prometheus')
- })
- after(async () => {
- await runner.stop()
- })
- afterEach(function () {
- takeScreenshotOnFailure(this.currentTest, webdriver);
- });
- it('Metrics are available with correct types', async () => {
- await webdriver.get(runner.metricsUrl())
- const prometheusOutput = await webdriver.findElement(By.tagName('pre')).getText()
- expect(prometheusOutput).to.not.be.null
- metrics.forEach(({name, type, desc}) => {
- const metaLines = `# HELP ${name} ${desc}\n`
- + `# TYPE ${name} ${type}\n`
- expect(prometheusOutput).to.match(new RegExp(metaLines))
- })
- })
- })
|