-
Notifications
You must be signed in to change notification settings - Fork 440
[ignore] Verbose output for faster troubleshooting of test problems #467
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
Conversation
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.
This is somewhat similar to the trace PR. I like the idea of having a separate log file but there may be situations where we warnt the output in the test result.
My suggestion would to have two options --trace and --trace-log to decide where the output goes.
Alternatively we could add FD 4 that is meant for trace output an can be redirected/merged at will. I'd have to think a bit about this.
I am wondering if it is worthwhile to separate the output for each test into its own file. This would make it easier to find the interesting parts. |
Absolutely! And, it would allow us to cat just the failing test file?
It would allow for targetting the specific file to cat should it fail or the config set success STDOUT to be shown. I like that idea. |
@martin-schulze-vireso , is there a way to allow contributors to cancel actions jobs that they started? I generated a bunch and want to kill them all. |
01a075e
to
3bfae55
Compare
I don't think so. If you want full control, you should work with a private branch in your fork. |
I'm unclear of the exact difference between these PRs, but I've been stuck a few times trying to add or extend tests using BATS and really struggled due to the lack of easy way to debug what's going on, am I matching slightly the wrong output, is me calling it via BATS generating slightly different output, is my BATS test broken, or something else? Having to run the command standalone and in BATS and update both when debugging stuff is a real faff. A number of these PRs have stalled at this point, as the pain is too much and I've just gone onto other things.
FWIW from my experience with other CI, what I actually want is to see the debug info if the test run fails. E.g. with Travis CI with both configure and make check, I have on fail bits of the config that cat config.log test-suite.log respectively if the build fails, ideally I, or particularly a contributor, don't want to have to tweak the CI each time there's a failure, so some easy way to cat just the failing files would be great, either only writing them to disk if a test failed, or something built in which outputs all of a failed test just before BATS dies. Thanks for this though, I'm really looking forward to it! |
I can check again and make sure the level 2 output is included on failure, by default. Thanks for the feedback! |
Hey @martin-schulze-vireso , I think I'm ready for a review. No tests yet, but again I'm going to wait until we're solid on the logic and how this should look before spending the time on that. This is really cool so far 🥳 |
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.
It might be intentional to only print the failing command but most people will understand --trace
to mean: print everything. What is done here is more like: print on failure with two modes command (arguably no big improvement over the status quo) and print output (this seems to be what you want to get at.)
What I envisioned was to switch inside run
based on the TRACE_LEVEL, whether to print the executed command and output unconditionally. I think your current implementation has another usecase and both might be needed.
I think everything should become much clearer if we start forming an acceptance test file for this feature.
Wanted to update here that I've been using this code in my day-to-day adding new tests or troubleshooting failures and it's awesome! The speed at which I can write bats tests now is really pleasant. |
I am working on getting a rebased version pushed with additional flags. There is more to come... |
37d61c9
to
945dfed
Compare
@NorseGaud I see that this was the master branch on your repository. I hope I did not break your existing scripts with force pusing over that. I also hope that I resolved all merge conflicts successfully without breaking either side. |
Nah, it's all good. I mistakenly did that and just was too lazy to fix it 😅 |
How do we want to handle shellcheck stuff? |
@NorseGaud maybe we should hop over to gitter to resolve this more quickly. |
9731b9c
to
f01f1b7
Compare
Just to give a short summary of what is in this right now:
|
@martin-schulze-vireso , is there
Definitely way too much output Side note:
|
Obviously there is a lot going on. The problems that I can identify:
I'll see to it ASAP. By the way: That setup_file_if_necessary switch is not working as intended, as the major version multiplier is too small. You can probably do away with it if there are no people who are using bats pre 1.2.1 in your team anymore. |
Okay, I pushed the changes discussed above apart from the FD change. I am not sure if it is necessary and I'd really like the interleaving of the output, which will be broken when using another FD that is not buffered by bats. |
Okay, the separate FD is necessary but I still got the interleaving. I opted for using static FD4. Hopefully that is enough for most cases. |
Way more managable now and doesn't fail the tests anymore! Nice! Some examples after a changed some tests to fail:
|
I have what I need with the following:
|
08f0645
to
6e6929e
Compare
f1b56d6
to
5ea4160
Compare
@NorseGaud I am sorry, I had a typo in the (force) push command and probably erased the master branch on your remote. It looks like I can't reinstate it from my end and can't even reopen this PR. IF you can get this reopened, please use the code from https://github.com/bats-core/bats-core/tree/trace_and_more |
All good @martin-schulze-vireso , I can restore the branch |
Note that file descriptors 3 and 4 are reserved by Bats. The former is used for adding custom text to the Test Anything Protocol (or TAP) stream [1] and the latter for tracing. [1] https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal [2] Bats commit 635700cd2282b754 bats-core/bats-core#467 bats-core/bats-core#488 containers#1066
Note that file descriptors 3 and 4 are reserved by Bats. The former is used for adding custom text to the Test Anything Protocol (or TAP) stream [1] and the latter for tracing [2]. [1] https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal [2] Bats commit 635700cd2282b754 bats-core/bats-core#467 bats-core/bats-core#488 containers#1066
Note that file descriptors 3 and 4 are reserved by Bats. The former is used for adding custom text to the Test Anything Protocol (or TAP) stream [1] and the latter for tracing [2]. [1] https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal [2] Bats commit 635700cd2282b754 bats-core/bats-core#467 bats-core/bats-core#488 containers#1066
Note that file descriptors 3 and 4 are reserved by Bats. The former is used for adding custom text to the Test Anything Protocol (or TAP) stream [1] and the latter for tracing [2]. [1] https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal [2] Bats commit 635700cd2282b754 bats-core/bats-core#467 bats-core/bats-core#488 containers#1066
#137 seems to be dead.
Goal: Provide a better way to see exactly what was run and any STDERR/OUT for the commands