Skip to content

Commit

Permalink
Add validation to cryptlvm+cancel_existing scenario
Browse files Browse the repository at this point in the history
The https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/10744/files#diff-02e3850fe36faeb4fe731d27cdf08818
returns an error code 4 when the encryption is not activated. Passing the proceed_on_failure so we can run assertions even
if the script_output gets the error code.
  • Loading branch information
b10n1k committed Aug 10, 2020
1 parent cc6865f commit f5bc12f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/validate_encrypt_utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sub parse_devices_in_crypttab {

sub parse_cryptsetup_status {
my ($dev) = @_;
my @lines = split(/\n/, script_output("cryptsetup status $dev"));
my @lines = split(/\n/, script_output("cryptsetup status $dev", proceed_on_failure => 1));
my $status = {};
foreach (@lines) {
if (!exists $status->{message} && $_ =~ /is (in)?active/) {
Expand Down Expand Up @@ -65,7 +65,7 @@ sub verify_number_of_encrypted_devices {

sub verify_cryptsetup_message {
my ($expected_message, $actual_message) = @_;
record_info("active volumes", "Verify crypted volume is active");
record_info("Assert volumes status", "Verify crypted volume status based on test_data expectations");
assert_matches(qr/$expected_message/, $actual_message,
"Message of cryptsetup status does not match regex");
}
Expand Down
3 changes: 3 additions & 0 deletions schedule/yast/encryption/cryptlvm+cancel_existing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ schedule:
- installation/accept_license
- installation/scc_registration
- installation/encrypted_volume_activation
- console/validate_unencrypted_partition
- installation/addon_products_sle
- installation/system_role
- installation/partitioning
Expand All @@ -32,3 +33,5 @@ schedule:
- installation/grub_test
- installation/boot_encrypt
- installation/first_boot
test_data:
<<: !include test_data/yast/encryption/cryptlvm+cancel_existing.yaml
3 changes: 3 additions & 0 deletions schedule/yast/encryption/cryptlvm+cancel_existing_pvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ schedule:
- installation/accept_license
- installation/scc_registration
- installation/encrypted_volume_activation
- console/validate_unencrypted_partition
- installation/addon_products_sle
- installation/system_role
- installation/partitioning
Expand All @@ -33,3 +34,5 @@ schedule:
- installation/grub_test
- installation/boot_encrypt
- installation/first_boot
test_data:
<<: !include test_data/yast/encryption/cryptlvm+cancel_existing.yaml
3 changes: 3 additions & 0 deletions test_data/yast/encryption/cryptlvm+cancel_existing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mapped_device: '/dev/mapper/cr-auto-2'
device_status:
message: 'is inactive.'
31 changes: 31 additions & 0 deletions tests/console/validate_unencrypted_partition.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SUSE's openQA tests
#
# Copyright © 2020 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: Validation module to check that partition is inactive.
# Covered scenarios:
# - Validate that there are no encrypted partition activated
#
# Maintainer: QA SLE YaST team <qa-sle-yast@suse.de>

use strict;
use warnings;
use base "installbasetest";
use scheduler 'get_test_suite_data';
use testapi;
use validate_encrypt_utils;

sub run {
my $test_data = get_test_suite_data();
select_console 'install-shell';
my $status = parse_cryptsetup_status($test_data->{mapped_device});
verify_cryptsetup_message($test_data->{device_status}->{message}, $status->{message});
select_console 'installation';
}

1;

0 comments on commit f5bc12f

Please sign in to comment.