fedimint_testing_core::db

Function snapshot_db_migrations_with_decoders

Source
pub async fn snapshot_db_migrations_with_decoders<'a, F>(
    snapshot_name: &str,
    prepare_fn: F,
    decoders: ModuleDecoderRegistry,
) -> Result<()>
where F: Fn(Database) -> BoxFuture<'a, ()>,
Expand description

Creates the database backup for snapshot_name to db/migrations. Then this function will execute the provided prepare_fn which is expected to populate the database with the appropriate data for testing a migration. If the snapshot directory already exists, this function will do nothing.