Bug 772622 - [rfe] rlAssertRpm --all
Summary: [rfe] rlAssertRpm --all
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Martin Kyral
QA Contact:
URL:
Whiteboard:
: 534026 (view as bug list)
Depends On: 772178 893064
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-09 13:13 UTC by Martin Cermak
Modified: 2013-05-22 03:08 UTC (History)
7 users (show)

Fixed In Version: beakerlib-1.7-1.fc19
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-05-22 03:08:41 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Martin Cermak 2012-01-09 13:13:27 UTC
Description of problem:

   Please, provide --checkrequires (or some similar) switch to the rlAssertRpm
   function. This switch should cause rlAssertRpm to check all packages that
   are required by given test.

Comment 1 Lukáš Zachar 2012-02-15 15:48:24 UTC
Please extend the check for environment variable $COLLECTIONS and variable $PACKAGE as well. Or an another switch (e.g. --all) would be nice to have as well.

Rationale: 

Environment variable $COLLECTIONS will hold runtime information about which Collections are used in the test. 

If the variable is empty it should be ignored.

This would allow to modify all existing test without adding manual checks for required packages, where specific versions of scl_ packages will be known just after the test schedule.

Comment 3 Petr Muller 2013-01-08 12:40:30 UTC
It's not that simple, especially when collections come into play. The Makefile 'Requires:' does not need to be all installed: it only says to Beaker that is should install all packages available from the "Requires:" list. We do not have a source from where we could determine hard deps for a test. And when you run with collections, some of the Requires: stop being dependencies (because their functionality is provided by the collection. But you cannot distinguish these from proper hard deps.

In such environment, there's really nothing much we can do.

Comment 4 Petr Šplíchal 2013-01-18 13:57:16 UTC
Currently I'm drafting best practices for parametrizing tests so
that they are executable against different package / component and
even software collections. The draft suggests the following three
special environment variables to be defined:

PACKAGES
    Space separated list of packages to be tested. Should this
    obsolete/extend the "RunFor" from Makefile? 

COLLECTIONS
    List of software collections to be enabled on the system.

REQUIRES
    Space separated list of packages which need to be installed.
    This should not contain any package from PACKAGES. Should this
    obsolete/extend the "Requires" from Makefile? 

    Recently, an additional syntax has been suggested for
    providing packages which must not be installed on the system,
    these would be prefixed with an exclamation mark. For example
    to have php53 dual package installed which conflicts with
    system php one would use REQUIRES="!php php53"

Now, the idea is that the "rlAssertRpm --all" command could do
something like this:

    for package in $PACKAGES $REQUIRES $COLLECTIONS; do
        rlAssertRpm $package
    done

The implementation should be quite straightforward and it would
save common setup steps. Would that be acceptable for BeakerLib?

Comment 5 Petr Šplíchal 2013-01-18 14:04:41 UTC
Or, another option came to my mind: What about having a BeakerLib
function, say rlPreparePackages, which would ensure that required
packages are installed. That could mean both removing/installing
packages using 'yum remove/install' respectively plus asserting.
The required package list would be based upon the variables
mentioned in comment #4.

Thoughts?

Comment 6 Petr Muller 2013-01-22 12:48:05 UTC
The approach in comment 4 is OK, if the convention is adopted beyond BaseOs group. If the confusion with the different sets of possible Requires/RunFors is solved earlier and the test is guaranteed to get consistent sets, thats OK with me.

I'm not OK with Comment 5, however. Preparing the required environment (packages installed) was always the job of the harness. I'm not willing to pick up the functionality and the maintenance of this piece.

Comment 7 Petr Šplíchal 2013-02-13 14:22:55 UTC
Martin will take care of the implementation.

Comment 8 Petr Šplíchal 2013-02-14 13:34:38 UTC
Thinking more about the implementation reminded me suddenly of and
old coding style rule about asserts inside asserts:

    https://fedorahosted.org/beakerlib/wiki/CodingStyle#UsingrlAssertsinrlAsserts

However, for this case I guess using rlAssertRpm is acceptable as
it would produce list of asserts for individual packages which is
exactly what we want.

Comment 9 Ales Zelinka 2013-02-14 13:48:10 UTC
(In reply to comment #8)

> However, for this case I guess using rlAssertRpm is acceptable as
> it would produce list of asserts for individual packages which is
> exactly what we want.
Hmm, I think I prefer one assert for all the requires. And either list the per-package details via log messages or include the list of packages failing the tests in the assert message itself.

But I don't have a strong opinion about this, the worst that can happen is setup logs will be huge, full of rpm asserts.

Comment 10 Martin Kyral 2013-02-15 15:52:18 UTC
proposed patch attached to BZ#910757
https://bugzilla.redhat.com/attachment.cgi?id=697868&action=diff

Comment 11 Martin Kyral 2013-02-19 09:33:04 UTC
patch containing tests for the new functionality was attached to BZ#910757
https://bugzilla.redhat.com/attachment.cgi?id=699387&action=diff

Comment 13 Martin Kyral 2013-02-21 14:08:36 UTC
Proposed patches have been changed and merged in:
https://bugzilla.redhat.com/attachment.cgi?id=700562&action=diff

Comment 14 Lukáš Zachar 2013-02-22 10:13:45 UTC
I've just tried patc from comment #13 applied on beakerlib-1.6-1.el6eso.noarch and it works as explained in the comment #4. 

Just a minor documentation proposal:
"Check all packages listed in the $PACKAGES $REQUIRES $COLLECTIONS" doesn't seem right for me as this function is actually asserting them.

Comment 15 Martin Kyral 2013-02-26 11:01:50 UTC
Patch with fixed documentation attached to BZ#910757:
https://bugzilla.redhat.com/attachment.cgi?id=702794&action=diff

Comment 16 Lukáš Zachar 2013-02-26 13:28:36 UTC
Both the functionality and the documentation is good from my POV.

Comment 17 Petr Šplíchal 2013-03-01 08:31:09 UTC
This has not been yet committed to the git repo, moving to ASSIGNED.
https://fedorahosted.org/beakerlib/wiki/CodingStyle#BugzillaStates
Petr, could you have a look at this? It's blocking parametrization.

Comment 18 Martin Kyral 2013-03-04 13:43:49 UTC
YAPP (yet another proposed patch) attached to BZ#910757:
https://bugzilla.redhat.com/attachment.cgi?id=704988&action=diff

Comment 19 Petr Šplíchal 2013-03-04 18:01:47 UTC
Thanks for the patch, Martin. Pushed to git:
http://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=f4163cb

Comment 20 Branislav Náter 2013-04-02 10:10:40 UTC
"package" variable in proposed patch should be defined as local to avoid conflicts with variable using the same name in particular test.

Comment 21 Petr Šplíchal 2013-04-03 15:27:37 UTC
Thanks, Braňo! Fix pushed to git master branch:
http://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=75f6da9

Comment 22 Petr Muller 2013-04-09 16:36:00 UTC
*** Bug 534026 has been marked as a duplicate of this bug. ***

Comment 23 Fedora Update System 2013-04-30 15:11:15 UTC
beakerlib-1.7-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/beakerlib-1.7-1.fc19

Comment 24 Fedora Update System 2013-04-30 20:04:53 UTC
Package beakerlib-1.7-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing beakerlib-1.7-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7067/beakerlib-1.7-1.fc19
then log in and leave karma (feedback).

Comment 25 Fedora Update System 2013-05-22 03:08:41 UTC
beakerlib-1.7-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.