-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_volumes_prune.rs
36 lines (27 loc) · 1.06 KB
/
test_volumes_prune.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#[path = "test_utils/lib.rs"]
mod test_utils;
use test_utils::random_name;
use passivized_docker_engine_client::DockerEngineClient;
use passivized_docker_engine_client::requests::CreateVolumeRequest;
/// Cargo runs tests in parallel, grouped by file, one file at a time. Consequentially,
/// if any test has a race with another test, those tests must be in separate files.
///
/// This test presents a race with other volume tests. Another test could have created
/// a volume it needs for a container it has not created yet. Prune will see that
/// volume as unused, and ready to prune.
#[tokio::test]
async fn test_create_and_prune_volume() {
const FN: &str = "test_create_and_prune_volume";
let dec = DockerEngineClient::new()
.unwrap();
let volume_name = random_name(FN);
let request = CreateVolumeRequest::default()
.name(&volume_name);
dec.volumes().create(request)
.await
.unwrap();
let pruning = dec.volumes().prune()
.await
.unwrap();
assert!(pruning.volumes_deleted.contains(&volume_name));
}