fedimint_testing_core

Module db

source

Constants§

Functions§

  • Helper function that recursively copies all contents from src to dst.
  • Creates a backup database in the snapshot_dir according to the FM_PREPARE_DB_MIGRATION_SNAPSHOTS, since we do not want to re-create a backup database every time we run the tests.
  • Get the project root (relative to closest Cargo.lock file)
  • Retrieves a temporary database from the database backup directory. The first folder that starts with db_prefix will return as a temporary database.
  • Opens the backup database in the snapshot_dir. If the is_isolated flag is set, the database will be opened as an isolated database with TEST_MODULE_INSTANCE_ID as the prefix.
  • Open a temporary database located at temp_path and copy the contents from the folder src_dir to the temporary database’s path.
  • Creates the database backup directory for a server module by appending the 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.
  • Create the database backup directory for a client module. Two prepare functions are taken as parameters. data_prepare is expected to create any data that the client module uses and is stored in the isolated namespace. state_machine_prepare creates client state machine data that can be used for testing state machine migrations. This is created in the global namespace.
  • 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.
  • Validates the database migrations for a client module. First applies all database migrations to the module, including the state machine migrations. Then calls the validate function, including the new active_states and inactive_states, and is expected to confirm the database migrations were successful.
  • Validates the database migrations for the core client. First applies all database migrations to the core client. Then calls the validate function, including the new active_states and inactive_states, and is expected to confirm the database migrations were successful.
  • Validates the database migrations. decoders need to be passed in as an argument since this is module agnostic. First applies all defined migrations to the database then executes the `validate`` function which should confirm the database migrations were successful.
  • Validates the database migrations for a server module. First applies all database migrations to the module, then calls the validate which should confirm the database migrations were successful.