Skip to content

Commit 83b8664

Browse files
cgwaltersclaude
andcommitted
integration-tests: More macro followups
- Fully qualify the import per review - Finish conversions of tests that were missed This eliminates boilerplate and ensures consistency across all test registrations. Assisted-by: Claude Code (Sonnet 4.5) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Colin Walters <walters@verbum.org>
1 parent e7807e1 commit 83b8664

9 files changed

Lines changed: 10 additions & 31 deletions

File tree

crates/integration-tests/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
// Unfortunately needed here to work with linkme
77
#![allow(unsafe_code)]
88

9-
use linkme::distributed_slice;
10-
119
/// Label used to identify containers created by integration tests
1210
pub const INTEGRATION_TEST_LABEL: &str = "bcvk.integration-test=1";
1311

@@ -53,11 +51,11 @@ impl ParameterizedIntegrationTest {
5351
}
5452

5553
/// Distributed slice holding all registered integration tests
56-
#[distributed_slice]
54+
#[linkme::distributed_slice]
5755
pub static INTEGRATION_TESTS: [IntegrationTest];
5856

5957
/// Distributed slice holding all registered parameterized integration tests
60-
#[distributed_slice]
58+
#[linkme::distributed_slice]
6159
pub static PARAMETERIZED_INTEGRATION_TESTS: [ParameterizedIntegrationTest];
6260

6361
/// Register an integration test with less boilerplate.
@@ -78,7 +76,7 @@ pub static PARAMETERIZED_INTEGRATION_TESTS: [ParameterizedIntegrationTest];
7876
macro_rules! integration_test {
7977
($fn_name:ident) => {
8078
::paste::paste! {
81-
#[distributed_slice($crate::INTEGRATION_TESTS)]
79+
#[::linkme::distributed_slice($crate::INTEGRATION_TESTS)]
8280
static [<$fn_name:upper>]: $crate::IntegrationTest =
8381
$crate::IntegrationTest::new(stringify!($fn_name), $fn_name);
8482
}
@@ -103,7 +101,7 @@ macro_rules! integration_test {
103101
macro_rules! parameterized_integration_test {
104102
($fn_name:ident) => {
105103
::paste::paste! {
106-
#[distributed_slice($crate::PARAMETERIZED_INTEGRATION_TESTS)]
104+
#[::linkme::distributed_slice($crate::PARAMETERIZED_INTEGRATION_TESTS)]
107105
static [<$fn_name:upper>]: $crate::ParameterizedIntegrationTest =
108106
$crate::ParameterizedIntegrationTest::new(stringify!($fn_name), $fn_name);
109107
}

crates/integration-tests/src/main.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ use xshell::{cmd, Shell};
1111

1212
// Re-export constants from lib for internal use
1313
pub(crate) use integration_tests::{
14-
image_to_test_suffix, IntegrationTest, ParameterizedIntegrationTest, INTEGRATION_TESTS,
15-
INTEGRATION_TEST_LABEL, LIBVIRT_INTEGRATION_TEST_LABEL, PARAMETERIZED_INTEGRATION_TESTS,
14+
image_to_test_suffix, integration_test, INTEGRATION_TESTS, INTEGRATION_TEST_LABEL,
15+
LIBVIRT_INTEGRATION_TEST_LABEL, PARAMETERIZED_INTEGRATION_TESTS,
1616
};
17-
use linkme::distributed_slice;
1817

1918
mod tests {
2019
pub mod libvirt_base_disks;
@@ -144,9 +143,6 @@ pub(crate) fn run_bcvk_nocapture(args: &[&str]) -> std::io::Result<()> {
144143
Ok(())
145144
}
146145

147-
#[distributed_slice(INTEGRATION_TESTS)]
148-
static TEST_IMAGES_LIST: IntegrationTest = IntegrationTest::new("images_list", test_images_list);
149-
150146
fn test_images_list() -> Result<()> {
151147
println!("Running test: bcvk images list --json");
152148

@@ -188,6 +184,7 @@ fn test_images_list() -> Result<()> {
188184
println!("All image entries are valid JSON objects");
189185
Ok(())
190186
}
187+
integration_test!(test_images_list);
191188

192189
fn main() {
193190
let args = Arguments::from_args();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
99
use color_eyre::Result;
1010
use integration_tests::integration_test;
11-
use linkme::distributed_slice;
1211

1312
use regex::Regex;
1413
use std::process::Command;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
88
use color_eyre::Result;
99
use integration_tests::integration_test;
10-
use linkme::distributed_slice;
1110

1211
use std::process::Command;
1312

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
1010
use color_eyre::Result;
1111
use integration_tests::integration_test;
12-
use linkme::distributed_slice;
1312

1413
use std::process::Command;
1514

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use camino::Utf8Path;
1818
use color_eyre::Result;
1919
use integration_tests::integration_test;
20-
use linkme::distributed_slice;
2120

2221
use std::fs;
2322
use tempfile::TempDir;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
1717
use color_eyre::Result;
1818
use integration_tests::integration_test;
19-
use linkme::distributed_slice;
2019

2120
use std::process::Command;
2221
use tracing::debug;

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515
//! - Warning and continuing on failures
1616
1717
use color_eyre::Result;
18-
use integration_tests::integration_test;
19-
use linkme::distributed_slice;
18+
use integration_tests::{integration_test, parameterized_integration_test};
2019

2120
use std::process::Command;
2221
use std::thread;
2322
use std::time::Duration;
2423

25-
use crate::{
26-
get_test_image, run_bcvk, ParameterizedIntegrationTest, INTEGRATION_TEST_LABEL,
27-
PARAMETERIZED_INTEGRATION_TESTS,
28-
};
24+
use crate::{get_test_image, run_bcvk, INTEGRATION_TEST_LABEL};
2925

3026
/// Test running a non-interactive command via SSH
3127
fn test_run_ephemeral_ssh_command() -> Result<()> {
@@ -130,13 +126,6 @@ fn test_run_ephemeral_ssh_exit_code() -> Result<()> {
130126
}
131127
integration_test!(test_run_ephemeral_ssh_exit_code);
132128

133-
#[distributed_slice(PARAMETERIZED_INTEGRATION_TESTS)]
134-
static TEST_RUN_EPHEMERAL_SSH_CROSS_DISTRO_COMPATIBILITY: ParameterizedIntegrationTest =
135-
ParameterizedIntegrationTest::new(
136-
"run_ephemeral_ssh_cross_distro_compatibility",
137-
test_run_ephemeral_ssh_cross_distro_compatibility,
138-
);
139-
140129
/// Test SSH functionality across different bootc images
141130
/// This parameterized test runs once per image in BCVK_ALL_IMAGES and verifies
142131
/// that our systemd version compatibility fix works correctly with both newer
@@ -190,6 +179,7 @@ fn test_run_ephemeral_ssh_cross_distro_compatibility(image: &str) -> Result<()>
190179
}
191180
Ok(())
192181
}
182+
parameterized_integration_test!(test_run_ephemeral_ssh_cross_distro_compatibility);
193183

194184
/// Test that /run is mounted as tmpfs and supports unix domain sockets
195185
fn test_run_tmpfs() -> Result<()> {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use camino::Utf8PathBuf;
1818
use color_eyre::Result;
1919
use integration_tests::integration_test;
20-
use linkme::distributed_slice;
2120

2221
use std::process::Command;
2322
use tempfile::TempDir;

0 commit comments

Comments
 (0)