Skip to content

Commit acdb080

Browse files
committed
chore: fix intg tests not closing
1 parent d9e4020 commit acdb080

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/integration/features/shared.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ import Sinon from 'sinon'
1616
import { connect, createIdentity, createSubscription, sendEvent } from './helpers'
1717
import { getMasterDbClient, getReadReplicaDbClient } from '../../../src/database/client'
1818
import { AppWorker } from '../../../src/app/worker'
19+
import { CacheClient } from '../../../src/@types/cache'
1920
import { DatabaseClient } from '../../../src/@types/base'
2021
import { Event } from '../../../src/@types/event'
22+
import { getCacheClient } from '../../../src/cache/client'
2123
import { SettingsStatic } from '../../../src/utils/settings'
2224
import { workerFactory } from '../../../src/factories/worker-factory'
2325

@@ -27,6 +29,7 @@ let worker: AppWorker
2729

2830
let dbClient: DatabaseClient
2931
let rrDbClient: DatabaseClient
32+
let cacheClient: CacheClient
3033

3134
export const streams = new WeakMap<WebSocket, Observable<unknown>>()
3235

@@ -35,7 +38,9 @@ BeforeAll({ timeout: 1000 }, async function () {
3538
process.env.SECRET = Math.random().toString().repeat(6)
3639
dbClient = getMasterDbClient()
3740
rrDbClient = getReadReplicaDbClient()
41+
cacheClient = getCacheClient()
3842
await dbClient.raw('SELECT 1=1')
43+
await rrDbClient.raw('SELECT 1=1')
3944
Sinon.stub(SettingsStatic, 'watchSettings')
4045
const settings = SettingsStatic.createSettings()
4146

@@ -54,7 +59,11 @@ BeforeAll({ timeout: 1000 }, async function () {
5459

5560
AfterAll(async function() {
5661
worker.close(async () => {
57-
await Promise.all([dbClient.destroy(), rrDbClient.destroy()])
62+
await Promise.all([
63+
dbClient.destroy(),
64+
rrDbClient.destroy(),
65+
cacheClient.disconnect(),
66+
])
5867
})
5968
})
6069

@@ -75,8 +84,6 @@ After(async function () {
7584
}
7685
this.parameters.clients = {}
7786

78-
const dbClient = getMasterDbClient()
79-
8087
await dbClient('events')
8188
.whereIn('event_pubkey', Object
8289
.values(this.parameters.identities as Record<string, { pubkey: string }>)

0 commit comments

Comments
 (0)