diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oeqa/runtime/cases/samhain.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/lib/oeqa/runtime/cases/samhain.py b/lib/oeqa/runtime/cases/samhain.py index e4bae7b..5043a38 100644 --- a/lib/oeqa/runtime/cases/samhain.py +++ b/lib/oeqa/runtime/cases/samhain.py | |||
@@ -1,6 +1,7 @@ | |||
1 | # Copyright (C) 2019 Armin Kuster <akuster808@gmail.com> | 1 | # Copyright (C) 2019 Armin Kuster <akuster808@gmail.com> |
2 | # | 2 | # |
3 | import re | 3 | import re |
4 | import os | ||
4 | 5 | ||
5 | from oeqa.runtime.case import OERuntimeTestCase | 6 | from oeqa.runtime.case import OERuntimeTestCase |
6 | from oeqa.core.decorator.depends import OETestDepends | 7 | from oeqa.core.decorator.depends import OETestDepends |
@@ -11,10 +12,32 @@ class SamhainTest(OERuntimeTestCase): | |||
11 | 12 | ||
12 | @OEHasPackage(['samhain-standalone']) | 13 | @OEHasPackage(['samhain-standalone']) |
13 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 14 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
14 | def test_samhain_standalone_help(self): | 15 | def test_samhain_help(self): |
16 | machine = self.td.get('MACHINE', '') | ||
17 | status, output = self.target.run('echo "127.0.0.1 %s.localdomain %s" >> /etc/hosts' % (machine, machine)) | ||
18 | msg = ("samhain can't append hosts. " | ||
19 | 'Status and output:%s and %s' % (status, output)) | ||
20 | self.assertEqual(status, 0, msg = msg) | ||
21 | |||
15 | status, output = self.target.run('samhain --help') | 22 | status, output = self.target.run('samhain --help') |
16 | match = re.search('Please report bugs to support@la-samhna.de.', output) | 23 | msg = ('samhain command does not work as expected. ' |
24 | 'Status and output:%s and %s' % (status, output)) | ||
25 | self.assertEqual(status, 0, msg = msg) | ||
26 | |||
27 | @OETestDepends(['samhain.SamhainTest.test_samhain_help']) | ||
28 | def test_samhain_init_db(self): | ||
29 | status, output = self.target.run('samhain -t init') | ||
30 | match = re.search('FAILED: 0 ', output) | ||
31 | if not match: | ||
32 | msg = ('samhain database init had an unexpected failure. ' | ||
33 | 'Status and output:%s and %s' % (status, output)) | ||
34 | self.assertEqual(status, 0, msg = msg) | ||
35 | |||
36 | @OETestDepends(['samhain.SamhainTest.test_samhain_init_db']) | ||
37 | def test_samhain_db_check(self): | ||
38 | status, output = self.target.run('samhain -t check') | ||
39 | match = re.search('FAILED: 0 ', output) | ||
17 | if not match: | 40 | if not match: |
18 | msg = ('samhain-standalone command does not work as expected. ' | 41 | msg = ('samhain errors found in db. ' |
19 | 'Status and output:%s and %s' % (status, output)) | 42 | 'Status and output:%s and %s' % (status, output)) |
20 | self.assertEqual(status, 1, msg = msg) | 43 | self.assertEqual(status, 0, msg = msg) |