Skip to content
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

[nexus] Check that representative collection populates "inv_..." tables #6637

Merged
merged 11 commits into from
Sep 23, 2024

Conversation

smklein
Copy link
Collaborator

@smklein smklein commented Sep 23, 2024

Tested this manually by removing datasets and zpools from the representative collection and observing these tests fail with clear errors mentioning those tables explicitly.

Fixes #5305
Fixes #6636

@smklein smklein changed the title check that representative collection is actually representative [nexus][tests] Check that representative collection populates all "inv_..." tables Sep 23, 2024
@smklein smklein changed the title [nexus][tests] Check that representative collection populates all "inv_..." tables [nexus] Check that representative collection populates "inv_..." tables Sep 23, 2024
@smklein smklein marked this pull request as ready for review September 23, 2024 18:29
Base automatically changed from delete-inv-dataset to main September 23, 2024 18:31

async fn check_all_inv_tables(datastore: &DataStore, status: AllInvTables) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - maybe

Suggested change
async fn check_all_inv_tables(datastore: &DataStore, status: AllInvTables) {
#[track_caller]
async fn check_all_inv_tables(datastore: &DataStore, status: AllInvTables) {

so assertion failures get attached to the tests that call this helper?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm gave this a shot, turns out it doesn't really like being attached to async functions.

warning: `#[track_caller]` on async functions is a no-op

I'll do the work to plumb an anyhow::Error out of here, with context.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new result-based version, I can see this error when I intentionally omit a zpool from the representative collection:

--- STDERR:              nexus-db-queries db::datastore::inventory::test::test_inventory_deletion ---
log file: /tmp/nexus_db_queries-391529f8ced893bc-inventory_deletion.3760136.0.log
note: configured to log to "/tmp/nexus_db_queries-391529f8ced893bc-inventory_deletion.3760136.0.log"
thread 'db::datastore::inventory::test::test_inventory_deletion' panicked at nexus/db-queries/src/db/datastore/inventory.rs:2887:14:
All inv_... tables should be populated by representative collection: Found table without entries: inv_zpool

@smklein smklein enabled auto-merge (squash) September 23, 2024 21:47
@smklein smklein merged commit ee6e95e into main Sep 23, 2024
16 checks passed
@smklein smklein deleted the representative-collection-check branch September 23, 2024 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants