Commit Graph

284 Commits

Author SHA1 Message Date
Jakub Rusz
f52e56c628 tests: fix blueprints tag test
This changes the blueprint tested from glusterfs to example-http-server
2019-11-18 08:41:55 -08:00
Jakub Rusz
6839390be2 test: fix serializing repo_to_source test
Travis used fedora-32, this commit changes it to fedora-31.
2019-11-18 08:41:55 -08:00
Brian C. Lane
fad9b324f7 composer-cli: Return int from handle_api_result not bool
The callers, and the documentation, all expect int 0/1 to use as the
exit status for the program. Not True/False, even though that works most
of the time.
2019-11-14 11:58:56 -08:00
Brian C. Lane
dcd92cf8c0 tests: Add 'test_mkksiso' tests
These use beakerlib to download a Fedora boot.iso and run mkksiso on
it. It currently does not try to boot the resulting iso, it mounts it
and checks that the expected config files have been modified and the
extra files have been added.
2019-11-05 11:09:42 -08:00
Brian C. Lane
94b2b58d99 tests: Add a lorax boot.iso test
This builds a boot.iso in the vm, copies it out, and boots it.
The tests that run inside the boot.iso
(/tests/lorax/test_boot_bootiso.sh) cannot use beakerlib so it needs to
be a simple shell script returning 1 on failure along with a descriptive
message.
2019-11-05 10:38:31 -08:00
Alexander Todorov
2b578dcee8 tests: Ensure failure if beakerlib results file not found
In example here
https://209.132.184.41:8493/logs/pull-887-20191025-100505-509b9eae-weldr-lorax--fedora-31-tar/log.html

we're seeing stuff like:
/tests/test_cli.sh: line 109: /tmp/composer-test.wIAITH/TestResults: No such file or directory

but the result is PASS
2019-11-05 19:05:33 +02:00
Alexander Todorov
c43ba9e78f tests: Documentation updates 2019-11-05 19:05:33 +02:00
Alexander Todorov
b197e448ff DRY when setting up, running & parsing results for beakerlib tests 2019-11-05 19:05:33 +02:00
Brian C. Lane
89539a7bf4 tests: Use journalctl -g to check for failed login
/var/log/audit/audit.log isn't always available (eg. tar liveimg
install), but it is logged to the journal, which can be grepped with
'journalctl -g' so use that instead.
2019-11-01 09:00:57 -07:00
Brian C. Lane
454af0c5d5 tests: Fix check_root_account when used with tar liveimg test
passwd and openssh-clients need to be installed, and there is no need to
use sudo when you are connecting to the system as root.
2019-11-01 09:00:57 -07:00
Alexander Todorov
d67745d755 tests: Use the same asserts as before
after the changes around live-iso and qcow2 test cases the asserts
used have also changed. This commit utilizes the existing test lib.
2019-11-01 09:00:57 -07:00
Alexander Todorov
e1b45958f4 tests: switch to using podman instead of docker
Note: use podman-docker to avoid changing tests too much. This
is also what we have on the RHEL branches.

There's no service to be started/restarted so remove everything
related to docker service.
2019-11-01 09:00:57 -07:00
Brian C. Lane
4705ff3b1e tests: Remove nested vm from tar liveimg kickstart test
Use anaconda to install the root.tar.xz into a disk image.  Copy the
disk image to the host, and use the cockpit vm support to boot it and
test it.
2019-11-01 09:00:57 -07:00
Brian C. Lane
a0ae10c2d7 tests: Use --http0.9 for curl ssh test 2019-11-01 09:00:57 -07:00
Brian C. Lane
e3654e8297 test: Boot the live-iso faster, and login using ssh key
On Fedora 31 passworless root login is no longer working. We already
install a ssh key, may as well use it.

This also reduces the live boot timeout to 2s from 60s, which should
help with timeout problems when booting.
2019-11-01 09:00:57 -07:00
Brian C. Lane
b8bf258a3c tests: Split testing the image into a separate script
Nested virt is not reliable enough, especially on other arches, to rely
on for testing the created images. This moves the test code into
test_boot_* scripts to be run from inside the booted images.

