@@ -491,18 +491,18 @@ fn generate_random_suffix() -> String {
491491 . collect ( )
492492}
493493
494- /// Sanitize a plan name for use in a VM name
494+ /// Sanitize a name for use in a VM name
495495/// Replaces non-alphanumeric characters (except - and _) with dashes
496- /// Returns "plan " if the result would be empty
497- fn sanitize_plan_name ( plan : & str ) -> String {
498- let sanitized = plan
496+ /// Returns "tmt " if the result would be empty
497+ fn sanitize_name ( name : & str ) -> String {
498+ let sanitized = name
499499 . replace ( '/' , "-" )
500500 . replace ( |c : char | !c. is_alphanumeric ( ) && c != '-' && c != '_' , "-" )
501501 . trim_matches ( '-' )
502502 . to_string ( ) ;
503503
504504 if sanitized. is_empty ( ) {
505- "plan " . to_string ( )
505+ "tmt " . to_string ( )
506506 } else {
507507 sanitized
508508 }
@@ -560,38 +560,38 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
560560 // Change to workdir for running tmt commands
561561 let _dir = sh. push_dir ( workdir) ;
562562
563- // Get the list of plans
564- println ! ( "Discovering test plans ..." ) ;
565- let plans_output = cmd ! ( sh, "tmt plan ls" )
563+ // Get the list of tests
564+ println ! ( "Discovering tests ..." ) ;
565+ let tests_output = cmd ! ( sh, "tmt test ls" )
566566 . read ( )
567567 . context ( "Getting list of test plans" ) ?;
568568
569- let mut plans : Vec < & str > = plans_output
569+ let mut tests : Vec < & str > = tests_output
570570 . lines ( )
571571 . map ( |line| line. trim ( ) )
572572 . filter ( |line| !line. is_empty ( ) && line. starts_with ( "/" ) )
573573 . collect ( ) ;
574574
575- // Filter plans based on user arguments
575+ // Filter tests based on user arguments
576576 if !filter_args. is_empty ( ) {
577- let original_count = plans . len ( ) ;
578- plans . retain ( |plan | filter_args. iter ( ) . any ( |arg| plan . contains ( arg. as_str ( ) ) ) ) ;
579- if plans . len ( ) < original_count {
577+ let original_count = tests . len ( ) ;
578+ tests . retain ( |t | filter_args. iter ( ) . any ( |arg| t . contains ( arg. as_str ( ) ) ) ) ;
579+ if tests . len ( ) < original_count {
580580 println ! (
581- "Filtered from {} to {} plan (s) based on arguments: {:?}" ,
581+ "Filtered from {} to {} test (s) based on arguments: {:?}" ,
582582 original_count,
583- plans . len( ) ,
583+ tests . len( ) ,
584584 filter_args
585585 ) ;
586586 }
587587 }
588588
589- if plans . is_empty ( ) {
590- println ! ( "No test plans found" ) ;
589+ if tests . is_empty ( ) {
590+ println ! ( "No tests found" ) ;
591591 return Ok ( ( ) ) ;
592592 }
593593
594- println ! ( "Found {} test plan (s): {:?}" , plans . len( ) , plans ) ;
594+ println ! ( "Found {} test(s): {:?}" , tests . len( ) , tests ) ;
595595
596596 // Generate a random suffix for VM names
597597 let random_suffix = generate_random_suffix ( ) ;
@@ -600,18 +600,17 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
600600 let mut all_passed = true ;
601601 let mut test_results = Vec :: new ( ) ;
602602
603- // Run each plan in its own VM
604- for plan in plans {
605- let plan_name = sanitize_plan_name ( plan ) ;
606- let vm_name = format ! ( "bootc-tmt-{}-{}" , random_suffix, plan_name ) ;
603+ // Run each test in its own VM
604+ for test in tests {
605+ let test_name = sanitize_name ( test ) ;
606+ let vm_name = format ! ( "bootc-tmt-{}-{}" , random_suffix, test_name ) ;
607607
608608 println ! ( "\n ========================================" ) ;
609- println ! ( "Running plan : {}" , plan ) ;
609+ println ! ( "Running test : {}" , test ) ;
610610 println ! ( "VM name: {}" , vm_name) ;
611611 println ! ( "========================================\n " ) ;
612612
613613 // Launch VM with bcvk
614-
615614 let launch_result = cmd ! (
616615 sh,
617616 "bcvk libvirt run --name {vm_name} --detach {COMMON_INST_ARGS...} {image}"
@@ -620,9 +619,9 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
620619 . context ( "Launching VM with bcvk" ) ;
621620
622621 if let Err ( e) = launch_result {
623- eprintln ! ( "Failed to launch VM for plan { }: {:#}" , plan , e ) ;
622+ eprintln ! ( "Failed to launch VM for test {test }: {e :#}" ) ;
624623 all_passed = false ;
625- test_results. push ( ( plan . to_string ( ) , false ) ) ;
624+ test_results. push ( ( test . to_string ( ) , false ) ) ;
626625 continue ;
627626 }
628627
@@ -645,10 +644,10 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
645644 let ( ssh_port, ssh_key) = match vm_info {
646645 Ok ( ( port, key) ) => ( port, key) ,
647646 Err ( e) => {
648- eprintln ! ( "Failed to get VM info for plan {}: {:#}" , plan , e ) ;
647+ eprintln ! ( "Failed to get VM info for plan {test }: {e :#}" ) ;
649648 cleanup_vm ( ) ;
650649 all_passed = false ;
651- test_results. push ( ( plan . to_string ( ) , false ) ) ;
650+ test_results. push ( ( test . to_string ( ) , false ) ) ;
652651 continue ;
653652 }
654653 } ;
@@ -661,10 +660,10 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
661660 let key_file = match key_file {
662661 Ok ( f) => f,
663662 Err ( e) => {
664- eprintln ! ( "Failed to create SSH key file for plan {}: {:#}" , plan , e ) ;
663+ eprintln ! ( "Failed to create SSH key file for plan {test }: {e :#}" ) ;
665664 cleanup_vm ( ) ;
666665 all_passed = false ;
667- test_results. push ( ( plan . to_string ( ) , false ) ) ;
666+ test_results. push ( ( test . to_string ( ) , false ) ) ;
668667 continue ;
669668 }
670669 } ;
@@ -675,19 +674,19 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
675674 let key_path = match key_path {
676675 Ok ( p) => p,
677676 Err ( e) => {
678- eprintln ! ( "Failed to convert key path for plan { }: {:#}" , plan , e ) ;
677+ eprintln ! ( "Failed to convert key path for test {test }: {e :#}" ) ;
679678 cleanup_vm ( ) ;
680679 all_passed = false ;
681- test_results. push ( ( plan . to_string ( ) , false ) ) ;
680+ test_results. push ( ( test . to_string ( ) , false ) ) ;
682681 continue ;
683682 }
684683 } ;
685684
686685 if let Err ( e) = std:: fs:: write ( & key_path, ssh_key) {
687- eprintln ! ( "Failed to write SSH key for plan { }: {:#}" , plan , e ) ;
686+ eprintln ! ( "Failed to write SSH key for test {test }: {e :#}" ) ;
688687 cleanup_vm ( ) ;
689688 all_passed = false ;
690- test_results. push ( ( plan . to_string ( ) , false ) ) ;
689+ test_results. push ( ( test . to_string ( ) , false ) ) ;
691690 continue ;
692691 }
693692
@@ -696,38 +695,38 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
696695 use std:: os:: unix:: fs:: PermissionsExt ;
697696 let perms = std:: fs:: Permissions :: from_mode ( 0o600 ) ;
698697 if let Err ( e) = std:: fs:: set_permissions ( & key_path, perms) {
699- eprintln ! ( "Failed to set key permissions for plan { }: {:#}" , plan , e ) ;
698+ eprintln ! ( "Failed to set key permissions for test {test }: {e :#}" ) ;
700699 cleanup_vm ( ) ;
701700 all_passed = false ;
702- test_results. push ( ( plan . to_string ( ) , false ) ) ;
701+ test_results. push ( ( test . to_string ( ) , false ) ) ;
703702 continue ;
704703 }
705704 }
706705
707706 // Verify SSH connectivity
708707 println ! ( "Verifying SSH connectivity..." ) ;
709708 if let Err ( e) = verify_ssh_connectivity ( sh, ssh_port, & key_path) {
710- eprintln ! ( "SSH verification failed for plan { }: {:#}" , plan , e ) ;
709+ eprintln ! ( "SSH verification failed for test {test }: {e :#}" ) ;
711710 cleanup_vm ( ) ;
712711 all_passed = false ;
713- test_results. push ( ( plan . to_string ( ) , false ) ) ;
712+ test_results. push ( ( test . to_string ( ) , false ) ) ;
714713 continue ;
715714 }
716715
717716 println ! ( "SSH connectivity verified" ) ;
718717
719718 let ssh_port_str = ssh_port. to_string ( ) ;
720719
721- // Run tmt for this specific plan using connect provisioner
722- println ! ( "Running tmt tests for plan {}..." , plan ) ;
720+ // Run tmt for this specific test using connect provisioner
721+ println ! ( "Running tmt test {}..." , test ) ;
723722
724- // Run tmt for this specific plan
725- // Note: provision must come before plan for connect to work properly
723+ // Run tmt for this specific test
724+ // Note: provision must come before tests for connect to work properly
726725 let context = context. clone ( ) ;
727726 let how = [ "--how=connect" , "--guest=localhost" , "--user=root" ] ;
728727 let test_result = cmd ! (
729728 sh,
730- "tmt {context...} run --all -e TMT_SCRIPTS_DIR=/var/lib/tmt/scripts provision {how...} --port {ssh_port_str} --key {key_path} plan --name {plan }"
729+ "tmt {context...} run --all -e TMT_SCRIPTS_DIR=/var/lib/tmt/scripts provision {how...} --port {ssh_port_str} --key {key_path} tests --name {test }"
731730 )
732731 . run ( ) ;
733732
@@ -736,13 +735,13 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
736735
737736 match test_result {
738737 Ok ( _) => {
739- println ! ( "Plan {} completed successfully" , plan ) ;
740- test_results. push ( ( plan . to_string ( ) , true ) ) ;
738+ println ! ( "Test {} completed successfully" , test ) ;
739+ test_results. push ( ( test . to_string ( ) , true ) ) ;
741740 }
742741 Err ( e) => {
743- eprintln ! ( "Plan {} failed: {:#}" , plan , e) ;
742+ eprintln ! ( "Test {} failed: {:#}" , test , e) ;
744743 all_passed = false ;
745- test_results. push ( ( plan . to_string ( ) , false ) ) ;
744+ test_results. push ( ( test . to_string ( ) , false ) ) ;
746745 }
747746 }
748747
@@ -775,14 +774,14 @@ fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
775774 println ! ( "\n ========================================" ) ;
776775 println ! ( "Test Summary" ) ;
777776 println ! ( "========================================" ) ;
778- for ( plan , passed) in & test_results {
777+ for ( test_name , passed) in & test_results {
779778 let status = if * passed { "PASSED" } else { "FAILED" } ;
780- println ! ( "{}: {}" , plan , status) ;
779+ println ! ( "{}: {}" , test_name , status) ;
781780 }
782781 println ! ( "========================================\n " ) ;
783782
784783 if !all_passed {
785- anyhow:: bail!( "Some test plans failed" ) ;
784+ anyhow:: bail!( "Some tests failed" ) ;
786785 }
787786
788787 Ok ( ( ) )
0 commit comments