Commit Graph

54 Commits

Author SHA1 Message Date
Brian C. Lane b75b692607 composer-cli: Remove all traces of composer-cli
weldr-client has replaced composer-cli so remove all of the code and
tests, adjust various things so they don't expect it to be available,
and rename some things like test/composertest.py to reflect its
exclusive use by lorax.
2021-04-26 15:59:35 -07:00
Martin Pitt 4b6aa1add1 test: Fix URL to bots testmap
It was moved in https://github.com/cockpit-project/bots/commit/7a3c71968d568
2021-03-24 08:28:25 -07:00
Martin Pitt 04ce221a65 test: Fix vm.install for non-LVM cloud images
Some of our images, like centos-8-stream, are already built from the
official cloud images instead of virt-install with LVM. More images are
going to do that soon [1][2], so fix vm.install to only do the LVM grow
steps if the image actually uses LVM.

Also adjust the comment, as commit 6ddaa5e0dd fixed this for
RHEL images.

[1] https://github.com/cockpit-project/bots/pull/1518
[2] https://github.com/cockpit-project/bots/pull/1527
2021-01-08 17:12:08 +01:00
Brian C. Lane 0eda7829a8 tests: Remove unused lorax-composer tests
This leaves the composer-cli related tests, and switches the default
backend to osbuild-composer for the tests.
2020-09-30 16:35:51 -07:00
Alexander Todorov cc29b99659 Set BACKEND=osbuild-composer if running that test scenario
- this will execute cli sanity tests in parallel with the other
- make sure to pass BACKED to vm.install too
- more checks in lib.sh
2020-07-23 10:20:47 -07:00
Alexander Todorov 14a3c8d5a7 tests: Use BACKEND env variable instead of hard-coded values
- default BACKEND to lorax-composer
- pass BACKEND everywhere we need to
2020-07-23 10:20:47 -07:00
Alexander Todorov f1c15c67e0 tests: Disable non-cli test scenarios b/c osbuild-composer
the image building functionality is now tested by the
osbuild-composer test suite. We weren't successfull at making this
test suite work with the 2 backends so decided to disabled these
scenarios instead. In the future they will likely be deleted.
2020-07-22 08:49:25 -07:00
Martin Pitt 9b8e0e2335 test: Put VM image overlay into /var/tmp
At least in our CI, the default place to store VM runtime overlays
(testvm.get_temp_dir()) points to a tmpfs file, so that tests can put VM
overlays into RAM and are not affected by slow I/O. But that doesn't
work for composer, as it tends to produce huge overlays due to real-life
OS composed trees.

Use /var/tmp/ instead, which is meant for large files.

Also simplify the VirtMachine invocation -- if `identity_file` is None,
that's fine -- it's the default value of that argument anyway.
2020-06-02 09:19:20 -07:00
Matej Marusak 0c44e84cdb
test: Work around invalid fedora baseurls
In the newest Fedora 31 refresh (and in Fedora 32) `baseurl` in repos
contains `download.example`. That is of course not a valid domain.

Closes #1001
2020-04-27 12:05:09 +02:00
Alexander Todorov 718ac31c47 Test & cleanup script for Alibaba cloud 2020-01-28 13:48:57 +02:00
Alexander Todorov 30d45a8880 Remove all repo files & install composer-cli from host repos
when testing downstream snapshots this makes sure that
lorax-composer and composer-cli are coming from the host OS.

We also make 100% sure that there are no other repositories inside
the VM other than what has been configured on the host!

Make it possible to override where repo files are copied from by
defining the REPOS_DIR variable. By default the value is
/etc/yum.repos.d
2019-11-26 13:52:54 +02:00
Alexander Todorov 70baff3bc2 Always remove lorax-composer & composer-cli RPMs before installing them
this will ensure locally built packages are always installed
2019-11-26 13:52:54 +02: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
Brian C. Lane da5ba2421e test: Add wait_boot method for root logins
The cockpit tests assume logging in as non-root, but that isn't always true
when testing things like boot.iso images. So this checks for ssh login without
checking for /run/nologin

