Skip to content

Commit

Permalink
tests: add test for delete-if-present and append-if-missing
Browse files Browse the repository at this point in the history
when there is existing `key`
  • Loading branch information
HuijingHei committed Dec 20, 2023
1 parent 32d6d26 commit 419fc98
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/vmcheck/test-kernel-args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ vm_rpmostree kargs --delete-if-present=PACKAGE3=TEST3 --unchanged-exit-77 || rc=
assert_streq $rc 77
echo "ok exit 77 when unchanged kargs with unchanged-exit-77"

# Test append-if-missing and delete-if-present for existing key
vm_rpmostree kargs --append-if-missing=PACKAGE3=TEST3
vm_rpmostree kargs > kargs.txt
assert_file_has_content_literal kargs.txt 'PACKAGE3=TEST3'
rpm-ostree kargs --append-if-missing=PACKAGE3=NEWTEST
vm_rpmostree kargs > kargs.txt
assert_file_has_content_literal kargs.txt 'PACKAGE3=NEWTEST'
rpm-ostree kargs --delete-if-present=PACKAGE3=TEST || rc=$?
assert_streq $rc 0
vm_rpmostree kargs --delete-if-present=PACKAGE3=TEST3

# Test for 'rpm-ostree kargs --editor'.
vm_rpmostree kargs > kargs.txt
assert_not_file_has_content_literal kargs.txt 'nonexisting'
Expand Down

0 comments on commit 419fc98

Please sign in to comment.