Commit Graph

101 Commits

Author SHA1 Message Date
Alexander Todorov c9d706a382 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.
2018-11-29 09:46:06 +02:00
Alexander Todorov 366ae55abe 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
2018-11-29 09:46:06 +02:00
Alexander Todorov af2ae790ce 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!
2018-11-26 14:22:43 +02:00
Alexander Todorov 13fbd0861b new test: build an image and deploy it on Azure 2018-11-21 11:39:15 +02:00
Alexander Todorov d6dcb38a78 Fix typo in comment 2018-11-21 11:39:15 +02:00
Alexander Todorov 6ae78fbd47 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
2018-11-13 12:09:07 +02:00
Brian C. Lane fb4e6f2588 Add tests for partitioned disk images
The setup for this is a bit complex, so it really ends up testing things
twice.
2018-11-12 11:13:37 -08:00
Brian C. Lane 063a1770e1 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.
2018-11-12 11:13:37 -08:00
Brian C. Lane bab4b20d0d 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.
2018-11-12 11:13:37 -08:00
Brian C. Lane 134a333d92 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.
2018-11-12 11:13:37 -08:00
Brian C. Lane fb87db0e1e tests: Add executils test 2018-11-12 11:13:37 -08:00
Brian C. Lane cc69478249 tests: Add sysutils test 2018-11-12 11:13:37 -08:00
Brian C. Lane 2e36e941ce tests: Add discinfo test 2018-11-12 11:13:37 -08:00
Brian C. Lane e8fd8a496b tests: Add treeinfo test 2018-11-12 11:13:37 -08:00
Alexander Todorov 6a42570eea new test: build and deploy an image in OpenStack 2018-11-09 10:25:26 +02:00
Alexander Todorov 6005f98123 Fix typos in VM_NAME and cleanup command 2018-11-09 10:25:26 +02:00
Alexander Todorov 9906ad6da3 new test: build and deploy images on vSphere 2018-11-08 10:33:20 +02:00
Alexander Todorov efaf2bf793 new test: build and deploy images on AWS 2018-10-30 00:28:18 +02:00
Alexander Todorov 7d2b9d2d30 Disable execution of new tests which need Docker privileged mode 2018-10-29 23:15:06 +02:00
Alexander Todorov 2eb62014db New tests: build ext4-filesystem and partitioned-disk composes
for the moment we just make sure these two can be built without
visible errors.
2018-10-29 23:15:06 +02:00
Alexander Todorov 453b1c1236 Update tmux version in tests 2018-10-29 23:15:06 +02:00
Brian C. Lane a4783ba29f 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
2018-10-29 13:55:19 -07:00
Brian C. Lane df70e3d677 Update php version to 7.3.* 2018-10-24 10:22:40 -07:00
Brian C. Lane 27aff75aa3 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.
2018-10-24 10:22:40 -07:00
Brian C. Lane 75644689de 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-12 11:59:32 -07:00
Brian C. Lane 65b769984b 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-12 11:59:32 -07:00
Brian C. Lane 98f8b23129 Add an openstack image type
This is a qcow2 image with cloud-init in the template.
2018-10-09 10:17:14 -07:00
Brian C. Lane 2a7a323ddf Update cli tests to use composer-cli name 2018-10-08 09:48:34 -07:00
Brian C. Lane 6da3079349 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-03 16:41:49 -07:00
Brian C. Lane e7bfab8b4a 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-03 08:30:31 -07:00
Brian C. Lane acedb3a0ed 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-02 16:23:42 -07:00
Brian C. Lane e4c098b7e0 Adjust projects test for DNF 3.6.1 tuple issue 2018-10-02 14:31:30 -07:00
Brian C. Lane 7e31a2c138 Add a test for repo metadata expiration
This tests to make sure that the metadata timer is working (by setting
it to 10s and adding a new package to the repo), and that
DNFLock.lock_check immediately picks up a new package.

This depends on rpmfluff which is available from Fedora or EPEL repos.

Related: rhbz#1631561
2018-10-02 13:59:42 -07:00
Brian C. Lane ef8bc70cdd Add tests for setting root password and ssh key with blueprints
Related: rhbz#1626120
2018-10-02 13:59:42 -07:00
David Shea 003108b15f Add new compose types to compose sanity test 2018-10-02 11:54:41 -04:00
David Shea 1056bfc25b Add a vmdk compose type.
This is similar to the AMI type, but also adds open-vm-tools and does not do
anything special to the partitioning
2018-10-02 11:54:41 -04:00
David Shea e0c236ff36 Add a vhd compose type for Azure images
This does pretty much the same things as the AMI compose type, but also
replaces NetworkManager with the Azure linux agent.
2018-10-02 11:54:41 -04:00
David Shea 18188bf6cf Add an ami compose type for AWS images
This differs from lmc's --make-ami in that creates a full disk image instead of
an fsimage. Create a raw disk image with a / and /boot partitions, and enable
sshd, chronyd, and cockpit by default.
2018-10-02 11:54:38 -04:00
Lars Karlitski 160044ba9d Fix pylint errors and warnings
Remove `except` block which immediately raises the same exception again (it's
not a subclass of another caught exception, so this is safe).

Remove a false positive, because it is not emitted from the code base.

Disable subprocess-popen-preexec-fn in startProgram, which is not used
internally.
2018-09-25 13:49:40 +03:00
Alexander Todorov 9736dff762 New cli test covering basic compose commands
- need to specify --sharedir so lorax-composer can find its
  kickstart files

- each test script writes results into a separate directory to
  avoid a passing test overwriting the results from a failing one.
  To avoid reporting failures in case of previously failing tests
  (e.g. during development) remove the temporary directories holding
  tets results before execution!
2018-09-24 22:28:57 +03:00
Alexander Todorov c97a6985fb Update glusterfs to 5.*
otherwise depsolve fails b/c rawhide repositories don't seem to
contain the 4.1.* versions
2018-09-24 22:28:57 +03:00
Alexander Todorov 8e0b7ba2ca Execute bash tests for composer-cli
these are built on top of beakerlib and we use its internal
protocol to figure out the result without relying on the full
test runner that is tipically used inside of a RHEL environment!

Includes a disabled test snippet for Issue #460
2018-09-20 16:07:57 +03:00
Stef Walter 4a66b5b085 tests: Fix tests so they run on Fedora 28
Broaden the match for Samba in the glusterfs blueprint so it
can work on Fedora 28
2018-09-19 08:47:23 -07:00
David Shea b4b8985caa Fix the expected versions of blueprint components 2018-09-07 13:34:30 -04:00
Brian C. Lane 7e19a4f671 Update the example blueprints for rawhide 2018-08-29 11:17:39 -07:00
Brian C. Lane 972b5c4142 Add tests for limit=0 routes
Passing ?limit=0 to the blueprints/list, blueprints/changes,
projects/list, modules/list should always return the total possible
results, not 0.

Also move the composer-cli test_diff to the end so that it will work
consistently. Do this by naming it test_z_diff.
2018-08-27 11:05:46 -07:00
Brian C. Lane 4e32026354 Fix tests related to blueprint name changes 2018-08-23 13:32:26 -07:00
Brian C. Lane fb39d9a418 Add 'example' to the example blueprint names 2018-08-23 13:29:51 -07:00
David Shea c52ba4236a Add tests for /compose/status filter arguments 2018-08-21 16:42:27 -07:00
Chris Lumens fb9e5c4a2b Fix more tests.
These were broken due to me rebasing before sending a PR off.  They
should work now.

(cherry picked from commit 4cb15e0a0f)
2018-08-09 16:20:29 -04:00