Skip to content
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

Adds an execution Error Code to Flakeguard #1617

Merged
merged 2 commits into from
Feb 5, 2025
Merged

Conversation

kalverra
Copy link
Collaborator

@kalverra kalverra commented Feb 5, 2025

New error code for Flakeguard to help us identify when we find flakes, or when we hit errors finding flakes.

Exit Code 1: Flakeguard ran successfully and found some flakes
Exit Code 2: Flakeguard hit some issues and was not able to complete


Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes introduce enhancements and bug fixes to various commands in the Flakeguard tool suite, focusing on error handling, logging improvements, and exit code standardization. These modifications aim to make the tool more robust and user-friendly by providing clearer error messages, ensuring consistent exit behavior across commands, and improving the overall reliability and maintainability of the codebase.

What

  • tools/flakeguard/cmd/aggregate_results.go:
    • Import "os" for exit code management and error handling.
    • Replace RunE with Run to manage errors and exit codes manually.
    • Use log.Error() and os.Exit() for error handling, improving clarity and control over exit behavior.
    • Remove redundant error checks and stop spinners more reliably.
  • tools/flakeguard/cmd/check_test_owners.go:
    • Import "os" for handling exit codes.
    • Replace RunE with Run for manual error and exit code management.
    • Use log.Error() and os.Exit() for error handling.
  • tools/flakeguard/cmd/find.go:
    • Import "os" for improved error and exit code handling.
    • Transition to Run from RunE and manage errors and exit codes manually.
    • Use log.Error() and os.Exit() for error handling.
    • Adjust logging and error handling for consistency and clarity.
  • tools/flakeguard/cmd/generate_report.go:
    • Import "os" for enhanced error handling and exit code management.
    • Shift from RunE to Run to manually handle errors and exit codes.
    • Apply log.Error() and os.Exit() for error handling, enhancing clarity.
    • Improve error messaging and exit strategy for a user-friendly interface.
  • tools/flakeguard/cmd/run.go:
    • Define constants FlakyTestsExitCode and ErrorExitCode for standardized exit codes.
    • Utilize Run instead of RunE for explicit error and exit code control.
    • Implement log.Error() and os.Exit() for uniform error handling.
    • Clarify and standardize error and exit code handling for reliability.
  • tools/flakeguard/reports/presentation.go:
    • Introduce RenderError function for consistent error reporting.
  • tools/flakeguard/runner/runner_test.go:
    • Minor text adjustment in a comment for clarity.

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
6.8% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube

@kalverra kalverra merged commit 45f933c into main Feb 5, 2025
54 of 57 checks passed
@kalverra kalverra deleted the flakeguardErrorCodes branch February 5, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant