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

New tests and changes to handle YaST's new libstorage #3409

Closed
wants to merge 9 commits into from

Conversation

cwh42
Copy link
Contributor

@cwh42 cwh42 commented Aug 14, 2017

No description provided.

# SUSE's openQA tests
#
# Copyright © 2009-2013 Bernhard M. Wiedemann
# Copyright © 2012-2016 SUSE LLC
Copy link
Member

Choose a reason for hiding this comment

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

Please only use current year

# without any warranty.

# Summary: Use guided partitioning setup to delete an existing windows partition.
# Maintainer: cwh
Copy link
Member

Choose a reason for hiding this comment

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

Can you use an email instead?



use warnings;
use parent qw(y2logsstep);
Copy link
Member

Choose a reason for hiding this comment

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

Please use single ticks for single value imports

# Enter guided setup
send_key "alt-g";

assert_screen('inst-partition-guided', 10);
Copy link
Member

Choose a reason for hiding this comment

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

Just assert_screen with default timeout should be fine

}

sub run() {
my $self = shift;
Copy link
Member

Choose a reason for hiding this comment

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

Just delete if you don't use it

assert_screen "inst-overview-booting";

# preserve it for the video
wait_idle 10;
Copy link
Member

Choose a reason for hiding this comment

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

delete

# without any warranty.
#
#
# Summary:
Copy link
Member

Choose a reason for hiding this comment

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

That's not a very convincing summary ;-)

assert_and_click 'hard-disks';
assert_and_click 'home';

send_key 'alt-d'; # Delete
Copy link
Member

Choose a reason for hiding this comment

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

I guess this might fail because the next keypress might get lost. Better guard it with wait_screen_change -> wait_screen_change { send_key 'alt-d' };

save_screenshot;

send_key $cmd{accept};
die "/home still there" if check_screen('home');
Copy link
Member

Choose a reason for hiding this comment

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

Please don't use check_screen with default timeout. Either surround the previous send_key with wait_screen_change or use a multi-tag assert_screen plus match_has_tag

my $numdisks = get_var("NUMDISKS");
print "NUMDISKS = $numdisks\n";

check_screen([qw(inst-partition-radio-buttons inst-partition-guided inst-partitioning-scheme)], 10);
Copy link
Member

Choose a reason for hiding this comment

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

Please don't use check_screen with timeout other than 0. Either surround the previous send_key with wait_screen_change or use a multi-tag assert_screen plus match_has_tag

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 just extended the existing code, here. So that check_screen …, 10; already was there, before.
Maybe it is worth rewriting the old code anyway?

Copy link
Member

Choose a reason for hiding this comment

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

yes

@okurz
Copy link
Member

okurz commented Aug 14, 2017

Delete dot at end-of-line of commit message subject lines and PR messages

@@ -32,6 +32,21 @@ sub run {
assert_screen "inst-xen-pattern";
}

# preserve it for the video
wait_idle 10;
Copy link
Member

Choose a reason for hiding this comment

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

You can use wait_still_screen instead.

elsif (get_var("STORAGE_NG")) {
if ($numdisks <= 1) {
die "Guided workflow does not skip disk selection when only one disk!"
if !match_has_tag('inst-partitioning-scheme');
Copy link
Member

Choose a reason for hiding this comment

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

Matter of taste, but it's more wordy to use "unless" here and get rid of negation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For my personal taste actually an "if not" is more obvious than a "unless" – but if ther is any convention about this, I will of course change it.

Copy link
Member

Choose a reason for hiding this comment

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

Nope, that's why I say that it's matter of taste, so no change is really required. Only point that negated expressions usually are evaluated a little slower, but probably unless does it anyway underneath.

Copy link
Member

Choose a reason for hiding this comment

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

just use "unless" :-)

Copy link
Contributor Author

@cwh42 cwh42 Aug 16, 2017

Choose a reason for hiding this comment

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

Acually, when reading Damian Conway's "Perl Best Practices" I learned, that using negative modifiers like unless and until should be avoided as much as possible. See #13 in http://www.perlmonks.org/?node_id=989115

Copy link
Member

Choose a reason for hiding this comment

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

It's all subjective, but I totally agree with subpoints: Use unless and until only with positive statements so you don't create a double negative logic, which would be twice as confusing! Never follow an unless block with an else block.
If it's used in that way that you can read it in plain English, like "die unless" it's more wordy than "die if not", which is totally perlish and is confusing for some people. I'm fine if we are just consistent, so I do not request a change here. And thanks for the link, it's nice article!

}
else {
die "Guided workflow does skip disk selection when more than one disk! (NUMDISKS=$numdisks)"
if !match_has_tag('inst-partition-guided');
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 above.


if (!get_var('ENCRYPT_ACTIVATE_EXISTING')) {
assert_screen 'inst-encrypt-password-prompt';
#send_key 'tab'; # might be needed again later
Copy link
Member

Choose a reason for hiding this comment

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

Probably we can remove this one

#send_key 'tab'; # might be needed again later
type_password;
send_key 'tab';
type_password;
Copy link
Member

Choose a reason for hiding this comment

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

Here is a little tricky part, as what we have seen sometimes that we press keys to fast and for example start typing password before we got into password field. But let's see if we experience this issue.

@cwh42
Copy link
Contributor Author

cwh42 commented Aug 15, 2017

Integrated your proposed changes

@cwh42 cwh42 changed the title New tests and changes to handle YaST's new libstorage. New tests and changes to handle YaST's new libstorage Aug 15, 2017

if (get_var("STORAGE_NG") && get_var("ENCRYPT")) {
my @tags = ();
for ( my $disk = 0; $disk < get_var("NUMDISKS", 1); $disk++ ) {
Copy link
Member

Choose a reason for hiding this comment

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

Travis complains about spaces after and before brackets.

@cwh42 cwh42 force-pushed the master branch 3 times, most recently from 3909015 to a658f87 Compare August 16, 2017 14:54
@cwh42
Copy link
Contributor Author

cwh42 commented Aug 16, 2017

The setup of perlcritic here in travis is different than when run locally on my and Rodion's machine.
I wasted half a day of debugging here until I found the problem because the error message contains a line number but not the file where the error is found.

@okurz
Copy link
Member

okurz commented Aug 17, 2017 via email

@rwx788
Copy link
Member

rwx788 commented Aug 17, 2017

@okurz We did exactly this and it looks like it uses different profile. In the end main point here is that it's not clear about which file travis is complaining about, otherwise it's ok to fix results after pushing the commit.

@okurz
Copy link
Member

okurz commented Aug 17, 2017

squashed and merged locally, approved by @rwx788

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants