Skip to content

Commit

Permalink
test: adjust list-sessions for systemd 256 changes
Browse files Browse the repository at this point in the history
In systemd 256 list-session now also includes a manager session:

4 1000 admin -    538    user          web console no   -
5 1000 admin -    544    manager       -           no   -
  • Loading branch information
jelly committed May 15, 2024
1 parent 3d45a02 commit 74cfb92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/verify/check-session
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class TestSession(testlib.MachineCase):

# Check session type
if not m.ostree_image:
session_id = m.execute("loginctl list-sessions | awk '/admin/ {print $1}'").strip()
# Systemd 256 also shows a class=manager session for admin
session_id = m.execute("loginctl list-sessions | grep -v manager | awk '/admin/ {print $1}'").strip()
self.assertEqual(m.execute(f"loginctl show-session -p Type {session_id}").strip(), "Type=web")

# Logout
Expand Down
3 changes: 3 additions & 0 deletions test/verify/check-static-login
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,9 @@ matchrule = <SUBJECT>^DC=LAN,DC=COCKPIT,CN=alice$
self.assertGreaterEqual(len(sessions), 1)
for session in sessions:
out = m.execute('loginctl session-status ' + session)
# Skip manager session
if "Class: manager" in out:
continue
if "State: active" in out: # skip closing sessions
self.assertIn(session_leader, out)
self.assertIn('cockpit-bridge', out)
Expand Down

0 comments on commit 74cfb92

Please sign in to comment.