Commit Graph

119 Commits

Author SHA1 Message Date
Jan Stodola 12cd27375a Expand parameters as separate words
(cherry picked from commit 961ea18145)
2019-05-03 16:57:37 -07:00
Jan Stodola 34c24117fe Add script for removing old artifacts from OpenStack
(cherry picked from commit 6680e2ffec)
2019-05-03 16:57:37 -07:00
Jan Stodola 8885d7eaca Add script for removing old artifacts from AWS
(cherry picked from commit 677c858f60)
2019-05-03 16:57:37 -07:00
Alexander Todorov a038f7d904 tests: use the first IP address if more than 1 retruned from OpenStack
(cherry picked from commit 883a959442)
2019-05-03 16:52:44 -07:00
Alexander Todorov 963c7d8f89 tests: remove a debugging command
(cherry picked from commit 6563a33f63)
2019-05-03 16:52:44 -07:00
Alexander Todorov 4f3b81e4e7 Teach OpenStack test to distinguish between RHEL and Fedora
(cherry picked from commit 642b909d24)
2019-05-03 16:50:33 -07:00
Alexander Todorov 7b306e2e84 Use full path for Azure playbook as well
(cherry picked from commit 543a4d88d9)
2019-05-03 16:47:52 -07:00
Alexander Todorov 9584cbd96f Use a temporary dir for ssh keys during testing
resolves path problems with sudo, we already have the same change
in the AWS test script.

(cherry picked from commit 16260c1569)
2019-05-03 16:47:46 -07:00
Alexander Todorov c4f3ceb0ec Update V_DATASTORE b/c defaults appear to have been changed
(cherry picked from commit 59050df710)
2019-05-03 16:47:38 -07:00
Alexander Todorov 41aa84ba04 Clone pyvmomi samples in the correct directory
(cherry picked from commit e0c8cdc5a8)
2019-05-03 16:47:10 -07:00
Alexander Todorov a8ff02113b Use full path when pushing toml files during testing
(cherry picked from commit 8f430be2a6)
2019-05-03 16:47:00 -07:00
Alexander Todorov efa9974609 Implicitly specify ssh key directory/files for testing
this is to work around identity/sudo problems

(cherry picked from commit 4b4f4bd0e0)
2019-05-03 16:46:48 -07:00
Alexander Todorov a907a3757d [test] Clean up containers.json
(cherry picked from commit ed63611cb7)
2019-05-03 16:46:39 -07:00
Alexander Todorov eda242623b Teach AWS test to distinguish between RHEL and Fedora
(cherry picked from commit ab048947cb)
2019-05-03 16:46:32 -07:00
Alexander Todorov 8c409c8263 Use a temporary shared dir when testing
otherwise composer-cli is unable to glob() the kickstart
files and we're left without supported compose types. Seen
during AWS testing for example.

Helps with running some of the tests via sudo b/c this is
what Jenkins requires.

(cherry picked from commit b88466fd74)
2019-05-03 16:43:41 -07:00
Alexander Todorov 9c17c0cc6c Copy blueprints used for testing to temporary directory
If trying to execute test_cli.sh inside a git checkout
we are going to get the following exception:

Traceback (most recent call last):
  File "./src/sbin/lorax-composer", line 251, in <module>
    repo = open_or_create_repo(server.config["REPO_DIR"])
  File "/home/jenkins/lorax/src/pylorax/api/recipes.py", line 306, in open_or_create_repo
gi.repository.GLib.Error: ggit-error: failed to stat '/home/jenkins/lorax/tests/pylorax/blueprints': Permission denied (-1)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/multiprocessing/popen_fork.py", line 54, in _send_signal
    os.kill(self.pid, sig)

From what I can tell open_or_create_repo() is trying to initialize
a git repository inside the blueprints directory which fails when
we have an active git checkout.

This doesn't happen when we run the tests in Travis CI because
rsync excludes .git/ inside the Docker container.

(cherry picked from commit c9d706a382)
2019-05-03 16:43:35 -07:00
Alexander Todorov 178eb927d6 Add make targets for Jenkins
these targets help hooking up things in Jenkins and enable us to
perform build & deploy tests for cloud images.

