Skip to content

Commit 076b434

Browse files
committed
tests: serialize all libvirt run tests
In a fresh CI environment, these tests all race to create a base disk which could cause slowdown. Signed-off-by: Colin Walters <walters@verbum.org>
1 parent f24368f commit 076b434

2 files changed

Lines changed: 33 additions & 20 deletions

File tree

.config/nextest.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,10 @@ default-filter = "package(integration-tests)"
3333
path = "junit.xml"
3434
store-success-output = true
3535
store-failure-output = true
36+
37+
# Per-test overrides for libvirt tests that create VMs
38+
# These tests race on creating libvirt base disks, so they need to run serially
39+
# VMs get 4 vcpus by default, so require 4 threads to prevent any parallelism
40+
[[profile.integration.overrides]]
41+
filter = 'test(~^test_libvirt_run)'
42+
threads-required = 4

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

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ fn test_libvirt_list_json_output() -> Result<()> {
9696
}
9797

9898
#[distributed_slice(INTEGRATION_TESTS)]
99-
static TEST_LIBVIRT_LIST_JSON_SSH_METADATA: IntegrationTest = IntegrationTest::new(
100-
"test_libvirt_list_json_ssh_metadata",
101-
test_libvirt_list_json_ssh_metadata,
99+
static TEST_LIBVIRT_RUN_LIST_JSON_SSH_METADATA: IntegrationTest = IntegrationTest::new(
100+
"test_libvirt_run_list_json_ssh_metadata",
101+
test_libvirt_run_list_json_ssh_metadata,
102102
);
103103

104104
/// Test libvirt list JSON output includes SSH metadata
105-
fn test_libvirt_list_json_ssh_metadata() -> Result<()> {
105+
fn test_libvirt_run_list_json_ssh_metadata() -> Result<()> {
106106
let test_image = get_test_image();
107107

108108
// Generate unique domain name for this test
@@ -521,11 +521,13 @@ fn wait_for_ssh_available(
521521
}
522522

523523
#[distributed_slice(INTEGRATION_TESTS)]
524-
static TEST_LIBVIRT_VM_LIFECYCLE: IntegrationTest =
525-
IntegrationTest::new("test_libvirt_vm_lifecycle", test_libvirt_vm_lifecycle);
524+
static TEST_LIBVIRT_RUN_VM_LIFECYCLE: IntegrationTest = IntegrationTest::new(
525+
"test_libvirt_run_vm_lifecycle",
526+
test_libvirt_run_vm_lifecycle,
527+
);
526528

527529
/// Test VM startup and shutdown with libvirt run
528-
fn test_libvirt_vm_lifecycle() -> Result<()> {
530+
fn test_libvirt_run_vm_lifecycle() -> Result<()> {
529531
let bck = get_bck_command()?;
530532
let test_volume = "test-vm-lifecycle";
531533
let domain_name = format!("bootc-{}", test_volume);
@@ -627,11 +629,13 @@ fn test_libvirt_vm_lifecycle() -> Result<()> {
627629
}
628630

629631
#[distributed_slice(INTEGRATION_TESTS)]
630-
static TEST_LIBVIRT_BIND_STORAGE_RO: IntegrationTest =
631-
IntegrationTest::new("test_libvirt_bind_storage_ro", test_libvirt_bind_storage_ro);
632+
static TEST_LIBVIRT_RUN_BIND_STORAGE_RO: IntegrationTest = IntegrationTest::new(
633+
"test_libvirt_run_bind_storage_ro",
634+
test_libvirt_run_bind_storage_ro,
635+
);
632636

633637
/// Test container storage binding functionality end-to-end
634-
fn test_libvirt_bind_storage_ro() -> Result<()> {
638+
fn test_libvirt_run_bind_storage_ro() -> Result<()> {
635639
let bck = get_bck_command()?;
636640
let test_image = get_test_image();
637641

@@ -804,13 +808,13 @@ fn test_libvirt_bind_storage_ro() -> Result<()> {
804808
}
805809

806810
#[distributed_slice(INTEGRATION_TESTS)]
807-
static TEST_LIBVIRT_LABEL_FUNCTIONALITY: IntegrationTest = IntegrationTest::new(
808-
"test_libvirt_label_functionality",
809-
test_libvirt_label_functionality,
811+
static TEST_LIBVIRT_RUN_LABEL_FUNCTIONALITY: IntegrationTest = IntegrationTest::new(
812+
"test_libvirt_run_label_functionality",
813+
test_libvirt_run_label_functionality,
810814
);
811815

812816
/// Test libvirt label functionality
813-
fn test_libvirt_label_functionality() -> Result<()> {
817+
fn test_libvirt_run_label_functionality() -> Result<()> {
814818
let bck = get_bck_command()?;
815819
let test_image = get_test_image();
816820

@@ -985,11 +989,13 @@ fn test_libvirt_error_handling() -> Result<()> {
985989
}
986990

987991
#[distributed_slice(INTEGRATION_TESTS)]
988-
static TEST_LIBVIRT_TRANSIENT_VM: IntegrationTest =
989-
IntegrationTest::new("test_libvirt_transient_vm", test_libvirt_transient_vm);
992+
static TEST_LIBVIRT_RUN_TRANSIENT_VM: IntegrationTest = IntegrationTest::new(
993+
"test_libvirt_run_transient_vm",
994+
test_libvirt_run_transient_vm,
995+
);
990996

991997
/// Test transient VM functionality
992-
fn test_libvirt_transient_vm() -> Result<()> {
998+
fn test_libvirt_run_transient_vm() -> Result<()> {
993999
let test_image = get_test_image();
9941000

9951001
// Generate unique domain name for this test
@@ -1144,11 +1150,11 @@ fn test_libvirt_transient_vm() -> Result<()> {
11441150
}
11451151

11461152
#[distributed_slice(INTEGRATION_TESTS)]
1147-
static TEST_LIBVIRT_BIND_MOUNTS: IntegrationTest =
1148-
IntegrationTest::new("test_libvirt_bind_mounts", test_libvirt_bind_mounts);
1153+
static TEST_LIBVIRT_RUN_BIND_MOUNTS: IntegrationTest =
1154+
IntegrationTest::new("test_libvirt_run_bind_mounts", test_libvirt_run_bind_mounts);
11491155

11501156
/// Test automatic bind mount functionality with systemd mount units
1151-
fn test_libvirt_bind_mounts() -> Result<()> {
1157+
fn test_libvirt_run_bind_mounts() -> Result<()> {
11521158
use camino::Utf8Path;
11531159
use std::fs;
11541160
use tempfile::TempDir;

0 commit comments

Comments
 (0)