From 6a8d34bb6882bd393a9c09bd3006a55059dc7b31 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Fri, 29 Mar 2019 09:50:39 +0100 Subject: [PATCH] [IMP] runbot: add a small test for the _ask_kill method The previous commit 574105b fixed the fact that killing a duplicate was not possible. This commit adds a small test to avoid regression. --- runbot/tests/test_build.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runbot/tests/test_build.py b/runbot/tests/test_build.py index 39b5a4d7..71d28306 100644 --- a/runbot/tests/test_build.py +++ b/runbot/tests/test_build.py @@ -174,6 +174,7 @@ class TestClosestBranch(common.TransactionCase): Test that the creation of a build on branch1 and branch2 detects duplicate, no matter the order. Also test that build on branch1 closest_branch_name result is b1_closest if given Also test that build on branch2 closest_branch_name result is b2_closest if given + Test that the _ask_kill method works on duplicate """ closest = { branch1: b1_closest, @@ -200,6 +201,11 @@ class TestClosestBranch(common.TransactionCase): self.assertEqual(build2.duplicate_id.id, build1.id, "build on %s wasn't detected as duplicate of build on %s" % (self.branch_description(b2), self.branch_description(b1))) self.assertEqual(build2.state, 'duplicate') + self.assertEqual(build1.state, 'pending') + build2._ask_kill() + self.assertEqual(build1.state, 'done', 'A killed pending duplicate build should mark the real build as done') + self.assertEqual(build1.result, 'skipped', 'A killed pending duplicate build should mark the real build as skipped') + def setUp(self): """ Setup repositories that mimick the Odoo repos """ super(TestClosestBranch, self).setUp()