-
Notifications
You must be signed in to change notification settings - Fork 223
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
diff_package_list in Rex::Pkg::Redhat, for multiple pks with same name #1620
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,13 @@ use warnings; | |
|
||
our $VERSION = '9999.99.99_99'; # VERSION | ||
|
||
use Test::More tests => 3; | ||
use Test::More tests => 4; | ||
use Test::Warnings; | ||
use Test::Deep; | ||
use Test::Exception; | ||
|
||
use Rex::Pkg::Test; | ||
use Rex::Pkg::Redhat; | ||
|
||
my $pkg = Rex::Pkg::Test->new; | ||
|
||
|
@@ -62,4 +63,94 @@ subtest 'local package installation' => sub { | |
lives_ok { $pkg->update('test_package') }, 'update test package'; | ||
}; | ||
|
||
subtest 'redhat package list diffs' => sub { | ||
plan tests => 1; | ||
|
||
my $rh_pkg = Rex::Pkg::Redhat->new; | ||
|
||
## no critic (ProhibitDuplicateLiteral) | ||
|
||
my @before = ( | ||
{ | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'lzo', | ||
release => '8.el7', | ||
version => '2.06', | ||
}, | ||
{ | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'postgresql-server', | ||
release => '1.el7', | ||
version => '9.2.18', | ||
}, | ||
{ | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'kernel', | ||
release => '427.26.1.el9_4', | ||
version => '5.14.0', | ||
}, | ||
); | ||
|
||
my @after = ( | ||
{ | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'postgresql-server', | ||
release => '1.el7', | ||
version => '9.2.19', | ||
}, | ||
{ | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'kernel', | ||
release => '427.28.1.el9_4', | ||
version => '5.14.0', | ||
}, | ||
{ | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'kernel', | ||
release => '427.26.1.el9_4', | ||
version => '5.14.0', | ||
}, | ||
); | ||
|
||
my @expected = ( | ||
{ | ||
action => 'updated', | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'postgresql-server', | ||
release => '1.el7', | ||
version => '9.2.19', | ||
}, | ||
{ | ||
action => 'installed', | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'kernel', | ||
release => '427.28.1.el9_4', | ||
version => '5.14.0', | ||
}, | ||
{ | ||
action => 'removed', | ||
arch => 'x86_64', | ||
epoch => '0', | ||
name => 'lzo', | ||
release => '8.el7', | ||
version => '2.06', | ||
}, | ||
); | ||
|
||
## use critic | ||
|
||
my @mods = $rh_pkg->diff_package_list( \@before, \@after ); | ||
|
||
cmp_bag( \@mods, \@expected, | ||
'expected package modifications on Red Hat compatible distros' ); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more note overall: we seem to aim fixing |
||
|
||
1; |
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.
Nitpick: the other instantiation of a Rex::Pkg class is outside the test cases, and this introduces a different convention.
Long run I'm fine with both, depending where the evolution of
t/package.t
takes us over time. Normally I would lean towards consistency, while it's also fine for now to not know exactly which approach will serve us best later (so we allow ourselves to decide later.)It may not be necessary to discover the answer or fix it now, I just thought it's worth mentioning while reading the changes carefully.