65598582f5
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=179
55 lines
2.0 KiB
Diff
55 lines
2.0 KiB
Diff
From 09a871c197be4933475ee4582755d9b0cb5a700e Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
|
<psuarezhernandez@suse.com>
|
|
Date: Wed, 4 Mar 2020 10:13:43 +0000
|
|
Subject: [PATCH] Fix unit tests for batch async after refactor
|
|
|
|
---
|
|
tests/unit/cli/test_batch_async.py | 20 +++++++++++++++++++-
|
|
1 file changed, 19 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/tests/unit/cli/test_batch_async.py b/tests/unit/cli/test_batch_async.py
|
|
index b04965268a..dcee9a87bd 100644
|
|
--- a/tests/unit/cli/test_batch_async.py
|
|
+++ b/tests/unit/cli/test_batch_async.py
|
|
@@ -120,9 +120,10 @@ class AsyncBatchTestCase(AsyncTestCase, TestCase):
|
|
self.batch.timedout_minions = {"bar"}
|
|
self.batch.event = MagicMock()
|
|
self.batch.metadata = {"mykey": "myvalue"}
|
|
+ old_event = self.batch.event
|
|
self.batch.end_batch()
|
|
self.assertEqual(
|
|
- self.batch.event.fire_event.call_args[0],
|
|
+ old_event.fire_event.call_args[0],
|
|
(
|
|
{
|
|
"available_minions": {"foo", "bar"},
|
|
@@ -140,6 +141,23 @@ class AsyncBatchTestCase(AsyncTestCase, TestCase):
|
|
event = MagicMock()
|
|
batch.event = event
|
|
batch.__del__()
|
|
+ self.assertEqual(batch.local, None)
|
|
+ self.assertEqual(batch.event, None)
|
|
+ self.assertEqual(batch.ioloop, None)
|
|
+
|
|
+ def test_batch_close_safe(self):
|
|
+ batch = BatchAsync(MagicMock(), MagicMock(), MagicMock())
|
|
+ event = MagicMock()
|
|
+ batch.event = event
|
|
+ batch.patterns = {
|
|
+ ("salt/job/1234/ret/*", "find_job_return"),
|
|
+ ("salt/job/4321/ret/*", "find_job_return"),
|
|
+ }
|
|
+ batch.close_safe()
|
|
+ self.assertEqual(batch.local, None)
|
|
+ self.assertEqual(batch.event, None)
|
|
+ self.assertEqual(batch.ioloop, None)
|
|
+ self.assertEqual(len(event.unsubscribe.mock_calls), 2)
|
|
self.assertEqual(len(event.remove_event_handler.mock_calls), 1)
|
|
|
|
@tornado.testing.gen_test
|
|
--
|
|
2.29.2
|
|
|
|
|