Commit Graph

201 Commits

Author SHA1 Message Date
Jiri Kortus
3e985d60ca Add test for running composer with --no-system-repos option
- add test coverage for rhbz#1650363
- cherry-picked from 5322664432

Related: rhbz#1785159
2020-04-27 11:19:38 -07:00
Jiri Kortus
828a516cb3 [tests] don't add only rel-eng optional repo for live-iso
Adding only rel-eng optional repo for live-iso can cause
broken dependencies if the base repo (nightly) contains
packages in newer versions than what is required by packages
in optional repo.

A better way in the live-iso test is to add a rel-eng or
nightly optional repo based on the already existing repos.

Fixes: rhbz#1826029
2020-04-27 13:24:11 +03:00
Jakub Rusz
4d28da3818 tests: remove --test=2 from compose_sanity
This ensures that after canceling a compose, the next one can be finished.

(cherry picked from commit 6924571d95)

Related: rhbz#1789451
2020-04-20 13:18:38 +03:00
Jakub Rusz
06f09b2335 Add test for canceling a running compose
This is a modification of an existing test for compose sanity.
Cherry picked from 8c9f528cd4

Related: rhbz#1789451
2020-04-20 13:18:38 +03:00
Chris Roberts
772e841a7f Update datastore for VMware testing
This change is needed for VMWare testing due to changes in the storage,
and the datastore we used before is not available for the time being.
Related: rhbz#1785159
2020-04-17 09:29:51 -07:00
Alexander Todorov
c56d57ef7e tests: pip install future
Resolves:
https://github.com/ansible/ansible/issues/68616
https://github.com/cockpit-project/bots/pull/636

Another posibility would be to `yum install python2-future` from
EPEL in vm.install instead.

Related: rhbz#1785159
2020-04-17 09:27:54 -07:00
Brian C. Lane
9291f3f3ea lorax-composer: Estimate metadata size required by Anaconda
Anaconda doesn't download the filelists or 'other' metadata, which can
add a significant amount of space to the metadata cache on the build
host. So to estimate the amount of space needed by Anaconda exclude the
space used by *filelists* and *other* files.

With these changes the lorax-composer estimate should actually be fairly
accurate. But since Anaconda only uses the installedsize * 1.35 we have
to make sure that the size we use is at least as big as what anaconda
will estimate, otherwise the installation will fail.

Resolves: rhbz#1761337
2020-04-17 09:08:53 -07:00
Brian C. Lane
64998d853d tests: Add serial console to images we boot in CI
In some cases it will not boot without a console, and the CI framework
defaults to using serial console. So set it on live-iso, qcow2, and the
final iso installed with liveimg.

Related: rhbz#1770193
2019-12-11 15:16:50 -08:00
Brian C. Lane
e51b00edca lorax-composer: Change cockpit.socket examples to cockpit
The RHEL7 version of Anaconda only allows .service units to be used with
the kickstart services command. Update the documentation, examples, and
tests to reflect this.

Related: rhbz#1718473
2019-12-06 11:01:55 -08:00
Alexander Todorov
c020cec968 tests: enable compose_ext4 test to use CDN repos
Cherry-picked from b903bf0abcf6fb12e308992b875d79d420c5ca74

Related: rhbz#1698366
2019-11-27 19:44:22 +02:00
Alexander Todorov
0d344e6cae tests: restart composer after adding optional reporsitory
b/c live-iso needs grub2-efi-*-cdboot from Optional

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Alexander Todorov
d11f5079f4 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

Cherry-picked from 2b578dcee8

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Alexander Todorov
92535addc8 DRY when setting up, running & parsing results for beakerlib tests
Cherry-picked from b197e448ff

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Brian C. Lane
3d3c32819c 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.

Cherry-picked from 454af0c5d5

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Alexander Todorov
ac1bcd9d1d 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.

Cherry-picked from d67745d755

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Alexander Todorov
33b9b46fb6 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.

Cherry-picked from e1b45958f4

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Brian C. Lane
bb57558603 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.

Cherry-picked from 4705ff3b1e

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Brian C. Lane
ad472685c9 tests: Use --http0.9 for curl ssh test
Cherry-picked from a0ae10c2d7

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Brian C. Lane
742a245719 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.

Cherry-picked from e3654e8297

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Brian C. Lane
5cdd01be36 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.

