@@ -11,7 +11,8 @@ use xshell::{cmd, Shell};
1111
1212// Re-export constants from lib for internal use
1313pub ( crate ) use integration_tests:: {
14- IntegrationTest , INTEGRATION_TESTS , INTEGRATION_TEST_LABEL , LIBVIRT_INTEGRATION_TEST_LABEL ,
14+ image_to_test_suffix, IntegrationTest , ParameterizedIntegrationTest , INTEGRATION_TESTS ,
15+ INTEGRATION_TEST_LABEL , LIBVIRT_INTEGRATION_TEST_LABEL , PARAMETERIZED_INTEGRATION_TESTS ,
1516} ;
1617use linkme:: distributed_slice;
1718
@@ -43,30 +44,39 @@ pub(crate) fn get_bck_command() -> Result<String> {
4344 return Ok ( "bcvk" . to_owned ( ) ) ;
4445}
4546
46- /// Get the default bootc image to use for tests
47+ /// Get the primary bootc image to use for tests
4748///
48- /// Checks BCVK_TEST_IMAGE environment variable first, then falls back to default.
49- /// This allows easily overriding the base image for all integration tests.
50- ///
51- /// Default images:
52- /// - Primary: quay.io/fedora/fedora-bootc:42 (Fedora 42 with latest features)
53- /// - Alternative: quay.io/centos-bootc/centos-bootc:stream9 (CentOS Stream 9 for compatibility testing)
49+ /// Checks BCVK_PRIMARY_IMAGE environment variable first, then falls back to BCVK_TEST_IMAGE
50+ /// for backwards compatibility, then to a hardcoded default.
5451pub ( crate ) fn get_test_image ( ) -> String {
55- std:: env:: var ( "BCVK_TEST_IMAGE" )
56- . unwrap_or_else ( |_| "quay.io/fedora/fedora-bootc:42" . to_string ( ) )
52+ std:: env:: var ( "BCVK_PRIMARY_IMAGE" )
53+ . or_else ( |_| std:: env:: var ( "BCVK_TEST_IMAGE" ) )
54+ . unwrap_or_else ( |_| "quay.io/centos-bootc/centos-bootc:stream10" . to_string ( ) )
5755}
5856
59- /// Get an alternative bootc image for cross-platform testing
57+ /// Get all test images for matrix testing
58+ ///
59+ /// Parses BCVK_ALL_IMAGES environment variable, which should be a whitespace-separated
60+ /// list of container images (spaces, tabs, and newlines are all acceptable separators).
61+ /// Falls back to a single-element vec containing the primary image if not set or empty.
6062///
61- /// Returns a different image from the primary test image to test compatibility.
62- /// If BCVK_TEST_IMAGE is set to Fedora, returns CentOS Stream 9.
63- /// If BCVK_TEST_IMAGE is set to CentOS, returns Fedora.
64- pub ( crate ) fn get_alternative_test_image ( ) -> String {
65- let primary = get_test_image ( ) ;
66- if primary. contains ( "centos" ) {
67- "quay.io/fedora/fedora-bootc:42" . to_string ( )
63+ /// Example: `export BCVK_ALL_IMAGES="quay.io/fedora/fedora-bootc:42 quay.io/centos-bootc/centos-bootc:stream9"`
64+ pub ( crate ) fn get_all_test_images ( ) -> Vec < String > {
65+ if let Ok ( all_images) = std:: env:: var ( "BCVK_ALL_IMAGES" ) {
66+ let images: Vec < String > = all_images
67+ . split_whitespace ( )
68+ . filter ( |s| !s. is_empty ( ) )
69+ . map ( |s| s. to_string ( ) )
70+ . collect ( ) ;
71+
72+ if images. is_empty ( ) {
73+ eprintln ! ( "Warning: BCVK_ALL_IMAGES is set but empty, falling back to primary image" ) ;
74+ vec ! [ get_test_image( ) ]
75+ } else {
76+ images
77+ }
6878 } else {
69- "quay.io/centos-bootc/centos-bootc:stream9" . to_string ( )
79+ vec ! [ get_test_image ( ) ]
7080 }
7181}
7282
@@ -183,15 +193,29 @@ fn test_images_list() -> Result<()> {
183193fn main ( ) {
184194 let args = Arguments :: from_args ( ) ;
185195
186- // Collect tests from the distributed slice
187- let tests: Vec < Trial > = INTEGRATION_TESTS
188- . iter ( )
189- . map ( |test| {
190- let name = test. name ;
191- let f = test. f ;
192- Trial :: test ( name, move || f ( ) . map_err ( |e| format ! ( "{:?}" , e) . into ( ) ) )
193- } )
194- . collect ( ) ;
196+ let mut tests: Vec < Trial > = Vec :: new ( ) ;
197+
198+ // Collect regular tests from the distributed slice
199+ tests. extend ( INTEGRATION_TESTS . iter ( ) . map ( |test| {
200+ let name = test. name ;
201+ let f = test. f ;
202+ Trial :: test ( name, move || f ( ) . map_err ( |e| format ! ( "{:?}" , e) . into ( ) ) )
203+ } ) ) ;
204+
205+ // Collect parameterized tests and generate variants for each image
206+ let all_images = get_all_test_images ( ) ;
207+ for param_test in PARAMETERIZED_INTEGRATION_TESTS . iter ( ) {
208+ for image in & all_images {
209+ let image = image. clone ( ) ;
210+ let test_suffix = image_to_test_suffix ( & image) ;
211+ let test_name = format ! ( "{}_{}" , param_test. name, test_suffix) ;
212+ let f = param_test. f ;
213+
214+ tests. push ( Trial :: test ( test_name, move || {
215+ f ( & image) . map_err ( |e| format ! ( "{:?}" , e) . into ( ) )
216+ } ) ) ;
217+ }
218+ }
195219
196220 // Run the tests and exit with the result
197221 libtest_mimic:: run ( & args, tests) . exit ( ) ;
0 commit comments