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

Converting Errorf to Fatalf #7

Merged
merged 1 commit into from
Oct 21, 2023
Merged

Converting Errorf to Fatalf #7

merged 1 commit into from
Oct 21, 2023

Conversation

madflojo
Copy link
Owner

@madflojo madflojo commented Oct 21, 2023

Summary by CodeRabbit

  • Test Improvement: Enhanced error handling in certificate testing. The system will now immediately halt tests if an issue arises during the creation or writing of certificates, ensuring errors are promptly reported and not overlooked. This change improves the reliability of our testing process, contributing to the overall quality of the software.

@coderabbitai
Copy link

coderabbitai bot commented Oct 21, 2023

Walkthrough

The changes primarily focus on enhancing error handling in the test functions of the certificate module. The modifications ensure immediate test failure upon encountering an error during certificate creation or writing, thereby preventing further execution and improving the reliability of the tests.

Changes

File Summary
testcerts_test.go Enhanced error handling in TestCertsUsage and testUsingCerts functions. Replaced Errorf with Fatalf for immediate test failure upon error. Minor adjustments to error messages.

🐇

"In the land of code, where the shadows lie,

A rabbit hopped, with a watchful eye.

With each test run, and each fail caught,

A stronger codebase, the rabbit wrought. 🎉"


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.

Note: For conversation with the bot, please use the review comments on code diffs or files.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between e59904c and f7b6a75.
Files selected for processing (1)
  • testcerts_test.go (5 hunks)
Additional comments (Suppressed): 5
testcerts_test.go (5)
  • 31-34: The change from Errorf to Fatalf is appropriate here. If the temporary directory cannot be created, there's no point in continuing the test. This change ensures that the test fails immediately, which is a good practice in testing.

  • 40-55: The change from Errorf to Fatalf is also appropriate in these lines. If there's an error while generating certificates or checking if the certificate and key files exist, the test should fail immediately. This change enhances error reporting and prevents further test execution in the event of an error.

  • 120-123: The change from Errorf to Fatalf is appropriate here as well. If the temporary directory cannot be created, there's no point in continuing the test. This change ensures that the test fails immediately, which is a good practice in testing.

  • 346-355: The change from Errorf to Fatalf is also appropriate in these lines. If there's an error while generating key pairs or writing certificates to temporary files, the test should fail immediately. This change enhances error reporting and prevents further test execution in the event of an error.

  • 375-378: The change from Error to Fatalf is appropriate here. If the rootCAs function returns nil, the test should fail immediately. This change enhances error reporting and prevents further test execution in the event of an error.

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

Merging #7 (f7b6a75) into main (e59904c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main       #7   +/-   ##
=======================================
  Coverage   69.53%   69.53%           
=======================================
  Files           1        1           
  Lines         151      151           
=======================================
  Hits          105      105           
  Misses         25       25           
  Partials       21       21           

@madflojo madflojo merged commit 26d5317 into main Oct 21, 2023
5 checks passed
@madflojo madflojo deleted the fatalf branch October 21, 2023 15:05
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