[nexus-types] test that PlanningReports can be roundtrip serialized#9085
Merged
sunshowers merged 4 commits intoSep 27, 2025
Conversation
Created using spr 1.3.6-beta.1
sunshowers
commented
Sep 25, 2025
Comment on lines
+1871
to
+1885
| #[cfg_attr(test, strategy(socket_addr_v6_without_flowinfo()))] | ||
| pub sled_agent_address: SocketAddrV6, | ||
| } | ||
|
|
||
| // For proptest, we pass in flowinfo = 0, because flowinfo doesn't roundtrip | ||
| // through JSON. | ||
| #[cfg(test)] | ||
| fn socket_addr_v6_without_flowinfo() | ||
| -> impl proptest::strategy::Strategy<Value = SocketAddrV6> { | ||
| use proptest::strategy::Strategy; | ||
|
|
||
| proptest::arbitrary::any::<(Ipv6Addr, u16, u32)>().prop_map( | ||
| |(addr, port, scope_id)| SocketAddrV6::new(addr, port, 0, scope_id), | ||
| ) | ||
| } |
Created using spr 1.3.6-beta.1
jgallagher
approved these changes
Sep 25, 2025
jgallagher
left a comment
Contributor
There was a problem hiding this comment.
Thanks! This looks like it was pretty tedious, but is way more robust than the path I started down.
|
|
||
| // location of the baseboard (that we'd pass to MGS) | ||
| /// what type of baseboard this is | ||
| #[cfg_attr(test, strategy(proptest::prop_oneof![ |
Contributor
There was a problem hiding this comment.
Was there something preventing us from deriving Arbitrary for SpType?
Contributor
Author
There was a problem hiding this comment.
Ended up replace-ing the SpType in gateway-client in favor of the one in gateway-types: #9093
With that change, we can derive Arbitrary on SpType.
Comment on lines
+1871
to
+1885
| #[cfg_attr(test, strategy(socket_addr_v6_without_flowinfo()))] | ||
| pub sled_agent_address: SocketAddrV6, | ||
| } | ||
|
|
||
| // For proptest, we pass in flowinfo = 0, because flowinfo doesn't roundtrip | ||
| // through JSON. | ||
| #[cfg(test)] | ||
| fn socket_addr_v6_without_flowinfo() | ||
| -> impl proptest::strategy::Strategy<Value = SocketAddrV6> { | ||
| use proptest::strategy::Strategy; | ||
|
|
||
| proptest::arbitrary::any::<(Ipv6Addr, u16, u32)>().prop_map( | ||
| |(addr, port, scope_id)| SocketAddrV6::new(addr, port, 0, scope_id), | ||
| ) | ||
| } |
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
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.
This proptest would catch the issue detected in #9080.
Closes #9081.