NOTE: use sudo -E to preserve the environment
(cherry picked from commit 366ae55abe)
2019-05-03 16:43:28 -07:00
Alexander Todorov 2184cff59c Teach test_cli.sh to execute test scripts via arguments
this will be used to invoke scripts that build/push cloud images
without having to duplicate the setup/teardown/report parts!

(cherry picked from commit af2ae790ce)
2019-05-03 16:41:00 -07:00
Alexander Todorov 63e35921fa new test: build an image and deploy it on Azure
(cherry picked from commit 13fbd0861b)
2019-05-03 16:40:54 -07:00
Alexander Todorov 9b31c3cad9 Fix typo in comment
(cherry picked from commit d6dcb38a78)
2019-05-03 16:40:48 -07:00
Alexander Todorov 3fd9699e6d For OpenStack build image with rng-tools installed
appears to be a decent workaround for slow boot likely caused
by lack of entropy for ssh-keygen, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1639326

(cherry picked from commit 6ae78fbd47)
2019-05-03 16:39:25 -07:00
Brian C. Lane 51a9c28bc6 Add tests for partitioned disk images
The setup for this is a bit complex, so it really ends up testing things
twice.

(cherry picked from commit fb4e6f2588)
2019-05-03 16:39:18 -07:00
Brian C. Lane e7310c7260 Add tests for pylorax.imgutils
Some of these can only run as root on a real system with access to loop
devices. They are skipped when running in a container.

(cherry picked from commit 063a1770e1)
2019-05-03 16:39:05 -07:00
Brian C. Lane 0aa206f661 Add tests to test_creator.py
Add a /.in-container file to the container root so that tests requiring root
and loop device support will be skipped when running in a container.

(cherry picked from commit bab4b20d0d)
2019-05-03 16:39:01 -07:00
Brian C. Lane ef45d169b0 Add some tests for creator.py
This is complicated by the fact that much of this module requires mount.
So for now just test the things that don't need mount.

(cherry picked from commit 134a333d92)
2019-05-03 16:38:47 -07:00
Brian C. Lane c63b2e3881 tests: Add executils test
(cherry picked from commit fb87db0e1e)
2019-05-03 16:38:38 -07:00
Brian C. Lane c6b9a72778 tests: Add sysutils test
(cherry picked from commit cc69478249)
2019-05-03 16:38:33 -07:00
Brian C. Lane c34a0fb535 tests: Add discinfo test
(cherry picked from commit 2e36e941ce)
2019-05-03 16:38:28 -07:00
Brian C. Lane c5e839838f tests: Add treeinfo test
(cherry picked from commit e8fd8a496b)
2019-05-03 16:38:22 -07:00
Alexander Todorov a2797e8f1b new test: build and deploy an image in OpenStack
(cherry picked from commit 6a42570eea)
2019-05-03 16:37:16 -07:00
Alexander Todorov cbebbce0d5 Fix typos in VM_NAME and cleanup command
(cherry picked from commit 6005f98123)
2019-05-03 16:37:10 -07:00
Alexander Todorov 71ccb55985 new test: build and deploy images on vSphere
(cherry picked from commit 9906ad6da3)
2019-05-03 16:37:04 -07:00
Alexander Todorov c0d51e9e99 new test: build and deploy images on AWS
(cherry picked from commit efaf2bf793)
2019-05-03 16:36:50 -07:00
Alexander Todorov 019aa20d9f Disable execution of new tests which need Docker privileged mode
(cherry picked from commit 7d2b9d2d30)
2019-05-03 16:36:44 -07:00
Alexander Todorov 7c38d74c00 New tests: build ext4-filesystem and partitioned-disk composes
for the moment we just make sure these two can be built without
visible errors.

(cherry picked from commit 2eb62014db)
2019-05-03 16:36:38 -07:00
Brian C. Lane 47a909209f Remove duplicate repositories from the sources list
In some cases when the host has, for whatever reason, multiple copies of
the same repo listed the build may fail with an error about running out
of space.

So this commit removes duplicate entries after the host's repos have been
loaded. It also adjusts some of the test repos to use different
temporary repo names for the tests.

(cherry picked from commit 98482e444d)
2019-01-30 08:43:37 -08:00
Brian C. Lane 76071db226 Remove unneeded else from for/else loop. It confuses pylint
(cherry picked from commit 2950f2641b)
2019-01-08 13:47:21 -08:00
David Shea cfff807df8 Allow customizations to be specified as a toml list
Support both

  [customizations]
  hostname = "whatever"

