cockpit-project / cockpit

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

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

Closed martinpitt closed 1 month ago

martinpitt commented 1 month 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