cockpit-project / cockpit

Cockpit is a web-based graphical interface for servers.
http://www.cockpit-project.org/
GNU Lesser General Public License v2.1
11.2k stars 1.11k forks source link

test: Fix handling of "closing" sessions in TestSession.testBasic #20439

Closed martinpitt closed 5 months ago

martinpitt commented 5 months ago

Despite multiple attempts/claims at fixing this, logind still often has empty "State: closing" sessions after logout, without any processes in it [1]. Our generic nondestructive test cleanup in testlib's terminate_sessions() has a workaround for this (restarting logind). Do the same in this test.

Only do this when waiting for the session to go away; starting new sessions should work fine.

Fixes #20379

[1] https://github.com/systemd/systemd/issues/26744


I could reproduces this rather well locally. Now it has survived two parallel loops of

for i in `seq 20`; do TEST_OS=arch test/verify/check-session -s $RUNC || break; done