From 2ee4edc6e5c6a0715bcf317b1457c67b19fba2c3 Mon Sep 17 00:00:00 2001 From: Aleksandr Berkuta Date: Mon, 2 Jun 2025 11:24:37 +0300 Subject: [PATCH] Add tests for passwd and hashed_passwd user-data parameters --- tests/tiny-cloud-alpine.test | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/tiny-cloud-alpine.test b/tests/tiny-cloud-alpine.test index cef4a67..8e950aa 100755 --- a/tests/tiny-cloud-alpine.test +++ b/tests/tiny-cloud-alpine.test @@ -30,6 +30,8 @@ init_tests \ userdata_users_system \ userdata_users_no_create_home \ userdata_users_groups \ + userdata_users_passwd \ + userdata_users_hashed_passwd \ userdata_users_lock_passwd \ userdata_users_doas \ userdata_users_ssh_authorized_keys \ @@ -384,6 +386,38 @@ userdata_users_groups_body() { tiny-cloud main } +userdata_users_passwd_body() { + # first specified user will replace default user + fake_userdata_nocloud <<-EOF + #alpine-config + users: + - none + - name: foo + passwd: $6$foosalt$QuhZ.r54aqCAn7mTnU4jBh9LPyuVQCa8.H0dZWCMYHVaNzsPX/heqKqI3EtnB6j.YLuaENmnlEHTiwu.iVVcG1 + EOF + atf_check -e ignore -o ignore tiny-cloud early + atf_check \ + -e match:"userdata_users: done" \ + -o match:"chpasswd -e" \ + tiny-cloud main +} + +userdata_users_hashed_passwd_body() { + # first specified user will replace default user + fake_userdata_nocloud <<-EOF + #alpine-config + users: + - none + - name: foo + hashed_passwd: $6$foosalt$QuhZ.r54aqCAn7mTnU4jBh9LPyuVQCa8.H0dZWCMYHVaNzsPX/heqKqI3EtnB6j.YLuaENmnlEHTiwu.iVVcG1 + EOF + atf_check -e ignore -o ignore tiny-cloud early + atf_check \ + -e match:"userdata_users: done" \ + -o match:"chpasswd -e" \ + tiny-cloud main +} + userdata_users_lock_passwd_body() { # first specified user will replace default user fake_userdata_nocloud <<-EOF