#51 standard-test-rhts: enable usage of beakerlib libraries
Merged by merlinm. Opened by mvadkert.
mvadkert/standard-test-roles feature/resolve-test-deps  into  master

Download 51.patch

This patch adds optional resolving of test dependencies, including beakerlib libraries from beakerlib tests' Makefile. Note that the resolving of dependencies is required for beakerlib libraries (because they are packages without dependencies). To activate this feature pass to the role this variable:

use_beakerlib_libraries: yes

By default this feature is disabled (we might enable it after testing).

The solution uses the resolve-test-dependencies script to download and print the RhtsRequires and Requires (fields from the Makefile). The libraries are looked up by default in /usr/share/beakerlib-libraries. The RhtsRequires (these are must have deps) are installed and the role will fail if they cannot be installed. The Requires deps are installed with (--skip-broken) as these do not have to be all installable (this is how it works in downstream's runners - i.e. restraint, beah).

Note that to test this feature now, you can use the nfs-utils tests, but make sure that you use the code from this PR:

https://upstreamfirst.fedorainfracloud.org/nfs-utils/pull-request/3

Note that I decided I won't migrate any test using this, until this feature (in this or subsequent form) is accepted upstream. Makes the most sense to me :) This feature can be tested with downstream git, so not problem on that side. Might be there are some valid objections I do not see now ....

I attempted to use the modified role by running the playbook against a target docker container and vagrant host. In both cases, the role failed when attempting to execute the resolve-test-dependencies script because it didn't exist. This makes sense, because the playbook itself is actually running on the control host, but it runs the shell command on the remote system under test--which doesn't have the role files present. I think that maybe the ansible script module is what needs to be used so the script gets transferred to the remote system. Care needs to be taken to get any associated environment variables passed along, too.

TASK [standard-test-rhts : Resolve test dependencies] *****************************************************************************************************************
failed: [14d73588b3ff010799b70ef2ac78b716a1bd7b8141bc526547184000e459ad73] (item=httpd-php-mysql-sanity-test) => {"changed": true, "cmd": "/home/merlinm/pagure/_fork/mvadkert/standard-test-roles/roles/standard-test-rhts/files/resolve-test-dependencies httpd-php-mysql-sanity-test", "delta": "0:00:00.110196", "end": "2017-09-15 20:48:02.319064", "failed": true, "item": "httpd-php-mysql-sanity-test", "rc": 127, "start": "2017-09-15 20:48:02.208868", "stderr": "/bin/sh: /home/merlinm/pagure/_fork/mvadkert/standard-test-roles/roles/standard-test-rhts/files/resolve-test-dependencies: No such file or directory", "stderr_lines": ["/bin/sh: /home/merlinm/pagure/_fork/mvadkert/standard-test-roles/roles/standard-test-rhts/files/resolve-test-dependencies: No such file or directory"], "stdout": "", "stdout_lines": []}
        to retry, use: --limit @/home/merlinm/upstreamtest/httpd/tests.retry

Perhaps the -w option should also be passed to grep to prevent partial matches in the processed libs.

I would suggest using a slightly better delimited patter to replacement than simply COMPONENT. Perhaps _COMPONENT_ or similar? Adjust GIT_BASE_URL above and in the environment as well.

I don't know how long these lists might get, but xargs limits the line length--which would mess things up. It might be safer to replace that final xargs in the above pipelines with something like tr '\n' ' ' instead.

This probably needs to use the ansible script module instead, so the resolve-test-dependencies is transferred to the remote machine before it gets run. Be sure any required environment variables are handled as well.

rebased onto 459c0f6823442b7e14bccb56b0bd7ebd305ad3a9

rebased onto fab60e3dab1b91643c9f02ff0b7f09b3e37a066e

I attempted to use the modified role by running the playbook against a target docker container and vagrant host. In both cases, the role failed when attempting to execute the resolve-test-dependencies script because it didn't exist. This makes sense, because the playbook itself is actually running on the control host, but it runs the shell command on the remote system under test--which doesn't have the role files present. I think that maybe the ansible script module is what needs to be used so the script gets transferred to the remote system. Care needs to be taken to get any associated environment variables passed along, too.
TASK [standard-test-rhts : Resolve test dependencies] *****************
failed: [14d73588b3ff010799b70ef2ac78b716a1bd7b8141bc526547184000e459ad73] (item=httpd-php-mysql-sanity-test) => {"changed": true, "cmd": "/home/merlinm/pagure/_fork/mvadkert/standard-test-roles/roles/standard-test-rhts/files/resolve-test-dependencies httpd-php-mysql-sanity-test", "delta": "0:00:00.110196", "end": "2017-09-15 20:48:02.319064", "failed": true, "item": "httpd-php-mysql-sanity-test", "rc": 127, "start": "2017-09-15 20:48:02.208868", "stderr": "/bin/sh: /home/merlinm/pagure/_fork/mvadkert/standard-test-roles/roles/standard-test-rhts/files/resolve-test-dependencies: No such file or directory", "stderr_lines": ["/bin/sh: /home/merlinm/pagure/_fork/mvadkert/standard-test-roles/roles/standard-test-rhts/files/resolve-test-dependencies: No such file or directory"], "stdout": "", "stdout_lines": []}
to retry, use: --limit @/home/merlinm/upstreamtest/httpd/tests.retry

good point, we will look @ this, the new patch is almost ready

Other issues were resolved in the rebased patch, namely

  1. we added the -w option for the grep (thanks!)
  2. the download of roles from git location was removed and the role will use the packaged beakerlib-libraries only
  3. xargs has been replaced as advised

Thanks very much for the comments and sorry it took so long to rework :(

Will update once the final version is ready

rebased onto 1bd050f65c866b2462c83d6e75d21b7c12deab5c

1 new commit added

  • Fixed main.yml playbook and dep resolution script

rebased onto 242d59c9094b0a6ca8485ff31342d73a7f088988

rebased onto 40c1102edd86562800c23500279bb6518c184c8a

@merlinm @bgoncalv this PR is finally ready for review. Please see the updated Description for up-to-date information about how to run it.

FTR, all your comments should be addressed now! I tested the role also from outside and should work. Note that the standard-test-rhts role currently supports only classic environment.

@mvadkert is it planned to have beakerlib-libraries shipped on Fedora official repo? In that case is this patch just a temporary fix?

@mvadkert is it planned to have beakerlib-libraries shipped on Fedora official repo? In that case is this patch just a temporary fix?

@bgoncalv Yes, that is correct. I will add another PR once the upstream fix gets into the repositories.

@merlinm so waiting for your review, no additional patches needed.

This should have when: use_beakerlib_libraries

Since you changed this to use synchronize, please add the ssh_args: "-o UserKnownHostsFile=/dev/null" parameter just like the other synchronize task in this file. Otherwise, the public key of the system under test will be recorded in ssh's known_hosts file--which can cause a conflict if another disposable test system appears with the same IP address but different public key.

rebased onto fba86e0d7fc7f68e7ded9a3cdb6882b9350d5360

13 new commits added

  • standard-test-rhts: add support for beakerlib-libraries
  • Remove obsolete roles:
  • standard-test-scripts: Ansible role for executing test scripts
  • standard-inventory-qcow2: Print out inventory path when debugging
  • standard-test-source: A new standard role to extract sources
  • inventory: opportunistically install package dependencies for vagrant provider on executor host
  • Rewrite ignored inventory extension code to be less fancy.
  • standard-inventory-qcow2: also accept .qcow2c
  • standard-inventory-qcow2: contact vm with raw ping
  • Updates to CONTRIBUTING guide based on feedback
  • inventory: vagrant provider
  • Use list of ignored inventory extensions from environment if present
  • Add CONTRIBUTING and CODE_OF_CONDUCT documents

rebased onto bf3ae914d331b0b12cbd8cd2769efeff4d00dc3d

@merlinm thanks Merlin! Addressed both things and rebased on current master!

I might be missing something, from what I understood the only thing that we need is to be able to install beakerlib-libraries and therefore we just need to enable the copr repo.

I've imagined that just adding the code below would be enough (similar change for the rhts role...), and the project that needs beakerlib-libraries would just include it as require package on its tests.yml.

--- a/roles/standard-test-beakerlib/tasks/main.yml
+++ b/roles/standard-test-beakerlib/tasks/main.yml
@@ -11,10 +11,21 @@
    setup:
    delegate_facts: True
+  - name: Enable COPR repo for beakerlib-libraries
+    shell: dnf copr -y enable mvadkert/beakerlib-libraries

@bgoncalv note that what my patch does it also "dynamically" resolves dependencies of the beakerlib-libraries. So your approach would require to done this in the tests itself.

@merlin ping? :) I explained everything to Bruno btw, he should have no more concerns I thing. @bgoncalv right?

Right, it is all good to me :-)

Code looks good.

I checked to make sure this PR didn't break existing tests using standard-test-rhts without enabling use_beakerlib_libraries. Good there.

I tried running the nfs-utils tests mentioned in the original PR description that enable use_beakerlib_libraries. They ran, but appeared to hang. I was advised there's still some bugs in those tests, so I limited to running just the 'mount' tests and that worked as expected.

LGTM.

Pull-Request has been merged by merlinm

Metadata