1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

test: speed up the tests (#5140)

This commit is contained in:
Mateusz Kwasniewski 2023-10-24 14:31:38 +02:00 committed by GitHub
parent 5acf691845
commit 19098808ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 8 deletions

View File

@ -31,7 +31,7 @@ const password = 'DtUYwi&l5I1KX4@Le';
let userService: UserService;
let adminUser: IUser;
beforeEach(async () => {
beforeAll(async () => {
db = await dbInit('simple_password_provider_api_serial', getLogger);
stores = db.stores;
app = await setupApp(stores);
@ -61,8 +61,15 @@ beforeEach(async () => {
});
});
beforeEach(async () => {
app = await setupApp(stores);
});
afterEach(async () => {
await app.destroy();
});
afterAll(async () => {
await db.destroy();
});

View File

@ -52,7 +52,7 @@ test('multiple parallel calls to api/frontend should not create multiple instanc
});
await Promise.all(
Array.from(Array(15).keys()).map(() =>
Array.from(Array(10).keys()).map(() =>
app.request
.get('/api/frontend')
.set('Authorization', frontendTokenDefault.secret)

View File

@ -6,13 +6,13 @@ let db;
let stores;
let clientApplicationsStore;
beforeEach(async () => {
beforeAll(async () => {
db = await dbInit('client_application_store_e2e_serial', getLogger);
stores = db.stores;
clientApplicationsStore = stores.clientApplicationsStore;
});
afterEach(async () => {
afterAll(async () => {
await db.destroy();
});

View File

@ -11,16 +11,20 @@ let db;
let stores: IUnleashStores;
let clientMetricsStore: IClientMetricsStoreV2;
beforeEach(async () => {
beforeAll(async () => {
db = await dbInit('client_metrics_store_v2_e2e_serial', getLogger);
stores = db.stores;
clientMetricsStore = stores.clientMetricsStoreV2;
});
afterEach(async () => {
afterAll(async () => {
await db.destroy();
});
beforeEach(async () => {
await stores.clientMetricsStoreV2.deleteAll();
});
test('Should store single list of metrics', async () => {
const metrics: IClientMetricsEnv[] = [
{

View File

@ -11,7 +11,7 @@ let featureEnvironmentStore: IFeatureEnvironmentStore;
let featureStore: IFeatureToggleStore;
let environmentStore: IEnvironmentStore;
beforeEach(async () => {
beforeAll(async () => {
db = await dbInit('feature_environment_store_serial', getLogger);
stores = db.stores;
featureEnvironmentStore = stores.featureEnvironmentStore;
@ -19,7 +19,7 @@ beforeEach(async () => {
featureStore = stores.featureToggleStore;
});
afterEach(async () => {
afterAll(async () => {
await db.destroy();
});