aboutsummaryrefslogtreecommitdiffstats
path: root/t/emi_mandatory.t
blob: 49c3d0ad7af567ef12a3b07ba4626ddbc2e0e793 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Test ensuring packages are uploaded only if all mandatory arch have been built
# or are excluded.

use Test::Simple tests => 3;
use experimental 'smartmatch';

use Iurt::Emi;

my $config = { mandatory_arch => ['i586', 'x86_64'] };
my %pkg_tree = (
    '20160113183431.nobody.valstar.23515' => {
	'target' => cauldron,
	'media' => {
	    'core/release' => {
		'done_arch' => {
		    'x86_64' => 1,
		    'src' => 1
		},
		'rpms' => [
		    'iurt-test-package-debuginfo-1.4.0-2.mga6.x86_64.rpm',
		    '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
		    'iurt-test-package-1.4.0-2.mga6.x86_64.rpm'
		],
		'path' => '/cauldron/core/release',
	    }
	},
	'rpms' => [
	    'iurt-test-package-debuginfo-1.4.0-2.mga6.x86_64.rpm',
	    '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
	    'iurt-test-package-1.4.0-2.mga6.x86_64.rpm'
	    ]
    },
    '20160113183432.nobody.valstar.23515' => {
	'target' => cauldron,
	'media' => {
	    'core/release' => {
		'done_arch' => {
		    'i586' => 1,
		    'x86_64' => 1,
		    'src' => 1
		},
		'rpms' => [
		    'iurt-test-package-debuginfo-1.4.0-2.mga6.i586.rpm',
		    '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
		    'iurt-test-package-1.4.0-2.mga6.i586.rpm',
		    'iurt-test-package-debuginfo-1.4.0-2.mga6.x86_64.rpm',
		    'iurt-test-package-1.4.0-2.mga6.x86_64.rpm'
		],
		'path' => '/cauldron/core/release',
	    }
	},
	'rpms' => [
	    'iurt-test-package-debuginfo-1.4.0-2.mga6.i586.rpm',
	    'iurt-test-package-debuginfo-1.4.0-2.mga6.x86_64.rpm',
	    '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
	    'iurt-test-package-1.4.0-2.mga6.i586.rpm',
	    'iurt-test-package-1.4.0-2.mga6.x86_64.rpm'
	    ]
    },
    '20160113183433.nobody.valstar.23515' => {
	'target' => cauldron,
	'media' => {
	    'core/release' => {
		'done_arch' => {
		    'x86_64' => 1,
		    'src' => 1
		},
		'excluded_arch' => {
		    'i586' => 1
		},
		'rpms' => [
		    'iurt-test-package-debuginfo-1.4.0-2.mga6.x86_64.rpm',
		    '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
		    'iurt-test-package-1.4.0-2.mga6.x86_64.rpm'
		],
		'path' => '/cauldron/core/release',
	    }
	},
	'rpms' => [
	    'iurt-test-package-debuginfo-1.4.0-2.mga6.x86_64.rpm',
	    '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
	    'iurt-test-package-1.4.0-2.mga6.x86_64.rpm'
	    ]
    },
);

my %targets = find_prefixes_ready_to_upload($config, %pkg_tree);

# 20160113183431.nobody.valstar.23515 is not ready to upload, mandatory arch i586 is missing
ok(!('20160113183431.nobody.valstar.23515' ~~ @{$targets{cauldron}{'core/release'}{to_upload}}), 'mandatory architecture missing');
# 20160113183432.nobody.valstar.23515 is ready to upload, all arches are present
ok('20160113183432.nobody.valstar.23515' ~~ @{$targets{cauldron}{'core/release'}{to_upload}}, 'all mandatory architectures present');
# 20160113183433.nobody.valstar.23515 is ready to upload, i586 is excluded
ok('20160113183433.nobody.valstar.23515' ~~ @{$targets{cauldron}{'core/release'}{to_upload}}, 'mandatory architecture excluded');