Skip to content

Commit

Permalink
test: Add comments to test case
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Jun 15, 2023
1 parent 2959ec0 commit ec72311
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions script/tests/test_encryption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -638,20 +638,26 @@ testJWE() {

MSG=$($CTR container rm testcontainer1 2>&1)
MSG=$($CTR snapshot rm testcontainer1 2>&1)

# Create testcontainer1 from encrypted bash image ${BASH_ENC}
# Creating the container without providing (right) key must fail
MSG=$(sudo $CTR container create ${BASH_ENC} testcontainer1 2>&1)
if [ $? -eq 0 ]; then
MSG=$($CTR container rm testcontainer1 2>&1)
MSG=$($CTR snapshot rm testcontainer1 2>&1)
failExit 1 "Should not have been able to create a container from encrypted image without passing keys"
fi
MSG=$($CTR snapshot rm testcontainer1 2>&1)

# creating the container when providing right key must work
MSG=$(sudo bash -c "$CTR container create \
--key ${PRIVKEYJWK} \
${BASH_ENC} testcontainer1 2>&1")
failExit $? "Should have been able to create a container from encrypted image when passing keys\n${MSG}"
MSG=$($CTR container rm testcontainer1 2>&1)
MSG=$($CTR snapshot rm testcontainer1 2>&1)

# running the container without providing (right) key must fail
MSG=$(sudo bash -c "$CTR run \
--rm \
${BASH_ENC} testcontainer1 echo 'Hello world'" 2>&1)
Expand All @@ -660,6 +666,8 @@ testJWE() {
failExit 1 "Should not have been able to run a container from encrypted image without passing keys"
fi
MSG=$($CTR snapshot rm testcontainer1 2>&1)

# Running the container when providing right key must work
MSG=$(sudo bash -c "$CTR run \
--key ${PRIVKEYJWK} \
--rm \
Expand Down

0 comments on commit ec72311

Please sign in to comment.