Skip to content

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

Merged
smklein merged 11 commits into
mainfrom
representative-collection-check
Sep 23, 2024
Merged

[nexus] Check that representative collection populates "inv_..." tables#6637
smklein merged 11 commits into
mainfrom
representative-collection-check

Conversation

@smklein

@smklein smklein commented Sep 23, 2024

Copy link
Copy Markdown
Collaborator

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
ArePopulated,
}

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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

Development

Successfully merging this pull request may close these issues.

Add test that inv_ tables are populated by representative collection Datastore: add a thorough test of deleting inventory collections

2 participants