Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Tests): Split form-related tests #1474

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

lordrip
Copy link
Member

@lordrip lordrip commented Sep 25, 2024

Context

Currently, we have 3 that take a long time due to their nature. Each of these tests takes one catalog category and renders the configuration form for each of them.

While this works, the penalty is that we block jest worker nodes (threads) so the tests are pinned to a single worker without any chance of splitting the work, making the test slow.

This commit splits them into smaller sections, so the tests are better distributed among all available worker nodes (threads).

Comparison:

# No split
Time:        109.227 s
Time:        143.646 s

# Split
Time:        23.485 s
Time:        24.143 s

CI comparison

# No split
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Form.eips.test.tsx (8.279 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Form.kamelets.test.tsx (17.223 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Form.components.test.tsx (145.895 s)
 
[@kaoto/kaoto]: 
[@kaoto/kaoto]: Test Suites: 163 passed, 163 total
[@kaoto/kaoto]: Tests:       1 skipped, 2 todo, 1279 passed, 1282 total
[@kaoto/kaoto]: Snapshots:   130 passed, 130 total
[@kaoto/kaoto]: Time:        203.871 s
[@kaoto/kaoto]: Ran all test suites.
Done in 3m 26s


# Split
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.kamelets.200-end.test.tsx (5.404 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.eips.000-end.test.tsx (8.487 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.components.300-end.test.tsx (13.582 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.components.200-250.test.tsx (13.06 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.components.250-300.test.tsx (17.788 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.components.150-200.test.tsx (14.621 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.kamelets.150-200.test.tsx
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.kamelets.100-150.test.tsx
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.components.050-100.test.tsx (13.949 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.components.100-150.test.tsx (16.073 s)
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.kamelets.050-100.test.tsx
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.kamelets.000-050.test.tsx
[@kaoto/kaoto]: PASS src/components/Visualization/Canvas/Form/Tests/Form.components.000-050.test.tsx (14.815 s)

[@kaoto/kaoto]: 
[@kaoto/kaoto]: Test Suites: 173 passed, 173 total
[@kaoto/kaoto]: Tests:       1 skipped, 2 todo, 1302 passed, 1305 total
[@kaoto/kaoto]: Snapshots:   130 passed, 130 total
[@kaoto/kaoto]: Time:        116.291 s
[@kaoto/kaoto]: Ran all test suites.
Done in 1m 59s

Screenshots

No split

image

Split

image

You can also notice that we can use more threads due to this split.

Single thread (no split)

single-thread

Multiple threads (split)

multi-thread

Currently, we have 3 that take a long time due to their nature. Each of these tests takes one catalog category and renders the configuration form for each of them.

While this works, the penalty is that we block jest worker nodes (threads) so the tests are pinned to a single worker without any chance of splitting the work, making the test slow.

This commit splits them into smaller sections, so the tests are better
distributed among all available worker nodes (threads).

Comparison:

* No split
```
Time:        109.227 s
Time:        143.646 s
```

* Split
```
Time:        23.485 s
Time:        24.143 s
```
Copy link

sonarcloud bot commented Sep 25, 2024

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@d27f834). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...nents/Visualization/Canvas/Form/Tests/FormTest.tsx 93.10% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1474   +/-   ##
=======================================
  Coverage        ?   68.76%           
  Complexity      ?       25           
=======================================
  Files           ?      271           
  Lines           ?     7753           
  Branches        ?     1524           
=======================================
  Hits            ?     5331           
  Misses          ?     2373           
  Partials        ?       49           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@lhein lhein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@lordrip lordrip merged commit 19d3095 into KaotoIO:main Sep 25, 2024
11 of 12 checks passed
@lordrip lordrip deleted the chore/split-form-tests branch October 2, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants