forked from kushaldas/tunirtests
/
cloudtests.py
33 lines (25 loc) · 1.02 KB
/
cloudtests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest
from testutils import system, if_atomic
class TestBase(unittest.TestCase):
@unittest.expectedFailure
def test_selinux(self):
"Tests the SELinux"
out, err, eid = system('sudo getenforce')
out = out.strip()
self.assertEquals(out, 'Enforcing')
def test_logging(self):
"Tests journald logging"
out, err, eid = system('sudo journalctl -a --no-pager -r --since=$(date +%Y-%m-%d) -n1')
self.assertGreater(len(out.split()), 3, "journalctl output is missing.")
def test_services(self):
"No service should fail in the startup."
out, err, eid = system('systemctl --all --failed')
self.assertIn('0 loaded units listed', out)
@unittest.skipIf(if_atomic(), "It is an Atomic image.")
def test_packageinstall(self):
"Tests package install using dnf"
system('dnf install pss -y')
out, err, eid = system('ls -l /usr/bin/pss')
self.assertIn('root', out)
if __name__ == '__main__':
unittest.main()