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

Apply new structure for yast modules #7317

Merged
merged 1 commit into from
May 16, 2019

Conversation

b10n1k
Copy link
Contributor

@b10n1k b10n1k commented Apr 23, 2019

Following the proposed diagram we try to apply a structure that will be more tiny and clean for the test modules. The old y2_common, y2x11test, console_yasttest and y2logsstep have been renamed to present their purpose.
the new y2_common now is the base class of the old y2x11test and console_yasttest. In additional the y2logsstep has been removed as base class and it is use Exporter to be imported into the corresponding modules.

With decooupling in mind there is a new NetworkHelper module with code extracted by y2x11test.

Unfortunately, the post_fail_hook is defined in many installation modules. This is not fixed for now as the changes are already kind of big and we can work on them in a follow up task after this has been approved. Also the new lib/y2_logs_helper.pm might need some kind of cleanup to have delicate functions to logs as i dont know how related are some functions defined in it(see select_conflict_resolution)

@b10n1k b10n1k force-pushed the poo46676 branch 7 times, most recently from 272d1a1 to d9d3eb9 Compare April 23, 2019 11:56
@asmorodskyi
Copy link
Member

asmorodskyi commented Apr 25, 2019

your PR having conflicts so you need to rebase , taking into account how many files it touches it will have conflicts unless it will be merged 2 hours after rebasing :) So I suggest you pick up one person with merge rights seat together in conference tool of your choice and do review and merge it immediately ( in case it will pass review of course :) ) otherwise you will spent a lot of time on rebasing ....
taking into account quantity of touched files I also recommend not to merge it before SLE/openSUSE 15 SP1 release

lib/y2_guitest.pm Outdated Show resolved Hide resolved
@@ -10,9 +10,10 @@
# Summary: Type in registration information
# Maintainer: Martin Kravec <mkravec@suse.com>

use base 'installbasetest';
use y2_logs_helper;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if that is right, as y2_logs_helper is new y2logsstep, but with your change postfail_hooks, etc. will be called from installbasetest. y2logsstep mainly contains things for the YaST installer. As per proposal we should have gotten y2_install_base_test instead and have it as a parent class instead of y2logsstep.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am not sure why caasp jobs needs to use the post_fail_hook. the y2_install_base_test meant for yast tests. althought as it is now it simplify the logic and can be modified accordingly

Copy link
Member

Choose a reason for hiding this comment

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

Point is, we don't want to change behavior of the code, we only change the structure. Previously, post_fail_hook would be executed from lib/y2logsstep.pm, with this change, it will be executed from installbasetest. So it's change in the behavior. From the proposal we should have y2_installbasetest (not sure about naming), which should include relevant parts from current y2logsstep. And common parts can be moved somewhere else, like to the helper you have created.
Hope it's more clear now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clear enough. let me take care of it

lib/Utils/NetworkHelper.pm Outdated Show resolved Hide resolved
lib/Utils/NetworkHelper.pm Outdated Show resolved Hide resolved
@b10n1k b10n1k force-pushed the poo46676 branch 3 times, most recently from e97fbb6 to 1cb5ee5 Compare April 26, 2019 06:11
Copy link
Contributor Author

@b10n1k b10n1k left a comment

Choose a reason for hiding this comment

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

@rwx788 i moved the %setup_nis_nfs_x11 back to the y2_guitest and the setup_static_mm_network to the mm_network and i adjusted the imports accordingly

lib/Utils/NetworkHelper.pm Outdated Show resolved Hide resolved
@@ -10,9 +10,10 @@
# Summary: Type in registration information
# Maintainer: Martin Kravec <mkravec@suse.com>

use base 'installbasetest';
use y2_logs_helper;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am not sure why caasp jobs needs to use the post_fail_hook. the y2_install_base_test meant for yast tests. althought as it is now it simplify the logic and can be modified accordingly

@b10n1k b10n1k force-pushed the poo46676 branch 12 times, most recently from 27ecec8 to 473e5ff Compare April 30, 2019 06:31
lib/y2_installbase.pm Outdated Show resolved Hide resolved
@@ -18,7 +18,8 @@

use strict;
use warnings;
use base 'y2logsstep';
use base 'opensusebasetest';
use y2_logs_helper;
Copy link
Member

Choose a reason for hiding this comment

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

Same as before, this changes behavior, we should use lib/y2_installbase here as parent, in general for most of the files that should be the only change, one parent class to another, other changes should not be required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@b10n1k b10n1k force-pushed the poo46676 branch 11 times, most recently from ca630f3 to 004b15d Compare May 10, 2019 11:44

