aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@gmail.com>2016-10-05 23:34:53 +0100
committerPascal Terjan <pterjan@gmail.com>2016-10-05 23:34:53 +0100
commitfae9d6a04497446bd66d92a932259553d5f7c2fa (patch)
tree768412ced420f8fefd86a8e9a46a916b0985bfa0
parent7d61f22b33ed9e0d69412020c08babd60da51490 (diff)
downloadiurt-fae9d6a04497446bd66d92a932259553d5f7c2fa.tar
iurt-fae9d6a04497446bd66d92a932259553d5f7c2fa.tar.gz
iurt-fae9d6a04497446bd66d92a932259553d5f7c2fa.tar.bz2
iurt-fae9d6a04497446bd66d92a932259553d5f7c2fa.tar.xz
iurt-fae9d6a04497446bd66d92a932259553d5f7c2fa.zip
Add the test for previous fix
-rw-r--r--t/emi_finisher.t96
1 files changed, 96 insertions, 0 deletions
diff --git a/t/emi_finisher.t b/t/emi_finisher.t
new file mode 100644
index 0000000..d695d96
--- /dev/null
+++ b/t/emi_finisher.t
@@ -0,0 +1,96 @@
+use Test::More;
+use experimental 'smartmatch';
+
+my @commands;
+my @unlinked;
+
+BEGIN {
+ *CORE::GLOBAL::system = sub {
+ push @commands, @_;
+ return 0;
+ };
+ *CORE::GLOBAL::unlink = sub {
+ push @unlinked, @_;
+ return 1;
+ };
+}
+
+use Iurt::Emi;
+
+my $config = {
+ arch => ['i586', 'x86_64', 'armv5tl'],
+ mandatory_arch => ['i586', 'x86_64'],
+ queue => '.',
+};
+
+my %pkg_tree = (
+ '20160113183431.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',
+ 'iurt-test-package-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.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',
+ 'iurt-test-package-debuginfo-1.4.0-2.mga6.i586.rpm',
+ 'iurt-test-package-1.4.0-2.mga6.i586.rpm'
+ ],
+ 'srpms' => [
+ '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
+ ],
+ },
+ '20160113183432.nobody.valstar.23515' => {
+ 'target' => 'cauldron',
+ 'media' => {
+ 'core/release' => {
+ 'uploaded' => 1,
+ 'arch' => {
+ 'armv5tl' => 1,
+ 'i586' => 1,
+ 'x86_64' => 1,
+ 'src' => 1
+ },
+ 'rpms' => [
+ 'iurt-test-package-debuginfo-1.4.0-2.mga6.armv5tl.rpm',
+ 'iurt-test-package-1.4.0-2.mga6.armv5tl.rpm',
+ 'iurt-test-package-doc-1.4.0-2.mga6.noarch.rpm',
+ '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
+ ],
+ 'path' => '/cauldron/core/release',
+ }
+ },
+ 'rpms' => [
+ '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
+ 'iurt-test-package-debuginfo-1.4.0-2.mga6.armv5tl.rpm',
+ 'iurt-test-package-1.4.0-2.mga6.armv5tl.rpm',
+ 'iurt-test-package-doc-1.4.0-2.mga6.noarch.rpm',
+ ],
+ 'srpms' => [
+ '@922855:iurt-test-package-1.4.0-2.mga6.src.rpm',
+ ],
+ },
+);
+
+my %targets = find_prefixes_ready_to_upload($config, %pkg_tree);
+
+is($targets{'cauldron'}{'core/release'}{'arch_finisher'}{'i586'}, '20160113183431.nobody.valstar.23515');
+is($targets{'cauldron'}{'core/release'}{'arch_finisher'}{'x86_64'}, '20160113183431.nobody.valstar.23515');
+is($targets{'cauldron'}{'core/release'}{'arch_finisher'}{'armv5tl'}, '20160113183432.nobody.valstar.23515');
+ok(!$targets{'cauldron'}{'core/release'}{'arch_finisher'}{'noarch'});
+
+done_testing();