aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();