summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-10 09:14:48 +0530
committerArmin Kuster <akuster808@gmail.com>2019-05-09 17:45:13 -0700
commitf524ba9665416673372c491e1c2c924395ebce2e (patch)
treec4e7f822e47a16ed13a3aad13a836b651d558450 /lib
parent8eee8727cb09a9fc14e899b4058fcd108f44a0eb (diff)
downloadmeta-security-f524ba9665416673372c491e1c2c924395ebce2e.tar.gz
samhain: add more tests and fix ret checks
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/oeqa/runtime/cases/samhain.py31
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#
3import re 3import re
4import os
4 5
5from oeqa.runtime.case import OERuntimeTestCase 6from oeqa.runtime.case import OERuntimeTestCase
6from oeqa.core.decorator.depends import OETestDepends 7from 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)