@@ -27,35 +27,33 @@ sub run {
2727
2828 my ($version , $sp , $host_distri ) = get_os_release;
2929 # Skip HELM tests on SLES <15-SP3 and on PPC, where k3s is not available
30- return if (!($host_distri == " sles" && $version == 15 && $sp >= 3) || is_ppc64le || check_var(' CONTAINER_RUNTIMES' , ' k8s' ));
30+ return if (!($host_distri == " sles" && $version == 15 && $sp >= 3) || is_ppc64le);
31+ die " helm tests only work on k3s" unless (check_var(' CONTAINER_RUNTIMES' , ' k3s' ));
32+
33+ my $helm_chart = get_required_var(' HELM_CHART' );
3134
32- systemctl ' stop firewalld' ;
33- ensure_ca_certificates_suse_installed();
34- install_k3s();
3535 install_kubectl();
3636 install_helm();
3737
38- my $curl_options = " -sSL --retry 3 --retry-delay 30" ;
39-
40- my $helm_chart = get_var(' HELM_CHART' , ' https://github.com/SUSE/helm-charts/archive/refs/heads/main.tar.gz' );
41- # pull in the testsuite
42- assert_script_run(" curl $curl_options $helm_chart | tar -zxf -" );
43- my $helm_values = get_var(' HELM_CONFIG' , ' https://gitlab.suse.de/QA-APAC-I/testing/-/raw/master/data/rmtcontainer/myvalue.yaml' );
44- assert_script_run(" curl $curl_options -O $helm_values " );
38+ # Pull helm chart, if it is a http file
39+ if ($helm_chart =~ m ! ^http(s?)://! ) {
40+ my ($url , $path ) = split (/ #/ , $helm_chart , 2); # split extracted folder path, if present
41+ assert_script_run(" curl -sSL --retry 3 --retry-delay 30 $url | tar -zxf -" );
42+ $helm_chart = $path ? " ./$path " : " ." ;
43+ }
44+ my $helm_values = get_var(' HELM_CONFIG' );
45+ assert_script_run(" curl -sSL --retry 3 --retry-delay 30 -o myvalue.yaml $helm_values " ) if ($helm_values );
4546 my ($repository , $tag ) = split (' :' , get_required_var(' CONTAINER_IMAGE_TO_TEST' ), 2);
4647 my $set_options = " --set app.image.repository=$repository --set app.image.tag=$tag " ;
4748 my $helm_options = " --debug" ;
48- assert_script_run(" helm install $set_options rmt ./helm-charts-main/rmt-helm -f myvalue.yaml $helm_options " );
49+ $helm_options = " -f myvalue.yaml $helm_options " if ($helm_values );
50+ assert_script_run(" helm install $set_options rmt $helm_chart $helm_options " );
4951 assert_script_run(" helm list" );
50- sleep 20; # Wait until images are downloaded
51- my @out = split (' ' , script_output(" kubectl get pods | grep rmt-app" ));
52- my $counter = 0;
53- while ($counter ++ < 50) {
54- sleep 20;
55- my $logs = script_output(" kubectl logs $out [0]" , proceed_on_failure => 1);
56- last if ($logs =~ / All repositories have already been enabled/ );
57- }
58- assert_script_run(" kubectl exec $out [0] -- rmt-cli repos list" );
52+ sleep 60; # Wait until images are downloaded
53+ my @rmts = split (' ' , script_output(" kubectl get pods | grep rmt-app" ));
54+ my $rmtapp = $rmts [0];
55+ validate_script_output_retry(" kubectl logs $rmtapp " , sub { m / All repositories have already been enabled/ }, retry => 30, timeout => 60, delay => 60);
56+ assert_script_run(" kubectl exec $rmtapp -- rmt-cli repos list" );
5957 assert_script_run(' test $(kubectl get pods --field-selector=status.phase=Running | grep -c rmt) -eq 3' );
6058}
6159
@@ -64,7 +62,6 @@ sub post_fail_hook {
6462 script_run(' tar -capf /tmp/containers-logs.tar.xz /var/log/pods $(find /var/lib/rancher/k3s -name \*.log -name \*.toml)' );
6563 upload_logs(" /tmp/containers-logs.tar.xz" );
6664 script_run(" helm delete rmt" );
67- uninstall_k3s() if $self -> {is_k3s };
6865}
6966
7067sub test_flags {
0 commit comments