Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix & enable LUKS tests #1013

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be useful to report what devices were found.

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part-luks-* are failing for me for rhel, (I've just run them locally on rhel9 and all failed with RESULT not found). That is why I enabled them only on Fedora. Are they stable for you? I wonder if it can be just my environment (even though the tests are run in container)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work fine for me:

$ ./containers/runner/launch part-luks-1 -p rhel9
...

TEST                                                    | RESULT     | EXPLANATION
--------------------------------------------------------+------------+-------------------------------------------
part-luks-1                                             | SUCCESS    | 

===================================================================================================================================
Test suite for kickstart tests summary:
===================================================================================================================================
# TOTAL:      1
# PASS:       1
# FAILED:     0
# TIMED OUT:  0
===================================================================================================================================


+ exit 0
$ file data/images/boot.iso 
data/images/boot.iso: ISO 9660 CD-ROM filesystem data (DOS/MBR boot sector) 'RHEL-9-3-0-BaseOS-x86_64' (bootable)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I've just realized that my kstest runner container is 17 months (!) old. Let me try with something more recent :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it works with current container!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let's enable the tests and see. If they show up unstable again, we can disable them. I won't do any harm.

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 "$@"
}