Also sets default image to testvm.DEFAULT_IMAGE so that testvm doesn't
need to be imported by users of the class.
2019-11-05 10:38:31 -08:00
Alexander Todorov c43ba9e78f tests: Documentation updates 2019-11-05 19:05:33 +02:00
Alexander Todorov 1351c4dc63 tests: Use host repositories for make vm
to help with running the tests by hand on downstream snapshots.
In that scenario we want TEST_OS/VM_IMAGE to look as closely as
possibly like the snapshot that we'd like to test.
2019-11-05 19:05:33 +02:00
Alexander Todorov cb7e391792 tests: Disable mirrors
bcl: The mirrors are not very good at staying in sync, and if
composer hits one mirror and anaconda hits a different mirror,
you will see depsolve fail. The safest thing is to not use mirrors
in Fedora.
2019-11-05 09:19:41 +02: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 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 df7a018ee2 test: Split up the test class to allow booting other images
This splits out the lorax-composer specific execution so that the built
image can be downloaded from the build vm and booted by the host instead
of using nested virt to try and boot it inside the build vm.

Also adds copying the ssh key from the build vm so that it can log into
the image and run the test_boot_* scripts.
2019-11-01 09:00:57 -07:00
Alexander Todorov 88162780a7 tests: Document Azure setup 2019-10-21 19:46:37 +02:00
Alexander Todorov ba0784d0ee tests: unskip Azure scenario 2019-10-18 17:00:18 +02:00
Brian C. Lane a02538fdc3 vm.install: Turn on verbose output
Helps debug mock rebuild errors for the .src.rpm
2019-10-16 09:17:54 -07:00
Brian C. Lane 3aac31482c test: Disable pylint subprocess check check
The return value for subprocess is already being checked, no need to use
check=True.
2019-09-30 18:11:46 -07:00
Jiri Kortus 5322664432 Add test for running composer with --no-system-repos option 2019-09-24 12:50:19 +03:00
Alexander Todorov 58e762f3a1 Skip kickstart tar test for fedora-30/tar scenario
b/c Fedora-30 install sources contain older anaconda version
2019-09-16 14:09:43 +03:00
Alexander Todorov 52f84adde3 Enable fedora-30/tar test scenario
Related to
https://github.com/cockpit-project/cockpit/pull/12768
2019-09-16 14:09:43 +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 421cc9c22f tests: Add kickstart tar installation test 2019-09-09 09:28:52 +02:00
Alexander Todorov a0322afec3 Skip Azure test b/c misconfigured infra & creds
Also causes failures on the Cockpit side of things, see
https://github.com/cockpit-project/cockpit/pull/12645
2019-09-04 14:51:37 +02:00
Alexander Todorov 197c326530 test: check the number of tests that ran
Fail if the number of excuted tests != number of dicovered tests.
2019-07-10 09:18:36 +02:00
Jacob Kozol 38f1edd2aa Add test for VALID_BLUEPRINT_NAME check
Blueprint names can only contain alphanumeric characters and the characters: ._-. This test checks that an api request to create a blueprint with invalid characters in its name will return an InvalidChars error.
2019-07-09 22:53:51 +02:00
Jacob Kozol 4174186c14 Add seperate validation for blueprint names
The VALID_API_STRING function allows for characters that should not be
allowed in blueprint names. VALID_BLUEPRINT_NAME allows us to
specifically check if a blueprint contains a valid name.
2019-07-09 22:53:51 +02:00
Lars Karlitski fce196ad4a test/README.md: Add section explaining GitHub integration 2019-07-03 16:51:37 +02:00
Lars Karlitski f810924042 test: Output results for cockpit's log.html
Cockpit's log.html has a peculiar format, but parsing logs in html is
much easier, because it shows expandable sections for each test.
2019-06-25 23:50:16 +02:00
Lars Karlitski bad9e93c3c
Revert "test: Disable test_live_iso test"
Enable the live-iso test again.

