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

Improve testing and try to fix MySQL hanging #32515

Merged
merged 7 commits into from
Nov 15, 2024

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Nov 15, 2024

It's strange that TestLinguist hangs a lot with MySQL (and only MySQL). Update: due to MySQL tests have different indexer&queue behaviors.

Now, by some CI fine tunes (run tests), SQLite & MSSQL could complete in about 12~13 minutes (before > 14), MySQL could complete in 18 minutes (before: about 23 or even > 30)

Major changes:

  1. use tmpfs for MySQL storage
  2. run make test-mysql instead of make integration-test-coverage because the code coverage is not really used at the moment.
  3. refactor testlogger to make it more reliable and be able to report stuck stacktrace
  4. do not requeue failed items when a queue is being flushed (failed items would keep failing and make flush uncompleted)
  5. reduce the file sizes for testing
  6. use math ChaCha8 random data instead of crypot/rand (for testing purpose only)
  7. no need to DeleteRepository in TestLinguist
  8. other related refactoring to make code easier to maintain

@wxiaoguang wxiaoguang added this to the 1.23.0 milestone Nov 15, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 15, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 15, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/migrations labels Nov 15, 2024
@wxiaoguang wxiaoguang force-pushed the fix-testing branch 2 times, most recently from 85d01db to 8fbff1b Compare November 15, 2024 03:34
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 15, 2024
@wxiaoguang wxiaoguang force-pushed the fix-testing branch 3 times, most recently from f6fce34 to 211fc18 Compare November 15, 2024 06:07
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Nov 15, 2024

By some CI fine tunes (run tests), SQLite & MSSQL could complete in about 12~13 minutes (before > 14), MySQL could complete in 18 minutes (before: about 23 or even > 30)

@bohde
Copy link
Contributor

bohde commented Nov 15, 2024

Am I right that the major changes are as follows?

  • Use ChaCha8 for generating random test files instead of a cryptographic generator, saving 2 minutes per integration test suite
  • Adjust MySQL to run on a tmpfs, saving 4 minutes per mysql integration test suite
  • Don't re-enqueue failed jobs when flushing, which makes tests more reliable

@wxiaoguang
Copy link
Contributor Author

Am I right that the major changes are as follows?

* Use ChaCha8 for generating random test files instead of a cryptographic generator, saving 2 minutes per integration test suite

* Adjust MySQL to run on a tmpfs, saving 4 minutes per mysql integration test suite

* Don't re-enqueue failed jobs when flushing, which makes tests more reliable

Exactly, these are the major changes, and by the way remove the "deleting repo" code in TestLinguist, it also saves a little time.

And fine-tune the testlogger to make it output correct durations, and report the stack if a test gets stuck.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 15, 2024
@bohde
Copy link
Contributor

bohde commented Nov 15, 2024

Exactly, these are the major changes, and by the way remove the "deleting repo" code in TestLinguist, it also saves a little time.

And fine-tune the testlogger to make it output correct durations, and report the stack if a test gets stuck.

Thanks for the confirmation!

@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Nov 15, 2024

Thanks for the confirmation!

Yup, a lot of things are mixed in one PR .... (I haven't thought that it would become more and more complex .....)

Updated the description of the PR, hopefully everything is listed there.

@wxiaoguang wxiaoguang merged commit ecbb03d into go-gitea:main Nov 15, 2024
26 checks passed
@wxiaoguang wxiaoguang deleted the fix-testing branch November 15, 2024 15:45
zjjhot added a commit to zjjhot/gitea that referenced this pull request Nov 17, 2024
* giteaofficial/main:
  Fix basic auth with webauthn (go-gitea#32531)
  Fix and refactor markdown rendering (go-gitea#32522)
  Fix large image overflow in comment page (go-gitea#31740)
  Improve testing and try to fix MySQL hanging (go-gitea#32515)
  Fix `recentupdate` sorting bugs (go-gitea#32505)
marcellmars pushed a commit to marcellmars/gitea that referenced this pull request Nov 18, 2024
By some CI fine tunes (`run tests`), SQLite & MSSQL could complete
in about 12~13 minutes (before > 14), MySQL could complete in 18 minutes
(before: about 23 or even > 30)

Major changes:

1. use tmpfs for MySQL storage
1. run `make test-mysql` instead of `make integration-test-coverage`
because the code coverage is not really used at the moment.
1. refactor testlogger to make it more reliable and be able to report
stuck stacktrace
1. do not requeue failed items when a queue is being flushed (failed
items would keep failing and make flush uncompleted)
1. reduce the file sizes for testing
1. use math ChaCha20 random data instead of crypot/rand (for testing
purpose only)
1. no need to `DeleteRepository` in `TestLinguist`
1. other related refactoring to make code easier to maintain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/docs modifies/go Pull requests that update Go code modifies/internal modifies/migrations size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants