Skip to content

Commit

Permalink
add timeouts and runs improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
OlimpiaZurek committed Nov 28, 2023
1 parent c6e6e04 commit 243396a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 101 deletions.
91 changes: 0 additions & 91 deletions tests/perf-test/ReportActionsUtils.perf-test.js

This file was deleted.

20 changes: 10 additions & 10 deletions tests/perf-test/ReportActionsUtils.perf-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import createCollection from '../utils/collections/createCollection';
import createRandomReportAction from '../utils/collections/reportActions';
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';

jest.setTimeout(60000);

beforeAll(() =>
Onyx.init({
keys: ONYXKEYS,
Expand Down Expand Up @@ -48,6 +46,8 @@ const reportActions = createCollection<ReportAction>(

const reportId = '1';

const runs = CONST.PERFORMANCE_TESTS.RUNS;

/**
* This function will be executed 20 times and the average time will be used on the comparison.
* It will fail based on the CI configuration around Reassure:
Expand All @@ -64,7 +64,7 @@ test('getLastVisibleAction on 10k reportActions', async () => {
});

await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getLastVisibleAction(reportId), {runs: 20});
await measureFunction(() => ReportActionsUtils.getLastVisibleAction(reportId), {runs});
});

test('getLastVisibleAction on 10k reportActions with actionsToMerge', async () => {
Expand Down Expand Up @@ -93,7 +93,7 @@ test('getLastVisibleAction on 10k reportActions with actionsToMerge', async () =
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getLastVisibleAction(reportId, actionsToMerge), {runs: 20});
await measureFunction(() => ReportActionsUtils.getLastVisibleAction(reportId, actionsToMerge), {runs});
});

test('getMostRecentIOURequestActionID on 10k ReportActions', async () => {
Expand All @@ -102,15 +102,15 @@ test('getMostRecentIOURequestActionID on 10k ReportActions', async () => {
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getMostRecentIOURequestActionID(reportActionsArray), {runs: 20});
await measureFunction(() => ReportActionsUtils.getMostRecentIOURequestActionID(reportActionsArray), {runs});
});

test('getLastVisibleMessage on 10k ReportActions', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getLastVisibleMessage(reportId), {runs: 20});
await measureFunction(() => ReportActionsUtils.getLastVisibleMessage(reportId), {runs});
});

test('getLastVisibleMessage on 10k ReportActions with actionsToMerge', async () => {
Expand Down Expand Up @@ -139,29 +139,29 @@ test('getLastVisibleMessage on 10k ReportActions with actionsToMerge', async ()
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getLastVisibleMessage(reportId, actionsToMerge), {runs: 20});
await measureFunction(() => ReportActionsUtils.getLastVisibleMessage(reportId, actionsToMerge), {runs});
});

test('getSortedReportActionsForDisplay on 10k ReportActions', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getSortedReportActionsForDisplay(reportActions), {runs: 20});
await measureFunction(() => ReportActionsUtils.getSortedReportActionsForDisplay(reportActions), {runs});
});

test('getLastClosedReportAction on 10k ReportActions', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getLastClosedReportAction(reportActions), {runs: 20});
await measureFunction(() => ReportActionsUtils.getLastClosedReportAction(reportActions), {runs});
});

test('getMostRecentReportActionLastModified', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getMostRecentReportActionLastModified(), {runs: 20});
await measureFunction(() => ReportActionsUtils.getMostRecentReportActionLastModified(), {runs});
});

0 comments on commit 243396a

Please sign in to comment.