feat: add require for critical checks#2812
Merged
mdelapenya merged 2 commits intotestcontainers:mainfrom Oct 5, 2024
Merged
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
mdelapenya
added a commit
that referenced
this pull request
Oct 17, 2024
* main: chore: replace 'assert' with 'require' (#2827) chore: replace 'assert' with 'require' for critical checks (#2824) chore: bump ryuk to latest release (#2818) feat: add require for critical checks (#2812) chore(deps): bump release-drafter/release-drafter from 5.25.0 to 6.0.0 (#2805) feat: add etcd module (#2788) feat: add dynamodb-local module (#2799) fix(redpanda): wait for (#2794) fix(elasticsearch): wait for (#2724) chore: update dockercfg module (#2801)
mdelapenya
added a commit
to mdelapenya/testcontainers-go
that referenced
this pull request
Oct 18, 2024
* main: fix(reaper): refactor to allow retries and fix races (testcontainers#2728) chore: update ryuk to 0.10.2 (testcontainers#2833) feat: add yugabytedb module (testcontainers#2825) fix: update module container struct name and missing imports (testcontainers#2831) chore: replace 'assert' with 'require' (testcontainers#2827) chore: replace 'assert' with 'require' for critical checks (testcontainers#2824) chore: bump ryuk to latest release (testcontainers#2818) feat: add require for critical checks (testcontainers#2812)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 does this PR do?
Using require for essential checks to ensure that tests do not proceed under invalid assumptions, while assert can be used for less critical checks to gather more information about potential issues.
Suggested Usage of assert and require :-
Critical Checks (Use require):
Use require to check critical conditions that must be true for the test to proceed.
If a require condition fails, the test stops immediately. This prevents any further code from running, which could lead to misleading error messages.
Non-Critical Checks (Use assert):
Use assert to evaluate conditions that are important but not critical for the test's overall success.
If an assert condition fails, the test continues to run, allowing multiple assertions to be evaluated.
Why is it important?
It is important to use require for critical conditions so that if a critical check fails, the test execution halts immediately. This prevents the test from continuing to run subsequent assertions, which may rely on the validity of the failed condition, thereby avoiding misleading error messages and ensuring that only relevant failures are reported. This approach enhances the clarity of test results and facilitates quicker identification of the root cause of issues.
Related issues