diff options
author | Nick Hanley <nicholasjhanley@gmail.com> | 2022-07-07 18:54:14 -0400 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-07-12 11:51:19 +0000 |
commit | a7b906d81470edeec05cf95000fb86235a304b3e (patch) | |
tree | bf51b2189e7c08612b3661c1a7f369319fa4291e /tests | |
parent | 1e2bb841117bed5c37c708f699cc0953c2343ed6 (diff) | |
download | alpine-conf-a7b906d81470edeec05cf95000fb86235a304b3e.zip |
tests: setup-alpine: match against whole lines
Be more strict in checking the contents of files by matching against the
whole line. This prevents tests from passing with extraneous leading or
trailing characters, or partial paths matching in lbu.list.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/setup_alpine_test | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test index 3ed6d79..1bde901 100755 --- a/tests/setup_alpine_test +++ b/tests/setup_alpine_test @@ -44,14 +44,14 @@ setup_alpine_create_answerfile_body() { -o match:"adduser" \ -o match:"apk add.*openssh" \ setup-alpine -f answers - grep "ssh-rsa blahbla user@example.com" home/juser/.ssh/authorized_keys \ + grep -x "ssh-rsa blahbla user@example.com" home/juser/.ssh/authorized_keys \ || atf_fail "ssh key not set for juser" - grep "ssh-rsa blahbla user@example.com" root/.ssh/authorized_keys \ + grep -x "ssh-rsa blahbla user@example.com" root/.ssh/authorized_keys \ || atf_fail "ssh key not set for root" - grep home/juser etc/apk/protected_paths.d/lbu.list \ - || atf_fail "home/juser was not added to lbu.list" - grep root/.ssh/authorized_keys etc/apk/protected_paths.d/lbu.list \ - || atf_fail "root/.ssh/authorized_keys was not added to lbu.list" + for file in home/juser root/.ssh/authorized_keys; do + grep -x "+.*$file" etc/apk/protected_paths.d/lbu.list \ + || atf_fail "$file was not added to lbu.list" + done } setup_alpine_kvm_clock_body() { |