mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
testlib: Stop cockpit during teardown correctly and at the right time
We start Cockpit with Machine.start_cockpit, so we should stop it with Machine.stop_cockpit. This will correctly stop the container version of cockpit-ws. This is important to not keep the scsi_debug module busy. This happens sometimes, maybe only when a scsi_debug block device is mounted somewhere before the container is started. No idea, but stopping the container makes it possible to remove the module. Thus, cockpit needs to be stopped before trying to remove scsi_debug.
This commit is contained in:
parent
8bc4bac14f
commit
3c89c36af1
1 changed files with 5 additions and 4 deletions
|
|
@ -1936,10 +1936,6 @@ class MachineCase(unittest.TestCase):
|
|||
self.restore_file("/etc/fstab")
|
||||
self.restore_file("/etc/crypttab")
|
||||
|
||||
if not m.ws_container:
|
||||
# tests expect cockpit.service to not run at start; also, avoid log leakage into the next test
|
||||
self.addCleanup(m.execute, "systemctl stop --quiet cockpit")
|
||||
|
||||
# The sssd daemon seems to get confused when we restore
|
||||
# backups of /etc/group etc and stops following updates to it.
|
||||
# Let's restart the daemon to reset that condition.
|
||||
|
|
@ -1961,6 +1957,11 @@ class MachineCase(unittest.TestCase):
|
|||
" swapon --show=NAME --noheadings | grep $dev | xargs -r swapoff; "
|
||||
"done; until rmmod scsi_debug; do sleep 0.2; done", stdout=None)
|
||||
|
||||
# tests expect cockpit.service to not run at start; also, avoid log leakage into the next test
|
||||
# also also, the cockpit/ws container keeps scsi_debug busy,
|
||||
# so it needs to be stopped before the module cleanup above.
|
||||
self.addCleanup(lambda: m.stop_cockpit())
|
||||
|
||||
def _terminate_sessions(self) -> None:
|
||||
m = self.machine
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue