-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathmain_pods.pm
60 lines (47 loc) · 1.29 KB
/
main_pods.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 2019-2020 SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later
package main_pods;
use base 'Exporter';
use Exporter;
use testapi 'get_var';
use autotest;
use LTP::TestInfo 'testinfo';
use main_common qw(boot_hdd_image load_shutdown_tests);
use Mojo::File 'path';
use strict;
use warnings;
our @EXPORT = qw(parse_pod_list is_pod_test load_pod_tests);
sub loadtest_pod {
my ($test, %args) = @_;
autotest::loadtest("tests/qa_automation/$test.pm", %args);
}
sub parse_pod_list {
my $run_pods = get_var('TEST_POD_LIST');
my @pod_list;
if ($run_pods eq '*') {
my $path = get_var('CASEDIR') . '/tests/test_pods';
for my $file (@{path($path)->list}) {
push @pod_list, $file->basename if -x $file->stat;
}
}
else {
@pod_list = split /,/, $run_pods;
}
return \@pod_list;
}
sub is_pod_test {
return get_var('TEST_POD_LIST');
}
sub load_pod_tests {
my $pod_list = parse_pod_list;
boot_hdd_image;
my $tinfo = testinfo({}, test => $pod_list);
loadtest_pod('deploy_pods', run_args => $tinfo);
for my $pod (@$pod_list) {
$tinfo = testinfo({}, test => $pod);
my $title = $pod =~ s/\./_/gr;
loadtest_pod('run_pod', name => $title, run_args => $tinfo);
}
load_shutdown_tests;
}
1;