-
Notifications
You must be signed in to change notification settings - Fork 54
Blueprint planner: clean up pending MGS update test helpers #8836
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
Conversation
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.
This looks sooooo nice! Thanks a bunch for cleaning up the tests! It's way easier to understand what's going on now.
I merged the RoT bootloader planner PR, which breaks this. If it's too annoying to deal with, perhaps we can remove those tests temporarily and add them after we merge this? WDYT?
let collection = test_boards | ||
.collection_builder() | ||
.sp_versions(ARTIFACT_VERSION_2, ExpectedVersion::NoValidVersion) | ||
.rot_versions(ARTIFACT_VERSION_2, ExpectedVersion::NoValidVersion) | ||
.sp_active_version_exception(SpType::Sled, 0, ARTIFACT_VERSION_1) | ||
.build(); |
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.
Ah yes, this is waaaaayyy nicer ✨
// Updates as much of a whole system at once as we can | ||
#[test] | ||
fn test_whole_system_simultaneous() { |
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.
Maybe we should change the name of the test at this point? Something like test_whole_system_simultaneous_per_component
or something similar?
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.
Hmm, I agree the current name is misleading, but simultaneous_per_component
is kind of a mouthful. Just thinking out loud: The test is showing what we'd do if we tried to update as much as we can in one planning iteration. How about test_allow_simultaneous_updates()
? (Or "concurrent" instead of "simultaneous"?)
I added a TODO that this test shows we would do the wrong thing w.r.t. bootloaders if allowed to stage multiple updates simultaneously. I don't think fixing it is super urgent (since in production we don't allow staging multiple updates simultaneously); I could file a new issue or add a comment to and reopen #7819?
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.
How about test_allow_simultaneous_updates()? (Or "concurrent" instead of "simultaneous"?)
Sounds good! Any variant is fine with me.
I don't think fixing it is super urgent (since in production we don't allow staging multiple updates simultaneously)
@davepacheco: Maybe this is me not getting it, but thinking about it, if we don't allow simultaneous updates in production, then why are we testing that we can do them?
self.id | ||
} | ||
|
||
iddqd::id_upcast!(); |
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.
Hm, I haven't used this crate before. I should take a good look at it! These tests are cleaning up nicely
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.
Yeah, this crate is great. It's @sunshowers's extension of the idmap
crate I threw together for maps where the key is derived from the value (but critically, iddqd
allows keys that borrow from the values; idmap
didn't).
I addressed all the conflicts, hopefully correctly. It wasn't too bad, but is probably worth a second look? Having to call three methods to set the default versions for SP, RoT, and bootloader was getting kinda unwieldy itself, so I also collapsed those in 97aa18f for the common case where all three are using the same default active and inactive versions. |
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.
As you suggested, I've only skimmed the changes to the tests. Looks like a huge improvement! Thanks for doing it.
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.
Looks great! Thanks for all the clean up
// Updates as much of a whole system at once as we can | ||
#[test] | ||
fn test_whole_system_simultaneous() { |
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.
How about test_allow_simultaneous_updates()? (Or "concurrent" instead of "simultaneous"?)
Sounds good! Any variant is fine with me.
I don't think fixing it is super urgent (since in production we don't allow staging multiple updates simultaneously)
@davepacheco: Maybe this is me not getting it, but thinking about it, if we don't allow simultaneous updates in production, then why are we testing that we can do them?
This is mostly because I found the existing support stuff pretty unwieldy when I went to try to extend it to do host OS updates too; e.g., this return type
and the arguments to this function
are already pretty rough, and I was only going to make that worse by adding host OS stuff to them.
I took a stab at pulling this out and putting some names on things; I'm sure there's more that could be done (and we may want to do that as we add host OS and bootloader tests), but figured this was a decent stopping point.
The changes here are mostly refactoring. I did add one extra assertion: we had a couple tests that would build a set of
expected_updates
, then confirm all the updates produced by planning were present inexpected_updates
. But they weren't confirming that we'd seen all the expected updates. When I added this assertion, thetest_whole_system_simultaneous()
test failed. I think this is because we can't actually update the whole system simultaneously: we do at most one kind of update to a given board at once. I reworked this test some to "update all the RoTs" then "update all the SPs" instead.In terms of reviewing, I'd probably look mostly at the reworked tests themselves and see if these changes are a clarity improvement. The changes there are a lot smaller than the diff, since all of the supporting code moved around. This will conflict with #8664; I'm happy to do the work to merge those together. (It looks like we had similar ideas; e.g., about
make_collection()
not really being sustainable as it was written!)I think with these changes we could also move the respective SP / RoT tests into their submodules instead of leaving them all in the higher-level
mod.rs
.