@@ -714,6 +714,7 @@ subtest '[qesap_cluster_logs]' => sub {
714714 my $qesap = Test::MockModule-> new(' qesapdeployment' , no_auto => 1);
715715 my @ansible_calls ;
716716 my @crm_report_calls ;
717+ my @supportconfig_log_calls ;
717718 my @save_file_calls ;
718719 my @logfile_calls ;
719720 $qesap -> redefine(qesap_ansible_script_output_file => sub {
@@ -728,6 +729,7 @@ subtest '[qesap_cluster_logs]' => sub {
728729 $qesap -> redefine(upload_logs => sub { push @save_file_calls , $_ [0]; return ; });
729730 $qesap -> redefine(qesap_cluster_log_cmds => sub { return ({Cmd => ' crm status' , Output => ' crm_status.txt' }); });
730731 $qesap -> redefine(qesap_upload_crm_report => sub { my (%args ) = @_ ; push @crm_report_calls , $args {host }; return 0; });
732+ $qesap -> redefine(qesap_upload_supportconfig_logs => sub { my (%args ) = @_ ; push @supportconfig_log_calls , $args {host }; return 0; });
731733 my $cloud_provider = ' NEMO' ;
732734 set_var(' PUBLIC_CLOUD_PROVIDER' , $cloud_provider );
733735
@@ -736,13 +738,15 @@ subtest '[qesap_cluster_logs]' => sub {
736738 set_var(' PUBLIC_CLOUD_PROVIDER' , undef );
737739 note(" \n ANSIBLE_CMD--> " . join (" \n ANSIBLE_CMD--> " , @ansible_calls ));
738740 note(" \n CRM_REPORT--> " . join (" \n CRM_REPORT--> " , @crm_report_calls ));
741+ note(" \n SUPPORTCONFIG_LOG--> " . join (" \n SUPPORTCONFIG_LOG--> " , @supportconfig_log_calls ));
739742 note(" \n SAVE_FILE--> " . join (" \n SAVE_FILE--> " , @save_file_calls ));
740743 note(" \n LOG_FILES--> " . join (" \n LOG_FILES--> " , @logfile_calls ));
741744 ok((any { / crm status/ } @ansible_calls ), ' expected command executed remotely' );
742745 ok((any { / .*hana0-crm_status\. txt/ } @logfile_calls ), ' qesap_ansible_script_output_file called with the expected vmhana01 log file' );
743746 ok((any { / .*hana1-crm_status\. txt/ } @logfile_calls ), ' qesap_ansible_script_output_file called with the expected vmhana02 log file' );
744747 ok((any { / .*BOUBLE.*/ } @save_file_calls ), ' upload_logs is called with whatever filename returned by qesap_ansible_script_output_file' );
745- ok((any { / hana\[ [0-1]\] / } @crm_report_calls ), ' upload_logs properly call qesap_upload_crm_report with hostnames' );
748+ ok((any { / hana\[ [0-1]\] / } @crm_report_calls ), ' upload_logs properly calls qesap_upload_crm_report with hostnames' );
749+ ok((any { / hana\[ [0-1]\] / } @supportconfig_log_calls ), ' upload_logs properly calls qesap_upload_supportconfig_logs with hostnames' );
746750};
747751
748752subtest ' [qesap_cluster_logs] multi log command' => sub {
@@ -761,6 +765,7 @@ subtest '[qesap_cluster_logs] multi log command' => sub {
761765 $qesap -> redefine(upload_logs => sub { return ; });
762766 $qesap -> redefine(qesap_cluster_log_cmds => sub { return ({Cmd => ' crm status' , Output => ' crm_status.txt' , Logs => [' ignore_me.txt' , ' ignore_me_too.txt' ]}); });
763767 $qesap -> redefine(qesap_upload_crm_report => sub { return 0; });
768+ $qesap -> redefine(qesap_upload_supportconfig_logs => sub { return 0; });
764769 my $cloud_provider = ' NEMO' ;
765770 set_var(' PUBLIC_CLOUD_PROVIDER' , $cloud_provider );
766771
@@ -822,6 +827,55 @@ subtest '[qesap_upload_crm_report] ansible host query' => sub {
822827 ok((any { / vmhana01\- crm_report\. tar/ } @fetch_filename ), ' crm report fetch file is properly formatted' );
823828};
824829
830+ subtest ' [qesap_upload_supportconfig_logs] die for missing mandatory arguments' => sub {
831+ dies_ok { qesap_upload_supportconfig_logs(); } " Expected die if called without arguments" ;
832+ dies_ok { qesap_upload_supportconfig_logs(provider => ' SAND' ); } " Expected die if called without host" ;
833+ dies_ok { qesap_upload_supportconfig_logs(host => ' SALT' ); } " Expected die if called without provider" ;
834+ };
835+
836+ subtest ' [qesap_upload_supportconfig_logs]' => sub {
837+ my $qesap = Test::MockModule-> new(' qesapdeployment' , no_auto => 1);
838+ my @calls ;
839+
840+ $qesap -> redefine(is_sle => sub { return 0; });
841+ $qesap -> redefine(qesap_ansible_cmd => sub {
842+ my (%args ) = @_ ;
843+ push @calls , $args {cmd };
844+ return 0; });
845+ $qesap -> redefine(qesap_ansible_fetch_file => sub { return 0; });
846+ $qesap -> redefine(upload_logs => sub { return 0; });
847+
848+ qesap_upload_supportconfig_logs(provider => ' SAND' , host => ' SALT' );
849+
850+ note(" \n C--> " . join (" \n C--> " , @calls ));
851+ ok((any { / .*supportconfig \- R.*/ } @calls ), ' supportconfig is called' );
852+ ok((any { / .*\/ var\/ tmp\/ SALT\- supportconfig/ } @calls ), ' supportconfig log file has the node name in it' );
853+ };
854+
855+ subtest ' [qesap_upload_supportconfig_logs] ansible host query' => sub {
856+ my $qesap = Test::MockModule-> new(' qesapdeployment' , no_auto => 1);
857+ my @calls ;
858+ my @fetch_filename ;
859+
860+ $qesap -> redefine(is_sle => sub { return 0; });
861+ $qesap -> redefine(qesap_ansible_cmd => sub {
862+ my (%args ) = @_ ;
863+ push @calls , $args {cmd };
864+ return 0; });
865+ $qesap -> redefine(qesap_ansible_fetch_file => sub {
866+ my (%args ) = @_ ;
867+ push @fetch_filename , $args {file };
868+ return 0; });
869+ $qesap -> redefine(upload_logs => sub { return 0; });
870+
871+ qesap_upload_supportconfig_logs(provider => ' SAND' , host => ' hana[0]' );
872+
873+ note(" \n C--> " . join (" \n C--> " , @calls ));
874+ note(" \n FETCH_FILENAME--> " . join (" \n FETCH_FILENAME--> " , @fetch_filename ));
875+ ok((any { / .*\/ var\/ tmp\/ vmhana01\- supportconfig/ } @calls ), ' supportconfig log file has the node name in it' );
876+ ok((any { / vmhana01\- supportconfig/ } @fetch_filename ), ' supportconfig log fetch file is properly formatted' );
877+ };
878+
825879subtest ' [qesap_calculate_deployment_name]' => sub {
826880 my $qesap = Test::MockModule-> new(' qesapdeployment' , no_auto => 1);
827881 $qesap -> redefine(get_current_job_id => sub { return 42; });
0 commit comments