It also adds copying the results of the build into
/var/tmp/test-results/, and includes the generated ssh key so that
whatever boots the image can also log in.

The tests/test_image.sh script has been added to handle running the
test_boot_* scripts without any of the extra lorax-composer specific
setup.
2019-11-01 09:00:57 -07:00
Brian C. Lane
e365e476af Disable some compose types on other architectures
The 'enabled' field in the /compose/types output now reflects whether or
not the type is supported on the current architecture. Disabled types
are not allowed to be built, and will raise an error like:

Compose type 'alibaba' is disabled on this architecture
2019-10-28 16:42:36 -07:00
Alexander Todorov
88162780a7 tests: Document Azure setup 2019-10-21 19:46:37 +02:00
Brian C. Lane
0eb01b84a8 tests: Switch the azure examples used in the lifted tests to use aws 2019-10-16 09:17:54 -07:00
Brian C. Lane
c2620b0c85 lifted: Add support for AWS upload
This uses a new Ansible module, ec2_snapshot_import, which is included
here until it is available from upstream.

It will upload the AMI to s3, convert it to a snapshot, and then
register the snapshot as an AMI. The s3 object is deleted when it has
been successfully uploaded.
2019-10-16 09:17:54 -07:00
Brian C. Lane
b91d742ecb tests: Add tests for deleting unknown upload and profile 2019-10-16 09:17:53 -07:00
Brian C. Lane
d16e8f5bfc Change /compose/uploads/delete to /upload/delete
Remove the requirement to pass the compose uuid and the upload uuid --
only the upload uuid is needed.
2019-10-16 09:17:53 -07:00
Brian C. Lane
577c56ebaa tests: Add test for /compose/uploads/delete
Test deleting an upload from a compose.
2019-10-16 09:17:53 -07:00
Brian C. Lane
b307ff0430 tests: Add tests for /compose/uploads/schedule
Test it with a profile, and with one-time use settings. It does not
actually upload anything, it only tests that the upload is scheduled.
2019-10-16 09:17:53 -07:00
Brian C. Lane
fd2330c4b7 tests: Fix comments about V1 API results including uploads data 2019-10-16 09:17:53 -07:00
Brian C. Lane
acbf63013a lifted: Make sure inputs cannot have path elements
This processes the inputs with os.path.basename to strip off any path
elements and prevent potential path traversal attacks. Also adds a test.
2019-10-16 09:17:53 -07:00
Brian C. Lane
7396c272b2 Use consistent naming for upload uuids
Since we have both compose uuids and upload uuids they need to be
clearly named. This updates the upload naming to use 'upload_uuid' in
the inputs, and 'upload_id' in the output (_id instead of _uuid for
consistency with build_id naming in the status responses).

This also adds 'upload_id' to the /upload/log response.
2019-10-16 09:17:53 -07:00
Brian C. Lane
ade8945da3 tests: Add tests for new upload routes
This tests the routes for saving a profile, listing profiles, deleting
profiles, as well as composing with upload.

The composes run fake composes with upload data, one selects a profile
the other passes in the settings. No actual upload is done, but it tests
that the info, log, and cancel routes work.

This also updates the test setup to copy over the share/lifted directory
so that the providers are available to the tests.
2019-10-16 09:17:53 -07:00
Brian C. Lane
b2fc391677 lifted: Add delete_profile function and tests
Also adds a helper to providers, _get_profile_path, so that the code
doesn't need to be repeated in all the functions.
2019-10-16 09:17:53 -07:00
Brian C. Lane
bc06abceab lifted: Add a function to load the settings for a provider's profile
This returns the settings after loading them and running verify_settings
on them.
2019-10-16 09:17:53 -07:00
Brian C. Lane
de314a0046 tests: Add yamllint of the lifted playbooks 2019-10-16 09:17:53 -07:00
Brian C. Lane
4da569442c tests: Add tests for the new lifted module
These tests cover most of the module's functions, except for the queue
monitor, and the actual execution of the playbooks.
2019-10-16 09:17:53 -07:00
Brian C. Lane
1b84f90963 lifted directories should be under share_dir and lib_dir
Otherwise passing --sharedir pointed to some other path will not use the
correct providers.
2019-10-16 09:17:53 -07:00
Brian C. Lane
1a6bc098d9 tests: Add tests for API v1
Output from some of these are different from API v0. Instead of mixing
the two this moved v1 tests into a new class - ServerAPIV1TestCase to
make them easier to maintain, and removes the v1 tests from
ServerAPIV0TestCase
2019-10-16 09:17:53 -07:00
Brian C. Lane
3a453eaad7 Make sure V0 API doesn't return uploads information
uploads should only be included in the V1 API routes, add `api`
selection to the relevant helper functions and calls to them from v0.py

Add new V1 routes with api=1 to include the uploads information in the
results.

Also add tests to ensure that V0 requests do not include uploads.
2019-10-16 09:17:53 -07:00
Brian C. Lane
697233c14a lorax-composer: Handle RecipeError in commit_recipe_directory
A recipe that is valid TOML can still be an invalid recipe (eg. missing
the 'name' field) so this should also catch RecipeError.

Also added tests for this, as well as making sure commit_recipe_file()
raises the correct errors.

Resolves: rhbz#1755068
2019-10-04 08:07:36 -07:00
Jiri Kortus
5322664432 Add test for running composer with --no-system-repos option 2019-09-24 12:50:19 +03:00
Jiri Kortus
f978d4b01c [tests] Use functions for starting and stopping lorax-composer 2019-09-24 12:50:19 +03:00
Alexander Todorov
8af9723c37 [tests] Collect compose logs after each build
- save compose logs under /var/log/$TEST
- save qemu logs under /var/log/$TEST/qemu.log
- download everything to $TEST_ATTACHMENTS so it can be saved
  in CI results
2019-09-13 12:16:22 +03:00
Jiri Kortus
836f0ddf7a [tests] Use a function to wait for compose to finish
The function is meant to replace the duplicate pieces of code used in various
tests, the polling interval is unified to 20 seconds.
2019-09-13 12:16:22 +03:00
Alexander Todorov
ea98969014 When launching AWS instances wait for the one we just launched
because the ec2.instances variable will return all that are
currently running
2019-09-11 10:46:53 +02:00
Jiri Kortus
421cc9c22f tests: Add kickstart tar installation test 2019-09-09 09:28:52 +02:00
Jiri Kortus
562eb0a15d tests: add option to disable kernel command line parameters check 2019-09-09 09:28:52 +02:00
Brian C. Lane
beff4f6967 tests: Use a loop to wait for VM and sshd to start 2019-09-09 09:28:52 +02:00
Brian C. Lane
3ee07001b1 tests: Drop tito from the Dockerfile.test
It isn't needed to run the tests, and currently a package it depends on
(cheetah) is not working in rawhide.

Also bump glusterfs version to 7.*
2019-09-03 11:02:52 -07:00
Brian C. Lane
1581842132 tests: Drop sort from compose types test
The output from the API is already sorted, and 'sort' changes this
ordering in some situations.
2019-08-29 08:17:29 -07:00
Alexander Todorov
64ac615fa4 Revert "tests: Fix the order of liveimg-tar live-iso"
This reverts commit 3b6c6a35d7.
2019-08-29 08:17:29 -07:00
Alexander Todorov
114c1bbda7 New test: assert toml files in git workspace
tests: export BLUEPRINTS_DIR for use in tests

Depending on the way the tests are run the directory may be a temporary
dir, or it may be the standard /var/lib/lorax/... path.

Related: rhbz#1714103
2019-08-29 08:17:29 -07:00
Brian C. Lane
cda497f0cb tests: Update gpg key to fedora 32 2019-08-20 17:23:08 -07:00
Brian C. Lane
3b6c6a35d7 tests: Fix the order of liveimg-tar live-iso 2019-08-20 17:23:08 -07:00