Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | # Copyright (C) 2019 Armin Kuster <akuster808@gmail.com> |
| 2 | # |
| 3 | import re |
| 4 | |
| 5 | from oeqa.runtime.case import OERuntimeTestCase |
| 6 | from oeqa.core.decorator.depends import OETestDepends |
| 7 | from oeqa.runtime.decorator.package import OEHasPackage |
| 8 | |
| 9 | |
| 10 | class SSSDTest(OERuntimeTestCase): |
| 11 | |
| 12 | @OEHasPackage(['sssd']) |
| 13 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 14 | def test_sssd_help(self): |
| 15 | status, output = self.target.run('sssctl --help') |
| 16 | msg = ('sssctl command does not work as expected. ' |
| 17 | 'Status and output:%s and %s' % (status, output)) |
| 18 | self.assertEqual(status, 1, msg = msg) |
| 19 | |
| 20 | @OETestDepends(['sssd.SSSDTest.test_sssd_help']) |
| 21 | def test_sssd_sssctl_conf_perms_chk(self): |
| 22 | status, output = self.target.run('sssctl domain-status') |
| 23 | match = re.search('ConfDB initialization has failed', output) |
| 24 | if match: |
| 25 | msg = ('sssctl domain-status failed, check sssd.conf perms. ' |
| 26 | 'Status and output:%s and %s' % (status, output)) |
| 27 | self.assertEqual(status, 0, msg = msg) |
| 28 | |
| 29 | @OETestDepends(['sssd.SSSDTest.test_sssd_sssctl_conf_perms_chk']) |
| 30 | def test_sssd_sssctl_deamon(self): |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 31 | status, output = self.target.run('sssctl domain-list') |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 32 | match = re.search('No domains configured, fatal error!', output) |
| 33 | if match: |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 34 | msg = ('sssctl domain-list failed, sssd.conf not setup correctly. ' |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 35 | 'Status and output:%s and %s' % (status, output)) |
| 36 | self.assertEqual(status, 0, msg = msg) |
| 37 | |