-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add validation to self_update and no_self_update scenarios #10908
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright © 2020 SUSE LLC | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, see <http://www.gnu.org/licenses/>. | ||
|
||
# Summary: Validate installer self update is not attempted when explicitly disabled | ||
# Maintainer: QA SLE YaST <qa-sle-yast@suse.de> | ||
|
||
use base 'y2_installbase'; | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
|
||
sub run { | ||
my $self = shift; | ||
select_console('install-shell'); | ||
assert_script_run('test -z "$(ls -A /download)"', | ||
fail_message => '/download directory is NOT empty, expected to be empty as no updates should be downloaded'); | ||
assert_script_run('! grep /var/log/YaST2/y2log -e "Trying installer update"', | ||
fail_message => 'YaST logs contain entry that self update was attempted, but is explicitly disabled'); | ||
select_console('installation'); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright © 2020 SUSE LLC | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, see <http://www.gnu.org/licenses/>. | ||
|
||
# Summary: Validate installer self update feature downloads updates and applies | ||
# them to the system | ||
# Maintainer: QA SLE YaST <qa-sle-yast@suse.de> | ||
|
||
use base 'y2_installbase'; | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
|
||
sub run { | ||
my $self = shift; | ||
select_console('install-shell'); | ||
my $self_update_repo = get_required_var('INSTALLER_SELF_UPDATE'); | ||
assert_script_run("grep /var/log/YaST2/y2log -e '$self_update_repo'", | ||
fail_message => 'Expected to have log entries that self update repo was contacted'); | ||
assert_script_run('test -n "$(ls -A /download)"', | ||
fail_message => '/download directory is empty, expected to contain downloaded updates'); | ||
assert_script_run('mount | grep -P "/download/yast_\d+"', | ||
fail_message => 'updates are not mounted, expected /download/yast_* to be mounted as /mount/yast_*'); | ||
select_console('installation'); | ||
} | ||
|
||
1; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can i ask you to try the usage of --files-without-match. i kinda dislike the use of
!
when there is another way, so it makes the expression more readable. For instancegrep /var/log/YaST2/y2log --files-without-match -e "Trying installer update"
it greps what files do not have the expression "..." and returns0
if file found have it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I need to check how exactly that flag works, because the idea is that finds files that do not contain this string, so I'm not 100% sure if it will return
0
in case no files found. Let me try it out.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow
grep -L 'Trying installer update' /var/log/YaST2/y2log
gives1
as a return code, even though it lists/var/log/YaST2/y2log
as file without that string. Feels like a bug to me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the only thing I can propose here is to rewrite this line with
script_run
and compare return code in perl code directly. Do you think this is better than negation of the bash command?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you still need the
-e
flag. Can you try?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command I've used is equivalent to
grep /var/log/YaST2/y2log -L -e 'BLA'
so result is same, and as you can see on the screenshot it works just fine and returns the file, as it doesn't contain the string. I will check if that's expected, and file the bug against grep.