This reverts commit 1ac75e98b4.

Fixes: #731
2019-06-25 10:24:51 +02:00
Lars Karlitski 33151372df test: Don't wait on --sit when test succeeds
Python's `filter()` returns a "filter object", which is truthy.
2019-06-04 20:13:18 +02:00
Lars Karlitski 42c7c0691c Monkey-patch beakerlib to fail on first assert
Beakerlib upstream can't do this yet, but might at some point:

https://github.com/beakerlib/beakerlib/issues/42

This is only enabled in combination with the `--sit` option of the
`test/check-*` scripts. It leaves the system in exacly the state it was
in when an assertion failed. Finishing the test run would run cleanup as
well (such as deleting created images). It also takes longer.
2019-06-04 20:12:54 +02:00
Lars Karlitski 4bd03cb8f6 Don't send CORS headers
These are meant for web applications that are accessed by browsers, not
REST APIs.
2019-06-04 20:10:03 +02:00
Lars Karlitski b50f1967c6 Add API integration test
Test the HTTP API directly from outside the VM by forwarding
/run/weldr/api.socket to a TCP port on the host.

This is only a start to test that the API always returns JSON (see
previous commit).
2019-06-04 11:50:25 +03:00
Alexander Todorov 3587ed3663 Split live-iso and qcow2 and update test scenario execution
this makes it possible to have more granular test execution
reported as separate statuses on GitHub. ATM we will have:

- cockpit/fedora-30
- cockpit/fedora-30/live-iso
- cockpit/fedora-30/qcow2
- cockpit/fedora-30/aws
- cockpit/fedora-30/azure
- cockpit/fedora-30/openstack
- cockpit/fedora-30/vmware
2019-05-31 12:57:23 +02:00
Alexander Todorov b71e8f74d8 Configure $PACKAGE for beakerlib reports
this makes it more clear that we are testing the installed RPM
instead of sources
2019-05-31 12:57:23 +02:00
Alexander Todorov 6c2b34bf15 Don't execute compose/blueprint sanity tests in Travis CI
instead they will be executed in Cockpit CI
2019-05-31 12:57:23 +02:00
Lars Karlitski c5ae344b4f test: Add --list option to test/check* scripts
Helps in figuring out which tests are in a file without having to open
it. Use like this:

    $ test/check-cli -l
    TestImages.test_live_iso
    TestImages.test_partitioned_disk
    TestImages.test_qcow2
    TestImages.test_tar
    TestSanity.test_blueprint_sanity
    TestSanity.test_compose_sanity

Names of classes containing multiple tests can be given, just like
normal:

    $ test/check-cli -l TestSanity
    TestSanity.test_blueprint_sanity
    TestSanity.test_compose_sanity
2019-05-29 13:53:02 +02:00
Lars Karlitski 5dda214c39 test: Add --sit argument to check-* scripts
Cockpit has this. It's very useful for debugging a failing test locally.
2019-05-24 17:27:50 +02:00
Lars Karlitski 29cf2c4e8c test: Custom main() function
It's not as full featured as unittest.main(), but this will allow us to
add custom command line arguments.
2019-05-24 17:27:50 +02:00
Lars Karlitski 1ac75e98b4 test: Disable test_live_iso test
https://github.com/weldr/lorax/issues/731
2019-05-24 00:23:21 +02:00
Martin Pitt 3b467f1cd7 test: Install beakerlib on non-RHEL images
Commit 4783f6562f introduced the assumption that beakerlib is already
installed in non-RHEL images. As the test script runs without `set -e`,
this hasn't been noticed as the test silently succeeds.

Go back to installing beakerlib everywhere.
2019-05-23 12:00:30 +02:00