summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-01 13:57:24 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-01 14:08:31 +0200
commit11492f2e2adc07fce1e98e09c88ee518c8b448ac (patch)
tree60a6d706a56390d210774ae0d64b591d1d0cd075 /tests
parentac908aa749f9854a257f6d4957e1342a4db0e1f9 (diff)
downloadalpine-conf-11492f2e2adc07fce1e98e09c88ee518c8b448ac.zip
setup-user: avoid eternal loop on adduser failure
Make sure we dont loop forever if adduser fails to create the user. fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10519
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup_user_test15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/setup_user_test b/tests/setup_user_test
index 8213e02..03dd601 100755
--- a/tests/setup_user_test
+++ b/tests/setup_user_test
@@ -7,6 +7,7 @@ init_tests \
setup_user_interactive_no \
setup_user_interactive \
setup_user_interactive_fullname \
+ setup_user_interactive_fullname_existing \
setup_user_interactive_singlename \
setup_user_interactive_suggest_ssh \
setup_user_groups_commas \
@@ -74,6 +75,20 @@ setup_user_interactive_fullname_body() {
setup-user -f "Joe User" -k none <answers
}
+setup_user_interactive_fullname_existing_body() {
+ init_env
+ (
+ echo "existinguser"
+ echo "testuser"
+ ) >answers
+ ADDUSER_EXIST=existinguser atf_check -s exit:0 \
+ -o match:"Setup a user.*\[existinguser\]" \
+ -o match:"Setup a user.*\) adduser" \
+ -o match:"adduser.* -g existinguser .*testuser" \
+ -e match:"adduser: user 'existinguser' in use" \
+ setup-user -f "existinguser" -k none <answers
+}
+
setup_user_interactive_singlename_body() {
init_env
echo "" >answers