Module: check_mk
Branch: master
Commit: 99c7121bc4143cba2ab513d3dc2a12d3501eca34
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=99c7121bc4143c…
Author: Florian Kromer <fk(a)mathias-kettner.de>
Date: Thu Feb 7 10:04:16 2019 +0100
mk_logwatch: make unit test deterministic
Change-Id: I98b29128331349b6ad89249689fc46d13d431c28
---
tests/unit/agents/plugins/test_mk_logwatch.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/unit/agents/plugins/test_mk_logwatch.py
b/tests/unit/agents/plugins/test_mk_logwatch.py
index 4c7f8a6..9d307d0 100644
--- a/tests/unit/agents/plugins/test_mk_logwatch.py
+++ b/tests/unit/agents/plugins/test_mk_logwatch.py
@@ -191,6 +191,7 @@ def test_read_status(tmpdir):
# execution
actual_status = mk_logwatch.read_status(file_path)
+ # comparing dicts (having unordered keys) is ok
assert actual_status == {
'/var/log/messages': (7767698, 32455445),
'/var/test/x12134.log': (12345, 32444355)
@@ -206,6 +207,6 @@ def test_save_status(tmpdir):
'/var/test/x12134.log': (12345, 32444355)
}
mk_logwatch.save_status(fake_status, file_path)
- assert fake_status_file.read() ==
"""/var/log/messages|7767698|32455445
-/var/test/x12134.log|12345|32444355
-"""
+ assert sorted(fake_status_file.read().splitlines()) == [
+ '/var/log/messages|7767698|32455445',
'/var/test/x12134.log|12345|32444355'
+ ]