Cherry-picked from b8bf258a3c

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Alexander Todorov
8b8f5355bf [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

Cherry-picked from 8af9723c

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Jiri Kortus
a8d7841bc1 [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.

Cherry-picked from 836f0ddf

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Alexander Todorov
78fbb7c49e [tests] Use functions for starting and stopping lorax-composer
Cherry-picked from f978d4b01c

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00
Brian C. Lane
8e650d1d07 Update for differences from py3 in the backported code
In py3 dicts are not predictable, make sure the keys are sorted so that
the tests are useful.

Use StringIO.StringIO instead of io.StringIO which requires unicode
text.

kickstart timezone.ntpservers is a set() so adjust the test for it.

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
406dddafef Remove repos.git related tests
Support is not included in this patchset.

(cherry picked from commit a643522769)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
39f464d46b composer-cli: Update diff support for customizations and repos.git
composer-cli will now output information about changes to customizations
entries and the repos.git entries.

(cherry picked from commit 156ef0acfd)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
f0efcd9b0f Add support for customizations and repos.git to /blueprints/diff/
This also includes extensive tests for each of the currently supported
customizations. It should be generic enough to continue working as long
as the list of dicts includes a 'name' or 'user' field in the dict.
Otherwise support for a new dict key will need to be added to the
customizations_diff function.

(cherry picked from commit 850c490b6e)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
e2262e57e3 tests: Update custom-base with customizations
(cherry picked from commit 9724731b8d)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
b4a95b8d2b Change customizations.firewall to append items instead of replace
To maintain consistency with the other options this changes firewall to
combine the existing settings from the image template with the settings
from the blueprint.

Also updated the docs, added a new test for it, and sorted the output
for consistency.

(cherry picked from commit 3e08389a0f)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
f2209932a6 lorax-composer: Add services support to blueprints
Add support for enabling and disabling systemd services in the
blueprint. It works like this:

    [customizations.services]
    enabled = ["sshd", "cockpit.socket", "httpd"]
    disabled = ["postfix", "telnetd"]

They are *added* to any existing settings in the kickstart templates.

(cherry picked from commit 1111aee92d)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
780f00d81a lorax-composer: Add firewall support to blueprints
You can now open ports in the firewall, using port numbers or service
names:

    [customizations.firewall]
    ports = ["22:tcp", "80:tcp", "imap:tcp", "53:tcp", "53:udp"]

Or enable/disable services registered with firewalld:

     [customizations.firewall.services]
     enabled = ["ftp", "ntp", "dhcp"]
     disabled = ["telnet"]

If the template contains firewall --disabled it cannot be overridden,
under the assumption that it is required for the image to boot in the
selected environment.

(cherry picked from commit 4d35668ab5)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
a9c5581aa9 lorax-composer: Add locale support to blueprints
You can now set the keyboard layout and language. Eg.

[customizations.locale]
languages = ["en_CA.utf8", "en_HK.utf8"]
keyboard = "de (dvorak)"

Existing entries in the kickstart templates are replaced with the new
ones. If there are no entries then it will default to 'keyboard us' and
'lang en_US.UTF-8'

Includes tests, and leaves the existing keyboard and lang entries in the
templates with a note that they can be replaced by the blueprint.

(cherry picked from commit e5a8700bdf)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Brian C. Lane
956ebfc77c lorax-composer: Add timezone support to blueprint
For example:

[customizations.timezone]
timezone = "US/Samoa"
ntpservers = ["0.pool.ntp.org"]

Also includes tests.

This removes the timezone kickstart command from all of the templates
except for google.ks which needs to set it's own ntp servers and timezone.

If timezone isn't included in the blueprint, and it is not already in a
template, it will be set to 'timezone UTC' by default.

If timezone is set in a template it is left as-is, under the assumption
that the image type requires it to boot correctly.

(cherry picked from commit 9bdbb29662)

Related: rhbz#1718473
2019-11-18 12:36:18 +02:00
Alexander Todorov
e34201c0bd tests: Document Azure setup 2019-10-21 20:51:20 +03:00
Jiri Kortus
22acf067cd tests: Add kickstart tar installation test
Related: rhbz#1733504
2019-10-04 12:09:12 +03:00
Jiri Kortus
64f00d94b8 tests: add option to disable kernel command line parameters check
Related: rhbz#1733504
2019-10-04 12:09:12 +03:00
Brian C. Lane
c2c6bfa458 tests: Use a loop to wait for VM and sshd to start
Related: rhbz#1733504
2019-10-04 12:09:12 +03:00
Brian C. Lane
9d7fcc8642 tests: Drop sort from compose types test
The output from the API is already sorted, and 'sort' changes this
ordering in some situations.

Related: rhbz#1749802
2019-09-13 14:05:42 +03:00
Alexander Todorov
80c69f0621 New test: assert toml files in git workspace
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#1749802
2019-09-13 14:05:42 +03:00
Alexander Todorov
22de8ed603 Ignore Cockpit CI files when linting
- these files are executed under Python 3 while the linter
  is Python 2 for RHEL 7 so we just ingore them
- also reverts the changes introduced to make these files Py2
  compatible, making them the same as on master branch

Related: rhbz#1698366
2019-09-13 11:27:12 +03:00
Alexander Todorov
b38a358ea3 Use optional repository in Live ISO test
live-iso image type needs grub2-efi-*-cdboot from optional.

Related: rhbz#1698366
2019-09-13 11:27:12 +03:00
Alexander Todorov
77649cbf76 Install test dependencies inside virtualenv
Related: rhbz#1698366
2019-09-13 11:27:12 +03:00
Alexander Todorov
89e56aa3b4 Install python2-pip in the test VM and disable EPEL repo
so we don't use EPEL when actually building the images

Related: rhbz#1698366
2019-09-13 11:27:12 +03:00
Alexander Todorov
2136d88cd6 Use qemu-kvm in tests instead of qemu-system
Related: rhbz#1698366
2019-09-13 11:27:12 +03:00
Alexander Todorov
3d27053605 Don't hard-code the path to toml-compare
Related: rhbz#1698366
2019-09-13 11:27:12 +03:00
Alexander Todorov
d97ff118d9 Prevent ssh asking for password when testing on interactive terminal
Related: rhbz#1704209
2019-09-13 11:27:12 +03:00
Alexander Todorov
9bce583fc2 Fix typo from test backport
Related: rhbz#1698366
2019-09-13 11:27:12 +03:00
Jiri Kortus
b0b603dc2e Use passwd --status for locked root account check
Related: rhbz#1687595
2019-07-10 09:17:58 +02:00
Alexander Todorov
8734f662e9 Backport changes for Cockpit CI
Related: rhbz#1698366
2019-06-25 11:57:33 +03:00
Lars Karlitski
fd2e1738ab test_compose_tar: Fix docker test
The docker phase always failed because `-ti` was passed even though the
the output was not a terminal. Moreover docker service isn't running by
default on RHEL-7, so it's necessary to start it first explicitly.

Related: rhbz#1720224
2019-06-24 10:33:37 +03:00