-
Notifications
You must be signed in to change notification settings - Fork 61
fix(cli): avoid race condition preventing reporting some queries #581
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
fix(cli): avoid race condition preventing reporting some queries #581
Conversation
Well it doesn't seems good enough. When running a single file it's ok but when running a test folder it mixes up the test from one file into the other... |
Hm, I remember this issue. I thought I fixed it. |
Listing the queries in the basic demo correctly yields 6 queries: ``` kulala_cli.lua 1.basic.http --list File: /app/kulala.nvim/docs/static/import/demos/1.basic.http Line Name URL 4 Simple GET request GET https://httpbin.org/get 8 GET with query parameters GET https://httpbin.org/get?name=kulala&age=25 12 POST with JSON body POST https://httpbin.org/post 22 PUT with headers PUT https://httpbin.org/put 33 DELETE request DELETE https://httpbin.org/delete 37 GET with multiple headers GET https://httpbin.org/headers ``` but running the tests only finished 5: ``` kulala_cli.lua 1.basic.http -v report ..................................................*...............................................*...............................................................*............................... ................*..............................................* Line URL Status Time Duration 4 https://httpbin.org/get 200 11:46:29 404.15 ms 8 https://httpbin.org/get?name=kulala&age=25 200 11:46:30 518.17 ms 12 https://httpbin.org/post 200 11:46:32 1642.42 ms 22 https://httpbin.org/put 200 11:46:32 414.43 ms 33 https://httpbin.org/delete 200 11:46:32 404.90 ms Summary Total Successful Failed Requests 5 5 0 Asserts 0 0 0 . Status: OK ``` This is because is_last returns true when all tasks are scheduled but do not check if they are actually done. If the last task is not finished quickly enough then it is not reported. This fix checks if the amount of tasks done is equal to the total tasks scheduled
4664b22
to
fbe95fe
Compare
I have checked, the fix works fine for me. Btw, I changed the base to |
fbe95fe
to
c76baa0
Compare
c76baa0
to
2f5979f
Compare
If I run tests on a folder with my fix the reports "accumulates":
There's two files with one test each and one with 3. As you can see all completes but the first test is passed down to the next report each time. |
Yes, I fixed that. |
Sorry I missed your last message. I just tested your fix and it works as expected, thanks! |
…th_resolver to options (#577) * fix(oauth): set expires_in for manually entered Authorization Code * feat(scripts): resolve NODE_PATH to nearest `node_modules`, add node_path_resolver to options. * feat(exporter): export all variables * feat(ui): allow overriding Kualala UI buf/win opts with `ui.win_opts` * feat(lsp): graphQL autocomplete * feat(scripting): execute inline/file scripts in the order of declaration * feat(lsp): add default keymaps for distros that do not set them * fix(cli): avoid race condition preventing reporting some queries (#581) --------- Co-authored-by: Yaro <[email protected]> Co-authored-by: Ben <[email protected]> Co-authored-by: Hugues Lismonde <[email protected]>
Listing the queries in the basic demo correctly yields 6 queries:
but running the tests only finished 5:
This is because is_last returns true when all tasks are scheduled but do not check if they are actually done. If the last task is not finished quickly enough then it is not reported.
This fix checks if the amount of tasks done is equal to the total tasks scheduled