Skip to content

Commit

Permalink
Add a test that exposes our bug
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <amulhern@redhat.com>
  • Loading branch information
mulkieran committed Sep 21, 2021
1 parent 87298a9 commit 7dc8f68
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/engine/strat_engine/pool.rs
Expand Up @@ -895,6 +895,43 @@ mod tests {
);
}

// Verify that it is possible to add datadevs after a cache is initialized.
fn test_add_cachedevs_and_datadevs(paths: &[&Path]) {
assert!(paths.len() > 3);

let (cache_path, data_paths) = paths.split_at(1);
let (data_path, data_paths) = data_paths.split_at(1);

let name = "stratis-test-pool";
let (uuid, mut pool) =
StratPool::initialize(name, data_path, Redundancy::NONE, None).unwrap();
invariant(&pool, name);

pool.init_cache(uuid, name, cache_path).unwrap();
invariant(&pool, name);

pool.add_blockdevs(uuid, name, data_paths, BlockDevTier::Data)
.unwrap();

pool.teardown().unwrap();
}

#[test]
fn loop_test_add_cachedevs_and_datadevs() {
loopbacked::test_with_spec(
&loopbacked::DeviceLimits::Range(3, 4, None),
test_add_cachedevs_and_datadevs,
);
}

#[test]
fn real_test_add_cachedevs_and_datadevs() {
real::test_with_spec(
&real::DeviceLimits::AtLeast(3, None, None),
test_add_cachedevs_and_datadevs,
);
}

/// Verify that adding additional blockdevs will cause a pool that is
/// out of space to be extended.
fn test_add_datadevs(paths: &[&Path]) {
Expand Down

0 comments on commit 7dc8f68

Please sign in to comment.