libnetwork: use errdefs and gotest.tools for asserting error-types (step 1)#49326
Merged
thaJeztah merged 8 commits intomoby:masterfrom Jan 22, 2025
Merged
Conversation
…ypes Make sure these errors are properly detected by the errdefs helpers to implement the right interface / definition. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Rewrite the test using gotest.tools and use the errdefs helpers to assert the right errdefs definition. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Also rename the test to TestGetHostPartIP, removing "Util" from the name. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Also rename the test to TestGetBroadcastIP, removing "Util" from the name. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Both net.IP and net.IPMask implement a stringer interface; use it to print
their value. While updating also removed the naked return.
Before this patch:
cannot compute host portion ip address because ip and mask are not compatible: (net.IP{0x20, 0x1, 0xd, 0xb8, 0x20, 0x2, 0x20, 0x1, 0xff, 0xff, 0xab, 0xcd, 0xee, 0xab, 0x0, 0xcd}, net.IPMask{0xff, 0xff, 0xff, 0x0})
cannot compute host portion ip address because ip and mask are not compatible: (net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xad, 0x20, 0x4, 0x5}, net.IPMask{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0})
cannot compute host portion ip address because ip and mask are not compatible: (net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xad, 0x20, 0x4, 0x5}, net.IPMask{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0})
With this patch:
cannot compute host portion ip address because ip and mask are not compatible: (2001:db8:2002:2001:ffff:abcd:eeab:cd, ffffff00)
cannot compute host portion ip address because ip and mask are not compatible: (173.32.4.5, 000000000000000000000000ffffff00)
cannot compute host portion ip address because ip and mask are not compatible: (173.32.4.5, 00000000000000000000ffffffffff00)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
…-found Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
robmry
approved these changes
Jan 22, 2025
Member
Author
|
Thx! I'll bring this one in, and open a PR with the next batch of changes related to this (trying to cut it up into sizeable PRs 🙈) |
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.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)