-
-
Notifications
You must be signed in to change notification settings - Fork 136
fix: Only log verbose test output on failure #1704
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
Merged
Merged
+270
β43
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace unconditional t.Log() calls with t.Cleanup() handlers that only output verbose YAML/data when tests fail. This eliminates noisy stderr output during successful test runs while preserving debug information when needed. Changes: - Add 29 cleanup handlers across 9 test files - Each handler checks t.Failed() before logging - Include fallback to raw data (%+v) if YAML conversion is empty - Affects component, describe, list, merge, spacelift, and stack tests π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Dependency Reviewβ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1704 +/- ##
==========================================
+ Coverage 66.71% 66.75% +0.03%
==========================================
Files 364 364
Lines 42499 42499
==========================================
+ Hits 28354 28369 +15
+ Misses 12056 12040 -16
- Partials 2089 2090 +1
Flags with carried forward coverage won't be shown. Click here to find out more. π New features to boost your workflow:
|
aknysh
approved these changes
Oct 22, 2025
aknysh
added a commit
that referenced
this pull request
Oct 22, 2025
Resolved conflicts in test files by adopting the new t.Cleanup pattern from PR #1704 while maintaining fixes for golangci-lint issues.
|
These changes were released in v1.196.0-rc.0. |
osterman
added a commit
that referenced
this pull request
Oct 29, 2025
Apply PR #1704 pattern to terraform_test.go - wrap t.Log in t.Cleanup handler that only outputs verbose terraform plan results when tests fail. ## what - Wrapped unconditional `t.Log(output)` in t.Cleanup with t.Failed() check - Terraform plan output now only shown when test fails ## why - Line 230 had unconditional t.Log that dumped terraform output to CI logs - This was pre-existing (added in May, commit d4fa2fe) before PR #1704 - Caused noisy CI logs with walls of component YAML configuration - Follows same pattern as PR #1704 for other test files ## impact - CI logs quieter - terraform output only shown on test failures - Consistent with PR #1704 pattern across all test files - Debug information preserved when actually needed Related to PR #1704 (only log verbose test output on failure). π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
osterman
added a commit
that referenced
this pull request
Oct 29, 2025
Apply PR #1704 pattern comprehensively across all test files - only show verbose output (YAML, JSON, debug info) when tests fail. ## what Fixed unconditional output in 6 test files: - cmd/root_test.go: command output - tests/cli_terraform_test.go: terraform stdout/stderr - tests/validate_schema_test.go: schema validation output - pkg/merge/merge_context_demo_test.go: error formatting demos - pkg/config/command_merging_behavior_test.go: command structure debugging - pkg/config/command_merge_core_test.go: command verification output ## why - These tests had unconditional t.Log() or fmt.Printf() calls - Dumped walls of YAML/JSON/debug info to CI logs on every run - Made CI logs extremely noisy and hard to read - Some dated back to May 2025, predating PR #1704 ## how - Wrapped all output in t.Cleanup handlers with t.Failed() checks - Converted fmt.Printf to t.Logf for proper test integration - Output now only appears when tests actually fail - Preserved all debug information for troubleshooting ## impact - CI logs dramatically quieter - no verbose output on success - Debug info still available when tests fail - Consistent with PR #1704 pattern across entire codebase - Easier to spot actual problems in CI output Related to PR #1704 (quiet test output on success). π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
osterman
added a commit
that referenced
this pull request
Oct 29, 2025
Found 6 more instances of unconditional verbose logging in provenance YAML parser tests. These tests iterate through every line of parsed YAML and log the entire pathMap, creating walls of debug output in CI logs. ## what Fixed debug output in 2 files: - pkg/provenance/yaml_parser_multiline_test.go: 1 instance - pkg/provenance/yaml_parser_arrays_test.go: 5 instances All "=== PATH MAP ===" debug outputs now wrapped in t.Cleanup handlers. ## why - Tests unconditionally logged every YAML line with path mapping - Created verbose output like: ``` === MULTILINE CONTEXT PATH MAP === Line 0: "description: |" -> Path: "description", IsKey: true Line 1: " This is" -> Path: "description", IsCont: true ... (dozens more lines) ``` - Made CI logs extremely noisy for tests that always pass - Debug info is important for troubleshooting parser issues ## how - Wrapped all pathMap logging loops in t.Cleanup with t.Failed() checks - Debug output now only shown when tests actually fail - Preserves full debugging capability when needed ## impact - Significantly quieter CI logs for passing provenance tests - Debug output still available when parser tests fail - Consistent with PR #1704 pattern Related to PR #1704 (quiet test output on success). π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
aknysh
added a commit
that referenced
this pull request
Oct 30, 2025
β¦p handlers (#1722) * fix: Only log terraform test output on failure Apply PR #1704 pattern to terraform_test.go - wrap t.Log in t.Cleanup handler that only outputs verbose terraform plan results when tests fail. ## what - Wrapped unconditional `t.Log(output)` in t.Cleanup with t.Failed() check - Terraform plan output now only shown when test fails ## why - Line 230 had unconditional t.Log that dumped terraform output to CI logs - This was pre-existing (added in May, commit d4fa2fe) before PR #1704 - Caused noisy CI logs with walls of component YAML configuration - Follows same pattern as PR #1704 for other test files ## impact - CI logs quieter - terraform output only shown on test failures - Consistent with PR #1704 pattern across all test files - Debug information preserved when actually needed Related to PR #1704 (only log verbose test output on failure). π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Wrap all unconditional test output in t.Cleanup handlers Apply PR #1704 pattern comprehensively across all test files - only show verbose output (YAML, JSON, debug info) when tests fail. ## what Fixed unconditional output in 6 test files: - cmd/root_test.go: command output - tests/cli_terraform_test.go: terraform stdout/stderr - tests/validate_schema_test.go: schema validation output - pkg/merge/merge_context_demo_test.go: error formatting demos - pkg/config/command_merging_behavior_test.go: command structure debugging - pkg/config/command_merge_core_test.go: command verification output ## why - These tests had unconditional t.Log() or fmt.Printf() calls - Dumped walls of YAML/JSON/debug info to CI logs on every run - Made CI logs extremely noisy and hard to read - Some dated back to May 2025, predating PR #1704 ## how - Wrapped all output in t.Cleanup handlers with t.Failed() checks - Converted fmt.Printf to t.Logf for proper test integration - Output now only appears when tests actually fail - Preserved all debug information for troubleshooting ## impact - CI logs dramatically quieter - no verbose output on success - Debug info still available when tests fail - Consistent with PR #1704 pattern across entire codebase - Easier to spot actual problems in CI output Related to PR #1704 (quiet test output on success). π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Wrap provenance test debug output in t.Cleanup handlers Found 6 more instances of unconditional verbose logging in provenance YAML parser tests. These tests iterate through every line of parsed YAML and log the entire pathMap, creating walls of debug output in CI logs. ## what Fixed debug output in 2 files: - pkg/provenance/yaml_parser_multiline_test.go: 1 instance - pkg/provenance/yaml_parser_arrays_test.go: 5 instances All "=== PATH MAP ===" debug outputs now wrapped in t.Cleanup handlers. ## why - Tests unconditionally logged every YAML line with path mapping - Created verbose output like: ``` === MULTILINE CONTEXT PATH MAP === Line 0: "description: |" -> Path: "description", IsKey: true Line 1: " This is" -> Path: "description", IsCont: true ... (dozens more lines) ``` - Made CI logs extremely noisy for tests that always pass - Debug info is important for troubleshooting parser issues ## how - Wrapped all pathMap logging loops in t.Cleanup with t.Failed() checks - Debug output now only shown when tests actually fail - Preserves full debugging capability when needed ## impact - Significantly quieter CI logs for passing provenance tests - Debug output still available when parser tests fail - Consistent with PR #1704 pattern Related to PR #1704 (quiet test output on success). π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Remove unused imports and empty loop from test refactoring Cleaned up unused imports and code left over from wrapping fmt.Print* calls in t.Cleanup handlers. ## what - Removed unused `fmt` imports from 3 test files - Removed empty `for _, cmd := range commands {}` loop ## why Build was failing with: - pkg/config/command_merge_core_test.go:4 - "fmt" imported and not used - pkg/merge/merge_context_demo_test.go:5 - "fmt" imported and not used - tests/validate_schema_test.go:5 - "fmt" imported and not used - pkg/config/command_merging_behavior_test.go:295 - declared and not used: cmd These were left over from converting fmt.Printf to t.Logf in t.Cleanup handlers. ## impact - β Build passes - β Tests compile successfully - β Clean code without unused artifacts π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Andriy Knysh <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
what
t.Log()calls witht.Cleanup()handlers that only output verbose YAML/data when tests fail%+v) when YAML conversion produces empty stringswhy
t.Log()always outputs to stderr, regardless of test success/failuredemo
Finally clean output!
references
pkg/component/component_processor_test.gopkg/describe/describe_affected_test.gopkg/describe/describe_component_test.gopkg/describe/describe_dependents_test.gopkg/describe/describe_stacks_test.gopkg/list/list_components_test.gopkg/merge/merge_test.gopkg/spacelift/spacelift_stack_processor_test.gopkg/stack/stack_processor_test.goπ€ Generated with Claude Code