Skip to content

Commit b6aeb69

Browse files
committed
tests: Use remove_all_snapshots in local keys tests to clear cache
Add calls to remove_all_snaphots in local keys tests to avoid decrypted layers caching effects. This now requires an update of the ocicrypt library for the test to work since previously cached layers were used and no actual decryption was done when pkcs11 was used. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
1 parent 1d572d4 commit b6aeb69

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

script/tests/test_encryption.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ testLocalKeys() {
830830
failExit $? "Should have been able to create a container from encrypted image when local keys exists (JWE)\n${MSG}"
831831
MSG=$($CTR container rm testcontainer1 2>&1)
832832
MSG=$($CTR snapshot rm testcontainer1 2>&1)
833+
remove_all_snapshots
833834

834835
rm -f ${LOCAL_KEYS_PATH}/*
835836

@@ -839,13 +840,12 @@ testLocalKeys() {
839840
done
840841

841842
echo "Testing creation of container from encrypted image with local keys (PKCS11)"
842-
MSG=$($CTR container rm testcontainer1 2>&1)
843-
MSG=$($CTR snapshot rm testcontainer1 2>&1)
844843
MSG=$(sudo $CTR container create --skip-decrypt-auth ${ALPINE_ENC} testcontainer1 2>&1)
845844

846845
failExit $? "Should have been able to create a container from encrypted image when local keys exists (PKCS11)\n${MSG}"
847846
MSG=$($CTR container rm testcontainer1 2>&1)
848847
MSG=$($CTR snapshot rm testcontainer1 2>&1)
848+
remove_all_snapshots
849849

850850
$CTR images rm --sync ${ALPINE_ENC} &>/dev/null
851851
echo "Encryption with ${recipient1} and ${recipient2} and decrypting with local unpack keys worked"
@@ -865,6 +865,7 @@ testLocalKeys() {
865865

866866
MSG=$($CTR container rm testcontainer1 2>&1)
867867
MSG=$($CTR snapshot rm testcontainer1 2>&1)
868+
remove_all_snapshots
868869

869870
# Create testcontainer1 from encrypted bash image ${BASH_ENC}
870871
# Creating the container without providing (right) key must fail

0 commit comments

Comments
 (0)