use strict;
use warnings;
use testapi;
use version_utils qw(is_opensuse is_leap is_tumbleweed);
use y2_logs_helper;
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we do not need the import of 'y2_logs_helper' here, as no functions from it are used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -19,7 +19,8 @@ use Exporter 'import';
use testapi;
use utils 'systemctl';
use version_utils qw(is_sle is_leap);
use y2_common 'accept_warning_network_manager_default';
use y2_module_basetest 'accept_warning_network_manager_default';
use y2_module_consoletest;
Copy link
Contributor

Choose a reason for hiding this comment

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

y2_module_consoletest is inherited from y2_module_basetest. Maybe importing of y2_module_consoletest will be enough?

Same question for the following modules:

  • tests/console/lvm_thin_check.pm
  • tests/console/validate_lvm_encrypt.pm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i agree with the logic. y2_module_consoletest is not needed anyway. so i have removed it

@@ -35,7 +35,7 @@ sub run {
configure_static_dns(get_host_resolv_conf());
zypper_call 'in yast2-iscsi-lio-server';
assert_script_run 'dd if=/dev/zero of=/root/iscsi-disk seek=1M bs=8192 count=1'; # create iscsi LUN
my $module_name = y2logsstep::yast2_console_exec(yast2_module => 'iscsi-lio-server');
my $module_name = y2_module_consoletest::yast2_console_exec(yast2_module => 'iscsi-server');
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you've changed the needle here to fail post_fail_hook. Please do not forget to revert it back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

lib/y2_module_consoletest.pm Show resolved Hide resolved
use Exporter 'import';


our @EXPORT_OK = qw(select_conflict_resolution workaround_dependency_issues break_dependency process_unsigned_files deal_with_dependency_issues verify_license_has_to_be_accepted accept_license verify_license_translations get_available_compression);
Copy link
Contributor

Choose a reason for hiding this comment

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

The functions:

  • process_unsigned_files
  • deal_with_dependency_issues

do no exist in y2_logs_helper anymore. Please, remove them from the @EXPORT_OK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch. fixed

use y2_logs_helper qw(get_available_compression);
use Exporter 'import';

our @EXPORT_OK = qw(save_upload_y2logs save_system_logs save_strace_gdb_output process_unsigned_files deal_with_dependency_issues);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess there is no need to export the functions as static ones as all of them are class methods and require $self for the call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

save_upload_y2logs;
upload_logs('/var/log/zypper.log', failok => 1);
save_system_logs;
save_strace_gdb_output('yast');
Copy link
Contributor

Choose a reason for hiding this comment

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

The functions called without $self:

  • save_upload_y2logs
  • save_system_logs
  • save_strace_gdb_output

It will cause an error. Please, search for:
post_fail_hook failed: Can't call method "investigate_yast2_failure" on an undefined value at /var/lib/openqa/pool/10/os-autoinst-distri-opensuse/lib/y2_installbase.pm line 190.

to see the example in the verification run logs: https://openqa.suse.de/tests/2886984/file/autoinst-log.txt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

y2logsstep::yast2_console_exec(yast2_module => 'lan');
accept_warning_network_manager_default;
y2_module_consoletest::yast2_console_exec(yast2_module => 'lan');
type_string "Y2DEBUG=1 ZYPP_MEDIA_CURL_DEBUG=1 yast2 \n";
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct me if I'm wrong but it seems like the line
type_string "Y2DEBUG=1 ZYPP_MEDIA_CURL_DEBUG=1 yast2 \n";

came to your branch after you made a merge. I guess we do not need it here to avoid conflicts while merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

verify_license_translations unless is_sle('15+');
}
accept_license;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please correct me if I'm wrong, but it seems like the changes also came from the merge and should not be presented in your PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

very likely. i will try to fix it

@b10n1k b10n1k force-pushed the poo46676 branch 4 times, most recently from 8917969 to 009b685 Compare May 13, 2019 16:54
@b10n1k b10n1k force-pushed the poo46676 branch 6 times, most recently from 9ced051 to 4df02ac Compare May 14, 2019 13:08
@OleksandrOrlov OleksandrOrlov merged commit 90dddc1 into os-autoinst:master May 16, 2019
@DimStar77
Copy link
Contributor

DimStar77 commented May 20, 2019

Seems to cause an error in Tumbleweed:

e.g. https://openqa.opensuse.org/tests/938053#step/yast2_lan_restart/24

# Test died: Undefined subroutine &y2_module_consoletest::yast2_console_exec called at /var/lib/openqa/cache/openqa1-opensuse/tests/opensuse/lib/y2lan_restart_common.pm line 53.

@ldevulder
Copy link
Member

taking into account quantity of touched files I also recommend not to merge it before SLE/openSUSE 15 SP1 release

Weird, it has been merged before release of 15-SP1... I hope that there will be no impact :)

@b10n1k b10n1k deleted the poo46676 branch August 24, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants