-
Notifications
You must be signed in to change notification settings - Fork 58
nexus-db-queries: track blueprint table coverage cumulatively #8988
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for taking this one on. I just wanted to give you a heads-up that I probably won't be able to look for a week or two. (If anyone else at Oxide can take a look, go for 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.
This looks pretty good. I have a few small suggestions, but we don't have to make most of these changes.
bd8bde9
to
8bb5e6f
Compare
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.
Nice!
// Now make a new blueprint (with no meaningful changes) to ensure we | ||
// can delete the last test blueprint we generated above. |
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 comment doesn't seem right any more.
I think what you want to do is add a new lap before this one that includes the Clickhouse stuff. Then keep the existing lap that makes basically no changes.
// Exception tables that may be empty in the test blueprints: | ||
// - debug log for planner reports: only populated when the blueprint | ||
// was produced by the planner (test blueprints generally aren't) | ||
let exception_tables = ["debug_log_blueprint_planning"]; |
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.
Is this true @jgallagher? I forget where we came down on this.
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.
It is true; a blueprint is specified by
pub enum BlueprintSource {
/// The initial blueprint created by the rack setup service.
Rss,
/// A blueprint created by the planner, and we still have the associated
/// planning report.
Planner(Arc<PlanningReport>),
/// A blueprint created by the planner but loaded from the database, so we
/// no longer have the associated planning report.
PlannerLoadedFromDatabase,
/// This blueprint was created by one of `reconfigurator-cli`'s blueprint
/// editing subcommands.
ReconfiguratorCliEdit,
/// This blueprint was constructed by hand by an automated test.
Test,
}
and when we go to insert the blueprint to the db, we only insert a row in debug_log_blueprint_planning
if the source is BlueprintSource::Planner(some_report)
.
// Check that all non-exception tables have at least one row | ||
let empty_tables = self.empty_tables(); | ||
let problematic_tables: Vec<_> = empty_tables | ||
.into_iter() | ||
.filter(|table| !exception_tables.contains(&table.as_str())) | ||
.collect(); |
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.
I was wondering if it's worth keeping the previous list of exception tables, which would basically leave us with three categories:
debug_log_blueprint_planning
: could be empty?- the previous exception tables: they should now all have one row (this is included in the check here)
- the previous non-exception tables: they should now all have
num_blueprints
rows
I think I'm coming down on what you've got here though. The real goal here is to make sure that we can successfully round-trip everything through the database, and that's what we've verified.
Co-authored-by: David Pacheco <[email protected]>
This is a follow up PR to #8667 as suggested by @davepacheco in #8667 (comment)
Instead of verifying table coverage for individual blueprint insertions, this change tracks coverage cumulatively across all tests in
test_representative_blueprint()
.