-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refactor the Engine to process metrics independently from the test Run #1390
Conversation
This allows metric processing to still occur, even after the script run has completed. In practice, this allows you to run k6 with the --linger --no-teardown flags, and execute the teardown() function manually through the REST API, after the main test run has completed. This also fixes #1369 - now a second Ctrl+C will _always_ abort k6, albeit in a very abrupt way. On the other hand, the first Ctrl+C would be more graceful than it currently is, since it will now allow teardown() to be executed.
Codecov Report
@@ Coverage Diff @@
## new-schedulers #1390 +/- ##
==================================================
- Coverage 76.39% 76.36% -0.04%
==================================================
Files 162 162
Lines 12838 12853 +15
==================================================
+ Hits 9808 9815 +7
- Misses 2513 2518 +5
- Partials 517 520 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me :).
A bit more code then I hoped for, but looks okay to me. Will probably need to run a lot of tests, but if the automatic ones pass and you say it doesn't die running I am fine with a merge.
All my comments are about things that have little to do with this change and we can do it in another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No major comments from my side either. Not a big fan of the lambdas returned from Engine.Init()
, it feels like this should be better integrated somehow. The new contexts complicate things a bit, but it also makes execution clearer, and it was necessary to properly handle linger, so it's OK.
This allows metric processing to still occur, even after the script run has completed. In practice, this allows you to run k6 with the
--linger --no-teardown
flags, and execute theteardown()
function manually through the REST API, after the main test run has completed.This also fixes #1369 - now a second Ctrl+C will always abort k6, albeit in a very abrupt way. On the other hand, the first Ctrl+C would be more graceful than it currently is, since it will now allow
teardown()
to be executed.