Skip stdout silencing based on env variable
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do and why?
Add condition to skip stdout silencing based on env variable
Problem: When the example metadata :silence_stdout is used
then the standard output is redirected to reduce console output noise.
But, it can be problematic when you want to debug tests and
implementaion code with the debugger command.
In this cases, interactive debugger console does not behave correctly
because the standard output is redirected, too.
Solution: Add an environment variable SKIP_SILENCE_STDOUT that allows
skipping the output silencing.
Changelog: other
References
Screenshots or screen recordings
The screencast demonstrate the difference in behavior when debugging with the new environment variable: https://cap.so/s/ca159qksf14vbm9
Before: When running a test with the example metadata :silence_stdout enabled , all console output is redirected and not visible in the terminal, making it difficult to debug issues.
After: By setting the new environment variable (SKIP_STDOUT_SILENCING=true), the console output remains visible in the terminal while executing, allowing developers to see debug messages and track execution flow.
How to set up and validate locally
- Run the test
spec/tasks/gitlab/x509/update_rake_spec.rbas usual => Only the rspec output is shown in console; all output from the test it self is redirected, e.g. logger output, debugputs, etc.bundle exec bin/rspec spec/tasks/gitlab/x509/update_rake_spec.rb:30 - Run the test
spec/tasks/gitlab/x509/update_rake_spec.rbas usual => You should now see the logger statement in the console outputSKIP_SILENCE_STDOUT=1 bundle exec bin/rspec spec/tasks/gitlab/x509/update_rake_spec.rb:30
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
MR Checklist (@gerardo-navarro)
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the style guides -
Conforms to the javascript style guides -
Conforms to the database guides -
Conforms to the merge request performance guidelines