Rearranges eah TestEnvironment fields to ensure drop order (#28270)

This commit is contained in:
Brooks Prumo 2022-10-06 16:17:32 -04:00 committed by GitHub
parent c802b12e10
commit 981c9d07a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -42,16 +42,17 @@ use {
};
struct TestEnvironment {
/// NOTE: The fields are arranged to ensure they are dropped in the correct order.
/// - BankForks must be dropped before BackgroundServices
/// - BackgroundServices must be dropped before the TempDirs
/// - SnapshotConfig should be dropped before the TempDirs
bank_forks: Arc<RwLock<BankForks>>,
background_services: BackgroundServices,
genesis_config_info: GenesisConfigInfo,
_snapshot_config: SnapshotConfig,
_bank_snapshots_dir: TempDir,
_full_snapshot_archives_dir: TempDir,
_incremental_snapshot_archives_dir: TempDir,
_snapshot_config: SnapshotConfig,
// NOTE: This field must come after bank_forks because it must be dropped after
background_services: BackgroundServices,
}
impl TestEnvironment {