Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This testsuites tests the autorestart policy for |
| 3 | ... OpenBMC project |
| 4 | |
| 5 | Resource ../lib/resource.txt |
| 6 | |
| 7 | Library SSHLibrary |
| 8 | Suite Setup Open Connection And Log In |
| 9 | Suite Teardown Close All Connections |
| 10 | |
| 11 | *** Test Cases *** |
| 12 | Test OpenBMC Services Autorestart Policy |
| 13 | [Documentation] This testcases is for checking all the openbmc services |
| 14 | ... restart policy is set to active |
| 15 | @{services}= Create List obmc-mapper.service |
| 16 | ... obmc-rest.service |
| 17 | ... btbridged.service |
| 18 | ... host-ipmi-bt.service |
| 19 | ... host-ipmi-hw-example.service |
| 20 | ... host-ipmid.service |
| 21 | ... obmc-phosphor-chassisd.service |
| 22 | ... obmc-phosphor-event.service |
| 23 | ... obmc-phosphor-example-pydbus.service |
| 24 | ... obmc-phosphor-example-sdbus.service |
| 25 | ... obmc-phosphor-fand.service |
| 26 | ... obmc-phosphor-flashd.service |
| 27 | ... obmc-phosphor-policyd.service |
| 28 | ... obmc-phosphor-sensord.service |
| 29 | ... obmc-phosphor-sysd.service |
| 30 | ... rest-dbus.service |
| 31 | ... skeleton.service |
| 32 | : FOR ${SERVICE} IN @{services} |
| 33 | \ Check Service Autorestart ${SERVICE} |
| 34 | |
| 35 | Test Restart Policy for openbmc service |
| 36 | [Documentation] This testcase will kill the service and make sure it |
| 37 | ... does restart after that |
| 38 | ${MainPID} ${stderr} ${rc}= Execute new Command systemctl -p MainPID show skeleton.service| cut -d = -f2 |
| 39 | Should Not Be Equal 0 ${MainPID} |
| 40 | ${stdout} ${stderr} ${rc}= Execute new Command kill -9 ${MainPID} |
| 41 | Sleep 30s Wait for service to restart properly |
| 42 | ${ActiveState} ${stderr} ${rc}= Execute new Command systemctl -p ActiveState show skeleton.service| cut -d = -f2 |
| 43 | Should Be Equal active ${ActiveState} |
| 44 | ${MainPID} ${stderr} ${rc}= Execute new Command systemctl -p MainPID show skeleton.service| cut -d = -f2 |
| 45 | Should Not Be Equal 0 ${MainPID} |
| 46 | |
| 47 | *** Keywords *** |
| 48 | Check Service Autorestart |
| 49 | [arguments] ${servicename} |
| 50 | ${restart_policy} ${stderr} ${rc}= Execute new command systemctl -p Restart show ${servicename} | cut -d = -f2 |
| 51 | Should Be Equal always ${restart_policy} restart policy is npt always for ${servicename} |
| 52 | |
| 53 | Execute new Command |
| 54 | [arguments] ${command} |
| 55 | ${stdout} ${stderr} ${rc}= Execute Command ${command} return_stderr=True return_rc=True |
| 56 | [Return] ${stdout} ${stderr} ${rc} |
| 57 | |
| 58 | Open Connection And Log In |
| 59 | Open connection ${OPENBMC_HOST} |
| 60 | Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |