Merge pull request #21858 from yuwata/fix-test-home

test: workaround for TEST-46-HOMED
This commit is contained in:
Luca Boccassi
2021-12-22 16:14:53 +00:00
committed by GitHub
3 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -383,7 +383,7 @@ static int handle_generic_user_record_error(
else if (sd_bus_error_has_name(error, BUS_ERROR_AUTHENTICATION_LIMIT_HIT))
return log_error_errno(SYNTHETIC_ERRNO(ETOOMANYREFS),
"Too frequent unsuccessful login attempts for user %s, try again later.", user_name);
"Too frequent login attempts for user %s, try again later.", user_name);
else if (sd_bus_error_has_name(error, BUS_ERROR_BAD_PASSWORD)) {
+1 -1
View File
@@ -293,7 +293,7 @@ static int handle_generic_user_record_error(
return PAM_PERM_DENIED;
} else if (sd_bus_error_has_name(error, BUS_ERROR_AUTHENTICATION_LIMIT_HIT)) {
(void) pam_prompt(handle, PAM_ERROR_MSG, NULL, "Too frequent unsuccessful login attempts for user %s, try again later.", user_name);
(void) pam_prompt(handle, PAM_ERROR_MSG, NULL, "Too frequent login attempts for user %s, try again later.", user_name);
pam_syslog(handle, LOG_ERR, "Failed to acquire home for user %s: %s", user_name, bus_error_message(error, ret));
return PAM_MAXTRIES;
+22
View File
@@ -26,6 +26,13 @@ inspect() {
homectl inspect --json=pretty "$USERNAME"
}
wait_for_state() {
for ((i=0;i<10;i++)) ; do
homectl inspect "$1" | grep -qF "State: $2" && break
sleep .5
done
}
systemd-analyze log-level debug
systemd-analyze log-target console
systemctl service-log-level systemd-homed debug
@@ -146,18 +153,33 @@ if ! systemd-detect-virt -cq ; then
inspect test-user2
fi
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; }
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; }
wait_for_state test-user inactive
homectl remove test-user
if ! systemd-detect-virt -cq ; then
wait_for_state test-user2 active
homectl deactivate test-user2
wait_for_state test-user2 inactive
homectl remove test-user2
fi
systemd-analyze log-level info
echo OK >/testok