Skip to content

Commit c36aedb

Browse files
committed
tests: Bump nextest timeout, remove nested timeouts
Having a slower virtiofsd meant we are now more likely to hit timeouts. Drop the nested timeouts in the tests, relying fully on the nextest timeout. Signed-off-by: Colin Walters <[email protected]>
1 parent a642a14 commit c36aedb

File tree

5 files changed

+235
-332
lines changed

5 files changed

+235
-332
lines changed

.config/nextest.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ status-level = "pass"
2020
# Profile for integration tests - run with limited parallelism due to QEMU/KVM resources
2121
[profile.integration]
2222
test-threads = 2
23-
slow-timeout = { period = "500s", terminate-after = 60 }
23+
# Full 20 minutes for a timeout by default, since GHA runners can be really slow
24+
slow-timeout = { period = "1200s", terminate-after = 60 }
2425
fail-fast = false
2526
failure-output = "immediate"
2627
success-output = "never"

crates/integration-tests/src/main.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,19 @@ pub(crate) fn run_bcvk(args: &[&str]) -> std::io::Result<CapturedOutput> {
116116
run_command(&bck, args)
117117
}
118118

119+
/// Run the bcvk command with inherited stdout/stderr (no capture)
120+
/// Use this when you just need to verify the command succeeded without checking output
121+
pub(crate) fn run_bcvk_nocapture(args: &[&str]) -> std::io::Result<()> {
122+
let bck = get_bck_command().expect("Failed to get bcvk command");
123+
let status = std::process::Command::new(&bck).args(args).status()?;
124+
assert!(
125+
status.success(),
126+
"bcvk command failed with args: {:?}",
127+
args
128+
);
129+
Ok(())
130+
}
131+
119132
fn test_images_list() -> Result<()> {
120133
println!("Running test: bcvk images list --json");
121134

crates/integration-tests/src/tests/libvirt_base_disks.rs

Lines changed: 47 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
99
use std::process::Command;
1010

11-
use crate::{get_bck_command, get_test_image};
11+
use crate::{get_bck_command, get_test_image, run_bcvk};
1212

1313
/// Test that base disk is created and reused for multiple VMs
1414
pub fn test_base_disk_creation_and_reuse() {
15-
let bck = get_bck_command().unwrap();
1615
let test_image = get_test_image();
1716

1817
// Generate unique names for test VMs
@@ -33,74 +32,60 @@ pub fn test_base_disk_creation_and_reuse() {
3332

3433
// Create first VM - this should create a new base disk
3534
println!("Creating first VM (should create base disk)...");
36-
let vm1_output = Command::new("timeout")
37-
.args([
38-
"300s",
39-
&bck,
40-
"libvirt",
41-
"run",
42-
"--name",
43-
&vm1_name,
44-
"--filesystem",
45-
"ext4",
46-
&test_image,
47-
])
48-
.output()
49-
.expect("Failed to create first VM");
50-
51-
let vm1_stdout = String::from_utf8_lossy(&vm1_output.stdout);
52-
let vm1_stderr = String::from_utf8_lossy(&vm1_output.stderr);
53-
54-
println!("VM1 stdout: {}", vm1_stdout);
55-
println!("VM1 stderr: {}", vm1_stderr);
56-
57-
if !vm1_output.status.success() {
35+
let vm1_output = run_bcvk(&[
36+
"libvirt",
37+
"run",
38+
"--name",
39+
&vm1_name,
40+
"--filesystem",
41+
"ext4",
42+
&test_image,
43+
])
44+
.expect("Failed to create first VM");
45+
46+
println!("VM1 stdout: {}", vm1_output.stdout);
47+
println!("VM1 stderr: {}", vm1_output.stderr);
48+
49+
if !vm1_output.success() {
5850
cleanup_domain(&vm1_name);
5951
cleanup_domain(&vm2_name);
6052

61-
panic!("Failed to create first VM: {}", vm1_stderr);
53+
panic!("Failed to create first VM: {}", vm1_output.stderr);
6254
}
6355

6456
// Verify base disk was created
6557
assert!(
66-
vm1_stdout.contains("Using base disk") || vm1_stdout.contains("base disk"),
58+
vm1_output.stdout.contains("Using base disk") || vm1_output.stdout.contains("base disk"),
6759
"Should mention base disk creation"
6860
);
6961

7062
// Create second VM - this should reuse the base disk
7163
println!("Creating second VM (should reuse base disk)...");
72-
let vm2_output = Command::new("timeout")
73-
.args([
74-
"300s",
75-
&bck,
76-
"libvirt",
77-
"run",
78-
"--name",
79-
&vm2_name,
80-
"--filesystem",
81-
"ext4",
82-
&test_image,
83-
])
84-
.output()
85-
.expect("Failed to create second VM");
86-
87-
let vm2_stdout = String::from_utf8_lossy(&vm2_output.stdout);
88-
let vm2_stderr = String::from_utf8_lossy(&vm2_output.stderr);
89-
90-
println!("VM2 stdout: {}", vm2_stdout);
91-
println!("VM2 stderr: {}", vm2_stderr);
64+
let vm2_output = run_bcvk(&[
65+
"libvirt",
66+
"run",
67+
"--name",
68+
&vm2_name,
69+
"--filesystem",
70+
"ext4",
71+
&test_image,
72+
])
73+
.expect("Failed to create second VM");
74+
75+
println!("VM2 stdout: {}", vm2_output.stdout);
76+
println!("VM2 stderr: {}", vm2_output.stderr);
9277

9378
// Cleanup before assertions
9479
cleanup_domain(&vm1_name);
9580
cleanup_domain(&vm2_name);
9681

97-
if !vm2_output.status.success() {
98-
panic!("Failed to create second VM: {}", vm2_stderr);
82+
if !vm2_output.success() {
83+
panic!("Failed to create second VM: {}", vm2_output.stderr);
9984
}
10085

10186
// Verify base disk was reused (should be faster and mention using existing)
10287
assert!(
103-
vm2_stdout.contains("Using base disk") || vm2_stdout.contains("base disk"),
88+
vm2_output.stdout.contains("Using base disk") || vm2_output.stdout.contains("base disk"),
10489
"Should mention using base disk"
10590
);
10691

@@ -183,7 +168,6 @@ pub fn test_base_disks_prune_dry_run() {
183168

184169
/// Test that VM disks reference base disks correctly
185170
pub fn test_vm_disk_references_base() {
186-
let bck = get_bck_command().unwrap();
187171
let test_image = get_test_image();
188172

189173
let timestamp = std::time::SystemTime::now()
@@ -197,26 +181,21 @@ pub fn test_vm_disk_references_base() {
197181
cleanup_domain(&vm_name);
198182

199183
// Create VM
200-
let output = Command::new("timeout")
201-
.args([
202-
"300s",
203-
&bck,
204-
"libvirt",
205-
"run",
206-
"--name",
207-
&vm_name,
208-
"--filesystem",
209-
"ext4",
210-
&test_image,
211-
])
212-
.output()
213-
.expect("Failed to create VM");
214-
215-
if !output.status.success() {
216-
let stderr = String::from_utf8_lossy(&output.stderr);
184+
let output = run_bcvk(&[
185+
"libvirt",
186+
"run",
187+
"--name",
188+
&vm_name,
189+
"--filesystem",
190+
"ext4",
191+
&test_image,
192+
])
193+
.expect("Failed to create VM");
194+
195+
if !output.success() {
217196
cleanup_domain(&vm_name);
218197

219-
panic!("Failed to create VM: {}", stderr);
198+
panic!("Failed to create VM: {}", output.stderr);
220199
}
221200

222201
// Get VM disk path from domain XML

0 commit comments

Comments
 (0)