Skip to content

Commit

Permalink
fix(test): reset redis in e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Jun 3, 2022
1 parent 3905185 commit a3fed7d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/backend/src/db/postgre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { entities as charts } from '@/services/chart/entities.js';
import { Webhook } from '@/models/entities/webhook.js';
import { envOption } from '../env.js';
import { dbLogger } from './logger.js';
import { redisClient } from './redis.js';

const sqlLogger = dbLogger.createSubLogger('sql', 'gray', false);

Expand Down Expand Up @@ -217,6 +218,7 @@ export async function initDb() {

export async function resetDb() {
const reset = async () => {
await redisClient.FLUSHDB();
const tables = await db.query(`SELECT relname AS "table"
FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
Expand Down

0 comments on commit a3fed7d

Please sign in to comment.