aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@gmail.com>2016-01-24 00:29:52 +0000
committerPascal Terjan <pterjan@gmail.com>2016-01-24 00:44:36 +0000
commit17761a28681612c11fcb62091625790810782971 (patch)
tree50bf4988a0f606cf31bff6b04734cf15962e89fd /t
parent86865c84d1e5e79da91a5afb3e6d1cc64b85334b (diff)
downloadiurt-17761a28681612c11fcb62091625790810782971.tar
iurt-17761a28681612c11fcb62091625790810782971.tar.gz
iurt-17761a28681612c11fcb62091625790810782971.tar.bz2
iurt-17761a28681612c11fcb62091625790810782971.tar.xz
iurt-17761a28681612c11fcb62091625790810782971.zip
Add a first test!
Diffstat (limited to 't')
-rw-r--r--t/emi_mandatory.t94
1 files changed, 94 insertions, 0 deletions
diff --git a/t/emi_mandatory.t b/t/emi_mandatory.t
new file mode 100644
index 0000000..e50d328
--- /dev/null
+++ b/t/emi_mandatory.t
@@ -0,0 +1,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' => {
+ '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' => {
+ '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' => {
+ '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'}}));
+# 20160113183432.nobody.valstar.23515 is ready to upload, all arches are present
+ok('20160113183432.nobody.valstar.23515' ~~ @{$targets{'cauldron'}{'core/release'}{'to_upload'}});
+# 20160113183433.nobody.valstar.23515 is ready to upload, i586 is excluded
+ok('20160113183433.nobody.valstar.23515' ~~ @{$targets{'cauldron'}{'core/release'}{'to_upload'}});