and

  [[customizations]]
  hostname = "whatever"

in the blueprint data. The [[ syntax matches the other customization
directives (user, group, sshkey), and as such it's easy to accidentally
use it for the hostname without even realizing it's specifying something
different.

Add some tests for converting customizations to kickstarts.

(cherry picked from commit 35ab6a1336)
2019-01-08 13:46:08 -08:00
Brian C. Lane 3f034a981d lorax-composer: Handle packages with multiple builds
When the repository has multiple arches, eg. i686 and x86_64, it should
add a new entry to the project's builds list, not create a new project
in the list.

This handles that by adding a modified insort_left function and
examining the packages returned from dnf to make sure they aren't
already listed in the results. It also handles adding them in sorted
order so that no further sorting needs to be done on the results.

Resolves: rhbz#1656642
(cherry picked from commit d18934775c)
2018-12-06 16:06:45 -08:00
Brian C. Lane 574360f7d0 lorax-composer: Check the queue and results at startup
If the system ran out of space, or was rebooted unexpectedly, the state
of the queue symlinks, or the results STATUS files may be inconsistent.
This checks them and:
 * Removes broken symlinks from queue/new and queue/run
 * Removes symlinks from run and sets the build to FAILED
 * Sets builds w/o a STATUS to FAILED
 * Sets builds with STATUS of RUNNING to FAILED
 * Creates missing queue/new symlinks to results with STATUS of WAITING

So, any builds that were running during the reboot will be FAILED, and
any that were waiting to be started will be started upon rebooting.

Resolves: rhbz#1647985
(cherry picked from commit 4dd9004d13)
2018-12-06 15:26:40 -08:00
Brian C. Lane 1006af4232 Add tests for ltmpl.py
This covers things like installing globbed package names from multiple
repos, pinned package versions, and ltmpl functions

Related: rhbz#1548586
(cherry picked from commit a4783ba29f)
2018-10-29 14:49:49 -07:00
Brian C. Lane bdbd8258f0 Fix singlerepo test for f29 2018-10-29 14:48:40 -07:00
Brian C. Lane 88a0b475e9 Update the projects tests to use DNF Repo object
Stop using fake dnf object, use the real thing. This will help catch
problems with dnf returning unexpected types like VectorString.

(cherry picked from commit 27aff75aa3)
2018-10-29 14:27:23 -07:00
Brian C. Lane 708cadee82 Update the tests for new make_dnf_dir arguments.
Use the uid and gid that the test is running as instead of hard-coding
0.
2018-10-10 14:25:38 -07:00
Brian C. Lane 3499426b2d Change make_dnf_dirs to be run as root
It needs to be root in order to set the ownership and permissions on the
directories that are under /var/lib/lorax/composer/

Refactor the directory creation into a utility function, and use a umask
of 0o006 to ensure that the parent directories created do not have o+rw
set on them (makedirs behavior is different between Python 3.6 and 3.7
so umask of 0 doesn't work consistently).
2018-10-10 14:25:38 -07:00
Brian C. Lane ce6fa9c05f Add an openstack image type
This is a qcow2 image with cloud-init in the template.
2018-10-09 11:07:46 -07:00
Brian C. Lane d03e6e8c7e Update cli tests to use composer-cli name 2018-10-08 15:53:15 -07:00
Brian C. Lane d65a502861 Report an error if the blueprint doesn't exist
composer-cli uses TOML for 'blueprints save' which was returning an
empty 200 response if the blueprint didn't exist. Change this to return
a standard 400 error response if the blueprint doesn't exist.

composer-cli is already setup to handle receiving json when an error is
returned so just the toml API response for `blueprints/save` needed to
be changed.
2018-10-05 09:09:10 -07:00
Brian C. Lane c7b4dce2b6 Write a rootpw line if no root customizations in the blueprint
Anaconda requires the root password to be set or locked, so if there
isn't anything setting it we write out 'rootpw --lock'

Also adds tests for this.

Resolves: rhbz#1626122
2018-10-05 09:09:10 -07:00
Brian C. Lane b35fe9d32a Add beakerlib to Dockerfile.test
Also kill the lorax-composer process and remove /run/weldr/api.socket
so that when this is run with podman you don't get an error about
attempting to tar up the socket.
2018-10-05 09:09:10 -07:00