-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
users: Fix truncated "From" in account logs #21418
Changes from all commits
896f429
5dbbca0
8d5d4bf
8437bce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1079,14 +1079,26 @@ class TestAccounts(testlib.MachineCase): | |
m.execute("truncate -s0 /var/log/{[bw]tmp,lastlog} /run/utmp") | ||
m.execute("rm -f /var/lib/lastlog/lastlog2.db /var/lib/wtmpdb/wtmp.db") | ||
|
||
# Login once to create an entry | ||
self.login_and_go("/users") | ||
# First login: no entries yet | ||
self.login_and_go("/users#/admin") | ||
# just the header, nothing else | ||
b.wait_text("#account-logs", "Login history") | ||
self.assertFalse(b.is_present("#account-logs tr")) | ||
b.logout() | ||
|
||
year = m.execute("date +%Y").strip() | ||
|
||
# second login: one entry from the first one | ||
self.login_and_go("/users#/admin") | ||
b.wait_visible("#account-logs") | ||
# Header + one line of logins | ||
b.wait_js_func("ph_count_check", "#account-logs tr", 2) | ||
started = b.text("#account-logs [data-label='Started']") | ||
ended = b.text("#account-logs [data-label='Ended']") | ||
self.assertIn(year, started) | ||
self.assertIn(year, ended) | ||
Comment on lines
+1097
to
+1098
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This of course assumes that this test doesn't run at precisely mightnight on new year. But if you send a PR around that time, shame on you 😁 I tried to parse the shown date with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this comment it feels like "challenge accepted". But maybe more for dependabot :) |
||
self.assertGreaterEqual(ended, started) | ||
# this is the correct IP for our CI, and we don't run this on tmt | ||
b.wait_text("#account-logs [data-label='From']", "::ffff:172.27.0.2") | ||
|
||
def testGroups(self): | ||
b = self.browser | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was confused for a bit, why isn't this
-w
, but that's the same thing :) I guess for historical raisins.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer long options in code for better readability. But
-w
is the same thing indeed.