Commit Graph

52 Commits

Author SHA1 Message Date
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
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
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
Brian C. Lane
cdfdb651f7 tests: kill the qemu process name used to start it
Related: rhbz#1710877
2019-06-24 10:33:37 +03:00
Alexander Todorov
9b5554aa1e tests: Change the way how we remove pyOpenSSL
the version coming from RPM is older and prevents installing
ansible[azure] via pip. OTOH removing with yum also removes
lorax-composer and breaks tests when running against the RPM
instead of git checkout (which will be the default with Cockpit CI).

Related: rhbz#1715003
2019-06-12 11:21:56 +03:00
Jiri Kortus
94892e56dd Use a less strict regex for disabled root account check
Related: rhbz#1687595
2019-05-13 15:31:27 +03:00
Jiri Kortus
481f33b898 Add test for passing custom option on kernel command line
Related: rhbz#1688335
2019-05-13 15:31:27 +03:00
Jiri Kortus
0980ddfc54 Use verify_image function as a helper for generic tests
Related: rhbz#1704209
2019-05-13 15:31:27 +03:00
Alexander Todorov
1bf7708830 Change [[modules]] to [[packages]] in tests
> bcl: this should really be [[packages]] since [[modules]] is
> going to change to actual modules at some point

Related: rhbz#1698366
2019-05-07 19:19:27 +03:00
Alexander Todorov
83707bfa06 Add new test to verify compose paths exist
because they are mentioned in the official documentation

Related: rhbz#1698366
2019-05-07 19:19:27 +03:00
Alexander Todorov
ff7d7c2d49 Add new sanity tests for blueprints
- verify SemVer .patch number will be automatically updated when
  we push the blueprint a second time without changing version
- verify show displays the content in TOML format and it matches
  what is on disk. Because of that also start with empty packages
  and groups fields in the initial toml. If they are missing they
  will be added automatically by lorax-composer and this simplifies
  the test
- verify delete works

Related: rhbz#1698366
2019-05-07 19:19:27 +03:00
Jiri Kortus
5b45593f3c Add test for starting compose with deleted blueprint
Related: rhbz#1683442
2019-04-24 14:14:40 +03:00
Jan Stodola
73de195334 Use existing storage account
To avoid creating a new storage account for every new VM.

Related: rhbz#1673012
2019-04-22 15:57:07 +03:00
Jan Stodola
fabf428f00 Record date/time of VM creation
Related: rhbz#1673012
2019-04-22 15:57:07 +03:00
Chris Roberts
2ebf60f28d Update datastore for VMware testing
Cluster and Network changed due to new hardware in RDU2 DC

Related: rhbz#1656105
2019-04-18 10:35:53 +03:00
Jiri Kortus
6fb94326e7 Fixes for locked root account test
Fixes related to a few issues in the locked root account test I somehow
managed to overlook in the initial commit.

Related: rhbz#1687595
2019-04-09 18:54:03 +03:00
Jiri Kortus
277d391f01 Add checks for disabled root account
The root account checks are applied to generated and deployed images
to make sure that root account is locked, except for live ISO.

Related: rhbz#1687595
2019-03-29 15:22:57 +02:00
Jiri Kortus
5d6446a7bd 'compose info' is 'compose details' on RHEL-7
Add the correct composer-cli command 'compose details' in places
where 'compose info' was still used on RHEL-7
(see commit 808454b561)

Related: rhbz#1687595
2019-03-29 14:44:53 +02:00
Chris Roberts
c6e8befe21 Update some grammer issues in the test Bash scripts
Related: rhbz#1656105
2019-03-22 12:15:38 +02:00
Chris Roberts
48a28e0950 Update datastore for VMware testing
Datastore switched from NFS to iSCSI

Related: rhbz#1656105
2019-03-22 12:11:56 +02:00
Alexander Todorov
64baf7c147 Allow overriding $CLI outside test scripts
this will allow you to test against installed RPM like so:

    # export CLI="/usr/bin/composer-cli"
    # make test_images

If you already have lorax-composer running then you can directly
execute test scripts:

    # ./tests/cli/test_build_and_deploy_aws.sh

Related: rhbz#1687595
2019-03-15 11:02:00 +02:00
Alexander Todorov
4fb3e42a70 New test: Build live-iso and boot with KVM
explicitly enables sshd for live-iso during testing

Related: rhbz#1656105
2019-03-04 22:08:43 +02:00
Alexander Todorov
561302a30a New test: Build qcow2 compose and test it with QEMU-KVM
Related: rhbz#1656105
2019-02-27 21:46:44 +02:00
Alexander Todorov
c24ad2fed7 New test: Verify tar images with Docker and systemd-nspawn
- on some arches (also Fedora x86_64) systemd-nspawn may not be
  available
- delete composes from other tests in rlPhaseStartCleanup because
  we're seeing the tar compose kind of hanging in Jenkins and that
  test script is executed last so the slave may be running out of
  disk space. Be a good citizen and clean up after the previous
  tests.

Related: rhbz#1656105
2019-02-27 21:46:44 +02:00
Alexander Todorov
41e3f8fecb Update OpenStack flavor and network settings in tests
b/c we've migrated to Upshift we must use different instance type,
specify the desired network to connect to and update how we get
the ip address of the launched VM.

Related: rhbz#1656105
2019-02-27 21:46:44 +02:00
Alexander Todorov
44a79a8a6b Install ansible and openstacksdk inside virtualenv
otherwise we get a conflict with python-ipaddress which is a
dependency of python2-pip and can't really be removed!

Installing from RPM is also a no-go b/c openstacksdk is
not available in EPEL 7. OTOH the RDO repositories which
OpenStack recommends have older version (0.11) and ansible wants
0.12 or later!

Related: rhbz#1656105
2019-02-27 21:46:44 +02:00
Alexander Todorov
2f51fcfb8b Remove python-requests, python-dateutil and pyOpenSSL
b/c they conflict with the modules coming from pip and
prevent azure/ansible installation

Related: rhbz#1656105
2019-02-27 21:46:44 +02:00
Jiri Kortus
56d0e704c0 Make sure compose build tests run with SELinux in enforcing mode
Related: rhbz#1654795
2019-02-06 13:59:17 +01:00
Alexander Todorov
2ac027c78b Upgrade pip & setuptools b/c they are rather old
and sometimes Python dependencies fail to install with:

SetuptoolsOutdatedWarning: your setuptools is too old (<12)
2019-01-09 10:55:58 +02:00
Alexander Todorov
177e62a896 Workaround openstacksdk dependency issue
See:
fd61b54679 (diff-b4ef698db8ca845e5845c4618278f29a)

Note: may also affect master/rhel8-branch but haven't seen it
so far. For master we can do:

	dnf install ansible python3-openstacksdk

Not so easy on RHEL 7
2018-12-20 10:55:04 +02:00
Alexander Todorov
7143456043 On Python 2 Azure needs the futures module
this will prevent
ImportError: No module named concurrent.futures

see
https://github.com/Azure/azure-sdk-for-python/issues/2166
2018-12-20 10:55:04 +02:00
Alexander Todorov
d63de76cb3 On RHEL 7 we have Python 2, not Python 3 2018-12-20 10:55:04 +02:00
Alexander Todorov
5dc19500ad On RHEL 7 we have yum instead of dnf 2018-12-20 10:55:04 +02:00