Skip to content

Commit 36328aa

Browse files
committed
integration-tests: Remove acceptable error handling
Remove the "acceptable errors" logic that was allowing tests to pass when they encountered libvirt/KVM errors. Now that we have proper QEMU logging and base disk caching, tests should fail clearly rather than being silently skipped. This makes test failures more visible and easier to diagnose. Signed-off-by: Claude <[email protected]> Signed-off-by: Colin Walters <[email protected]>
1 parent 957263c commit 36328aa

File tree

1 file changed

+3
-108
lines changed

1 file changed

+3
-108
lines changed

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

Lines changed: 3 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ use crate::{get_bck_command, get_test_image};
1515
pub fn test_libvirt_list_functionality() {
1616
let bck = get_bck_command().unwrap();
1717

18-
// Check if virsh is available
19-
let virsh_check = Command::new("which").arg("virsh").output();
20-
21-
if virsh_check.is_err() || !virsh_check.unwrap().status.success() {
22-
println!("Skipping libvirt list test - virsh not available");
23-
return;
24-
}
25-
2618
let output = Command::new(&bck)
2719
.args(["libvirt", "list"])
2820
.output()
@@ -197,12 +189,6 @@ pub fn test_libvirt_ssh_integration() {
197189

198190
/// Test full libvirt run + SSH workflow like run_ephemeral SSH tests
199191
pub fn test_libvirt_run_ssh_full_workflow() {
200-
// Skip if running in CI/container environment without libvirt
201-
if std::env::var("CI").is_ok() || !std::path::Path::new("/usr/bin/virsh").exists() {
202-
println!("Skipping full SSH workflow test - no libvirt available");
203-
return;
204-
}
205-
206192
let bck = get_bck_command().unwrap();
207193
let test_image = get_test_image();
208194

@@ -254,36 +240,6 @@ pub fn test_libvirt_run_ssh_full_workflow() {
254240
if !create_output.status.success() {
255241
cleanup_domain(&domain_name);
256242

257-
// Check for acceptable failures (no libvirt, permissions, etc.)
258-
let acceptable_failures = [
259-
"pool",
260-
"connect",
261-
"Permission denied",
262-
"libvirt",
263-
"KVM",
264-
"kvm",
265-
"nested",
266-
"hardware",
267-
"acceleration",
268-
"Storage pool",
269-
"qemu",
270-
"network",
271-
];
272-
273-
let is_acceptable = acceptable_failures.iter().any(|&pattern| {
274-
create_stderr
275-
.to_lowercase()
276-
.contains(&pattern.to_lowercase())
277-
});
278-
279-
if is_acceptable {
280-
println!(
281-
"Skipping full SSH workflow test - libvirt not properly configured: {}",
282-
create_stderr
283-
);
284-
return;
285-
}
286-
287243
panic!("Failed to create domain with SSH: {}", create_stderr);
288244
}
289245

@@ -320,31 +276,7 @@ pub fn test_libvirt_run_ssh_full_workflow() {
320276

321277
// Check SSH results
322278
if !ssh_output.status.success() {
323-
// SSH might fail due to VM not being ready, network issues, etc.
324-
let acceptable_ssh_failures = [
325-
"connection",
326-
"timeout",
327-
"refused",
328-
"network",
329-
"ssh",
330-
"not running",
331-
"boot",
332-
];
333-
334-
let is_acceptable = acceptable_ssh_failures
335-
.iter()
336-
.any(|&pattern| ssh_stderr.to_lowercase().contains(&pattern.to_lowercase()));
337-
338-
if is_acceptable {
339-
println!(
340-
"SSH connection failed (may be expected in test environment): {}",
341-
ssh_stderr
342-
);
343-
println!("Full workflow test completed - domain creation and SSH integration working");
344-
return;
345-
}
346-
347-
panic!("SSH connection failed unexpectedly: {}", ssh_stderr);
279+
panic!("SSH connection failed: {}", ssh_stderr);
348280
}
349281

350282
// Verify we got the expected output
@@ -436,12 +368,6 @@ fn wait_for_ssh_available(
436368

437369
/// Test VM startup and shutdown with libvirt run
438370
pub fn test_libvirt_vm_lifecycle() {
439-
// Skip if running in CI/container environment without libvirt
440-
if std::env::var("CI").is_ok() || !std::path::Path::new("/usr/bin/virsh").exists() {
441-
println!("Skipping VM lifecycle test - no libvirt available");
442-
return;
443-
}
444-
445371
let bck = get_bck_command().unwrap();
446372
let test_volume = "test-vm-lifecycle";
447373
let domain_name = format!("bootc-{}", test_volume);
@@ -473,18 +399,7 @@ pub fn test_libvirt_vm_lifecycle() {
473399

474400
if !output.status.success() {
475401
let stderr = String::from_utf8_lossy(&output.stderr);
476-
println!("Create failed (expected in CI): {}", stderr);
477-
478-
// If creation fails (e.g., no libvirt storage), skip the test
479-
if stderr.contains("pool")
480-
|| stderr.contains("connect")
481-
|| stderr.contains("Permission denied")
482-
{
483-
println!("Skipping VM lifecycle test - libvirt not properly configured");
484-
return;
485-
}
486-
487-
panic!("Unexpected failure in VM creation: {}", stderr);
402+
panic!("Failed to create VM: {}", stderr);
488403
}
489404

490405
println!("Created VM domain: {}", domain_name);
@@ -524,27 +439,7 @@ pub fn test_libvirt_vm_lifecycle() {
524439
}
525440
} else {
526441
let stderr = String::from_utf8_lossy(&start_output.stderr);
527-
println!("VM start failed (may be expected): {}", stderr);
528-
529-
// Some failures are acceptable (no KVM, nested virtualization, etc.)
530-
let acceptable_failures = [
531-
"KVM",
532-
"kvm",
533-
"nested",
534-
"hardware",
535-
"acceleration",
536-
"permission",
537-
"qemu",
538-
"network",
539-
];
540-
541-
let is_acceptable = acceptable_failures
542-
.iter()
543-
.any(|&pattern| stderr.to_lowercase().contains(pattern));
544-
545-
if !is_acceptable {
546-
panic!("Unexpected VM start failure: {}", stderr);
547-
}
442+
panic!("VM start failed: {}", stderr);
548443
}
549444

550445
// Cleanup - remove the domain

0 commit comments

Comments
 (0)