Aiven-Open / Aiven-Open/klaw

chore(coral): Investigation: improve testing performance

Aberta
#1,222 0 comentários 0 reações 0 responsáveis Ver no GitHub
Frontend good first issue Housekeeping
Linguagem predominante
Java
Estrelas
195
Forks
77
Merge médio
8d 9h
PRs com merge (30d)
1

Descrição

# What is currently missing?

As `coral` grows, we are running more and more tests. We are already seeing them running slower:
- in github actions: around 5 minutes, +/- 1 minute)
- locally: around 30 seconds, +/- 5 seconds

We might want to give some thought about optimizing this.

# How could this be improved?

- refine the flags we run on `jest`, notably the `--maxWorkers` flag (50% for CI, 100% locally?)
- implement sharding to run chunks of tests in parallel
- main slowdown seems to be due to the `TopicAclRequest.test.tsx` suite, which is a massive 3000+ lines file. This should be refactored or worked around (maybe run it in an isolated worker)

# How it should NOT be improved

Migrating to another test runner, like `vitest`. A trial has been run with `vitest` (https://github.com/aiven/klaw/tree/vitest-time), and it is a sizeable task (because of many subtle config and API differences), with questionable results:

- config differences:
- some dependencies could not be found, so we need to inline them
- some types could not be found, so they needed to be added to tsconfig
- because fetch was not found by `msw`, we need to add it to our initial setup
- APi differences
- every jest replaced by `vi`
`it` blocks are independent, so rendering in a `beforeAll` is impossible: need to render in a `beforeEach`
- mocking the actual lib uses `importActual` which is a promise that needs to be awaited:
- our type coercion on API methods mocking needs to be replaced by `vi.mocked(method)` :
- regressions:
- the entire `api.test.ts` file would hang forever, I suspect the `forEach` approach does not agree with `vitest`, as running tests one by one seemed fine
- modals testing was broken: `waitForElementToBeRemoved` always timed out when testing a modal closing
- much flakier than Jest, especially on navigation tests
- not fast: see this run at almost 6 minutes: https://github.com/aiven/klaw/actions/runs/4959965015/jobs/8874834958

# Is this a feature you would work on yourself?

* [ ] I plan to open a pull request for this feature

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.