Skip to content

Commit

Permalink
Merge pull request #1013 from jikortus/reenable-luks-tests
Browse files Browse the repository at this point in the history
Fix & enable LUKS tests
  • Loading branch information
rvykydal authored Oct 13, 2023
2 parents fcdd0c9 + c96d7e3 commit 74a396a
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 24 deletions.
27 changes: 27 additions & 0 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,33 @@ copy_file_encrypted() {
run_with_timeout ${COPY_FROM_IMAGE_TIMEOUT} "guestfish --keys-from-stdin --ro ${disks} -i copy-out ${file} ${dir}"
}

copy_file_encrypted_raid() {
disks="$1"
file="$2"
dir="$3"

# we only assume 1 RAID device
md_device=$(run_with_timeout ${COPY_FROM_IMAGE_TIMEOUT} "guestfish --ro ${disks} launch : list-md-devices" 2>&1)
md_devices_count=$(wc -l <<< ${md_device})
echo "copy_file_encrypted_raid: md_device: ${md_device}"
if [ ${md_devices_count} -ne 1 ]; then
echo "Only 1 RAID device supported by encrypted_file_encrypted_raid()" > ${dir}/RESULT
echo -e "${md_devices_count} MD devices found:\n${md_device}" >> ${dir}/RESULT
exit 1
fi

# the here-string is unindented on purpose, as the passphrase can't contain leading spaces;
# it's not possible to use --key /dev/xyz:key:key_string, likely due to a bug?
run_with_timeout ${COPY_FROM_IMAGE_TIMEOUT} "guestfish --ro --keys-from-stdin ${disks}" <<< "
launch
# the line following after cryptsetup-open contains a LUKS passphrase
cryptsetup-open ${md_device} encrypted-root
passphrase
mount /dev/mapper/encrypted-root /
copy_out ${file} ${dir}
"
}

copy_interesting_files_from_system() {
local disksdir="$1"

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage lvm luks"
TESTTYPE="storage lvm luks"

. ${KSTESTDIR}/functions.sh

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage lvm luks"
TESTTYPE="storage lvm luks"

. ${KSTESTDIR}/functions.sh

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage lvm luks"
TESTTYPE="storage lvm luks"

. ${KSTESTDIR}/functions.sh

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage lvm luks"
TESTTYPE="storage lvm luks"

. ${KSTESTDIR}/functions.sh

Expand Down
4 changes: 1 addition & 3 deletions part-luks-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# On RHEL the test is manual because of broken reading of the results from image.
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="skip-on-rhel storage partition luks"
TESTTYPE="storage partition luks"

. ${KSTESTDIR}/functions.sh

Expand Down
4 changes: 1 addition & 3 deletions part-luks-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# On RHEL the test is manual because of broken reading of the results from image.
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="skip-on-rhel storage partition luks"
TESTTYPE="storage partition luks"

. ${KSTESTDIR}/functions.sh

Expand Down
4 changes: 1 addition & 3 deletions part-luks-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# On RHEL the test is manual because of broken reading of the results from image.
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="skip-on-rhel storage partition luks"
TESTTYPE="storage partition luks"

. ${KSTESTDIR}/functions.sh

Expand Down
4 changes: 1 addition & 3 deletions part-luks-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# On RHEL the test is manual because of broken reading of the results from image.
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="skip-on-rhel storage partition luks"
TESTTYPE="storage partition luks"

. ${KSTESTDIR}/functions.sh

Expand Down
4 changes: 2 additions & 2 deletions raid-luks-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage raid luks"
TESTTYPE="storage raid luks"

. ${KSTESTDIR}/functions.sh

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}
4 changes: 2 additions & 2 deletions raid-luks-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage raid luks"
TESTTYPE="storage raid luks"

. ${KSTESTDIR}/functions.sh

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}
4 changes: 2 additions & 2 deletions raid-luks-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage raid luks"
TESTTYPE="storage raid luks"

. ${KSTESTDIR}/functions.sh

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}
4 changes: 2 additions & 2 deletions raid-luks-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Check the results on the running VM.
# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="manual storage raid luks"
TESTTYPE="storage raid luks"

. ${KSTESTDIR}/functions.sh

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}

0 comments on commit 74a396a

Please sign in to comment.