-
Notifications
You must be signed in to change notification settings - Fork 649
[Tigron]: mocks + debugging output enhancements #4076
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
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
88b9c53
to
7008b01
Compare
1 task
32 tasks
Rebased. |
AkihiroSuda
reviewed
Apr 8, 2025
AkihiroSuda
reviewed
Apr 9, 2025
This commit relaxes line length from 100 to 120, and disables a bunch of linters we do not want. Signed-off-by: apostasie <[email protected]>
c2eaeb7
to
00706ad
Compare
Mimicry is a lightweight, zero dependency mock mechanism created to ease testing of Tigron. Since Tigron heavily relies on *testing.T, it is currently hard to test. Moving away to a tig.T interface instead of *testing.T will unlock the ability to mock. Mimicry does provide: - recording of all function calls, with arguments and complete stack trace (see Report()) - optional custom handling of function calls (see Register()) - QOL: fancyfied OCS8 links allow opening files from traces in terminal UX is largely in flux right now and experimental, but the objective is to: - do not require code generation - do not abuse reflection - keep the amount of boilerplate to the absolute minimum for the mock consumer - ... and as small as possible for the mock creator - keep zero dependencies This commit also introduce the tig.T interface to be used everywhere inside Tigron in the future, along with a complete mock for it. Mimicry is not meant to be used directly for now, though, if there is interest, a future version might graduate out of `internal`. Signed-off-by: apostasie <[email protected]>
This brings a set of enhancements to assertive: - function name simplifications - generics-ifying of some functions that can be used on comparables - additional methods (Match, DoesNotMatch) - debugging output is made clear, along with OCS8 link and excerpt of the test file - all methods can now elect to Fail later instead of FailNow - Check method is removed (^ because of above) - all methods can now elect to silence output on success Other Tigron files are updated to adopt these changes: - method names update - comparators move away from Check and now fully leverages assertive This also adds a large number of tests for assertive, leveraging mimicry. Signed-off-by: apostasie <[email protected]>
00706ad
to
33836f6
Compare
AkihiroSuda
approved these changes
Apr 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
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.
<!> Blocked by <!>:
Should preferably be merged after:
[MAJOR] content digest not found
) #4062 (purely for QOL reasons)This is a new series of Tigron PRs (FIXME: currently on top of #4056).
Now that the big change with the new command implementation is in, upcoming work on Tigron will focus on:
Ideally, none of these PRs will require ANY change in nerdctl, and are either changes to the way we test Tigron itself, or refactoring that does not change signatures and API.
Efforts are being made to break these PRs down into small, digestible changes to ease and fasten review, which explains the chain of PRs.
LMK at any point if a given PR needs to be further broken down.
This first PR is focused on making Tigron more testable, starting with
assertive
.Commit 1 is mundane and just disables golangci linters that we do not want.
Second commit does introduce
internal/mimicry
, a mock mechanism that will allow mocking*testing.T
and other conendrums. See commit message for details.Third commit is work on
internal/assertive
(code cleanup, methods generalization), and a raft of new tests (leveragingmimicry
). See commit message for detailsSee following comments for preview of how failures will now be presented.
Note that more work on debugging output quality will very soon come in an upcoming PR (this time focused on general output, which is currently crowded, noisy and really hard to read) - I would prefer to keep that separate to keep PRs small, though meanwhile the display will be a bit loosy goosy because of that.