Skip to content

Commit

Permalink
second try
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Sep 9, 2024
1 parent 3c8dec8 commit 4ac74b0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/plugins/bullMqMetricsPlugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TestBackgroundJobProcessor } from '../../test/mocks/TestBackgroundJobPr
import { TestDepedendencies } from '../../test/mocks/TestDepedendencies'

import type { RedisConfig } from '@lokalise/node-core'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { z } from 'zod'
import { RedisBasedQueueDiscoverer } from './bull-mq-metrics/queueDiscoverers'
import type { BullMqMetricsPluginOptions } from './bullMqMetricsPlugin'
Expand Down Expand Up @@ -161,9 +161,19 @@ describe('bullMqMetricsPlugin', () => {
})

await processor.spy.waitForJobWithId(jobId, 'completed')
await setTimeout(300)

const responseAfter = await getMetrics()
const responseAfter = await vi.waitUntil(async () => {
const responseAfter = await getMetrics()
// @ts-ignore
if (
responseAfter.result.body.includes(

Check failure on line 169 in lib/plugins/bullMqMetricsPlugin.spec.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'responseAfter.result.body' is of type 'unknown'.

Check failure on line 169 in lib/plugins/bullMqMetricsPlugin.spec.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

'responseAfter.result.body' is of type 'unknown'.
'bullmq_jobs_finished_duration_count{status="completed",queue="test_job"} 2',
)
) {
return responseAfter
}
})

expect(responseAfter.result.body).toContain(
// value is 2 since we are counting same redis client twice (only for tests)
'bullmq_jobs_finished_duration_count{status="completed",queue="test_job"} 2',
Expand Down

0 comments on commit 4ac74b0

Please sign in to comment.