Skip to content

Commit

Permalink
test: speed up the tests (#5140)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Oct 24, 2023
1 parent 5acf691 commit 1909880
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
9 changes: 8 additions & 1 deletion src/test/e2e/api/auth/simple-password-provider.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -61,8 +61,15 @@ beforeEach(async () => {
});
});

beforeEach(async () => {
app = await setupApp(stores);
});

afterEach(async () => {
await app.destroy();
});

afterAll(async () => {
await db.destroy();
});

Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/api/proxy/proxy.concurrency.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/stores/client-application-store.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
8 changes: 6 additions & 2 deletions src/test/e2e/stores/client-metrics-store-v2.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
{
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/stores/feature-environment-store.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ 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;
environmentStore = stores.environmentStore;
featureStore = stores.featureToggleStore;
});

afterEach(async () => {
afterAll(async () => {
await db.destroy();
});

Expand Down

0 comments on commit 1909880

Please sign in to comment.