Commit Graph

210 Commits

Author SHA1 Message Date
Brian C. Lane
493055c03c 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#1769525
2019-11-08 13:57:35 +02:00
Brian C. Lane
020fd300a4 tests: Use --http0.9 for curl ssh test
Cherry-picked from a0ae10c2d7

Related: rhbz#1769525
2019-11-08 13:57:35 +02:00
Brian C. Lane
f87db8844f 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#1769525
2019-11-08 13:57:35 +02:00
Brian C. Lane
e7cfd20ca3 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#1769525
2019-11-08 13:57:35 +02:00
Alexander Todorov
29cfda8eae [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#1769525
2019-11-08 13:57:35 +02:00
Jiri Kortus
16daa25137 [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#1769525
2019-11-08 13:57:35 +02:00
Alexander Todorov
e7f2706461 [tests] Use functions for starting and stopping lorax-composer
Cherry-picked from f978d4b01c

Related: rhbz#1769525
2019-11-08 13:57:35 +02:00
Jiri Kortus
71a666507b tests: Add kickstart tar installation test
Related: rhbz#1733975
2019-11-05 11:30:56 +02:00
Jiri Kortus
1f7efc3bba tests: add option to disable kernel command line parameters check
Related: rhbz#1733975
2019-11-05 11:30:56 +02:00
Brian C. Lane
3b0bb5718c tests: Use a loop to wait for VM and sshd to start
Related: rhbz#1733975
2019-11-05 11:30:56 +02:00
Brian C. Lane
c11a8b8018 tests: Add tests for recipe checking functions
(cherry picked from commit f1733369fa)

Related: rhbz#1716596
2019-10-31 10:11:13 -07:00
Brian C. Lane
229253b0cb lorax-composer: Add basic recipe checker function
This makes sure that required fields are included, and that sections are
not empty. It does not check for all optional fields.

If there are errors it will gather up all of them and then raise a
RecipeError with a string of all the errors.

(cherry picked from commit 61059a2699)

Resolves: rhbz#1716596
2019-10-31 10:11:13 -07:00
Brian C. Lane
140f40f6be 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

Resolves: rhbz#1751998
2019-10-28 17:03:18 -07:00
Alexander Todorov
305dc9b7f6 tests: Document Azure setup 2019-10-21 20:50:22 +03:00
Brian C. Lane
ecc1ab705b tests: Add check to make sure the compose actually finished
Previously it was looping, waiting for FINISHED|FAILED but was not
actually failing the test if the compose failed to build.
This adds a function to check the status of the compose and calls it
after each compose.

(cherry picked from commit d0e947fe3b)

Related: rhbz#1724073
2019-09-11 14:16:27 +03:00
Alexander Todorov
dcb4c1a0e5 Backport Cockpit CI changes for RHEL 8
Notes:

- also install podman-docker
- on RHEL 8 there's no docker.service to start

Related: rhbz#1724073
2019-09-11 14:16:27 +03:00
Brian C. Lane
c96beac237 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#1714103
2019-09-02 15:00:25 +03:00
Alexander Todorov
d538aa9176 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#1714103
2019-09-02 15:00:25 +03:00
Jiri Kortus
91cfdb277e Use passwd --status for locked root account check
Related: rhbz#1728571
2019-07-11 11:55:22 +03:00
Evan Goode
4ac29da334 Assert that RuntimeErrors have correct messages
Related: rhbz#1709594

Signed-off-by: Brian C. Lane <bcl@redhat.com>
2019-06-27 08:54:20 -07:00
Brian C. Lane
a2fcd9c387 Add more tests for gitrpm.py
Make sure that dotfiles are installed when not directly under /
Make sure / is not packaged in the rpm (it will cause a conflict with
the filesystem package).
Make sure that using destination="/" works

(cherry picked from commit 6fd06c6931)

Related: rhbz#1709594
2019-06-26 16:14:40 -07:00
Brian C. Lane
666e1fa9f0 Add tests using repos.git in blueprints
- Check final-kickstart.ks for the rpm source
- Check final-kickstart.ks for the rpm package name and version
- Make sure depsolve works
- Make sure errors from a bad repo are returned correctly
- Make sure errors from a bad reference are returned correctly

This moves _wait_for_status into a helper function so it can be shared
between the test classes.

(cherry picked from commit 8c2184d59e)

Related: rhbz#1709594
2019-06-26 16:14:40 -07:00
Brian C. Lane
8bf423592f Move git repo creation into tests/lib.py
This way it can be shared with test_server.py

(cherry picked from commit 02f757d231)

Related: rhbz#1709594
2019-06-26 16:14:40 -07:00
Brian C. Lane
adede63a95 rpmgit: catch potential errors while running git
Log them and report them as RuntimeError. Also add a couple tests for
them.

(cherry picked from commit 61efa91a03)

Related: rhbz#1709594
2019-06-26 16:14:40 -07:00
Brian C. Lane
b3b1180b7b tests: Add test for Recipe.freeze() function
The freeze function was not being tested. Add a test for it using the
repos.git test recipe.

(cherry picked from commit c26477a63c)

Related: rhbz#1709594
2019-06-26 16:14:40 -07:00
Brian C. Lane
20389c912f Add repos.git support to lorax-composer builds
This hooks up creation of the rpm to the build, adds it to the
kickstart, and passes the url to Anaconda. The dnf repo with the rpms is
created under the results directory so it will be included when
downloading the build's results.

(cherry picked from commit cd8c884adb)

Related: rhbz#1709594
2019-06-26 16:14:40 -07:00
Brian C. Lane
3b288f0779 Add pylorax.api.gitrpm module and tests
This handles creating the rpm from the dictionary describing the
repository and rpm. Also adds tests for archive and rpm creation.

(cherry picked from commit f6f2308765)

Related: rhbz#1709594
2019-06-26 16:14:40 -07:00
Brian C. Lane
f5113542b1 Add support for [[repos.git]] section to blueprints
This adds support, documentation, and testing for a [[repos.git]]
blueprint section that can be used to install files from a git
repository. It will create an rpm that will be added to the build,
and included in the metadata that can be downloaded. This allows you to
accurately keep track of the source of configuration files and extra
metadata that is added to the build.

The source repo and reference will be listed in the rpm's summary making
it easy to discover on the installed system.

(cherry picked from commit d7b96c8f0f)

Resolves: rhbz#1709594
2019-06-26 16:14:40 -07:00
Alexander Todorov
0e16a2dfbc [tests] Handle blueprints in setup_tests/teardown_tests correctly
It's necessary to make sure the blueprints directory doesn't contain
the git/ directory before the tests are run, so that we can just simply
modify the blueprint files without using blueprints push.

Related: rhbz#1714298
2019-06-12 13:40:57 +03:00
Lars Karlitski
8e5140dc8d tests: Set BLUEPRINTS_DIR in all cases
`setup_tests()` expected BLUEPRINTS_DIR to be set, but it wasn't when
running in automated mode (with $CLI set).

Fix this and move share and blueprint dirs to function arguments.

Related: rhbz#1714298
2019-06-12 13:40:57 +03:00
Brian C. Lane
0557f5adda tests: Update openssh-server to version *
Related: rhbz#1678937
2019-06-10 20:04:39 +03:00
Brian C. Lane
a643522769 Remove repos.git related tests
Support is not included in this patchset.

Related: rhbz#1709595
2019-05-30 09:30:35 -07:00
Brian C. Lane
724ca8b56d 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#1709595
2019-05-29 16:35:42 -07:00
Brian C. Lane
eb59a1a26e 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#1709595
2019-05-29 16:35:07 -07:00
Brian C. Lane
a78ede3997 tests: Update custom-base with customizations
(cherry picked from commit 9724731b8d)

Related: rhbz#1709595
2019-05-29 16:34:35 -07:00
Brian C. Lane
9f0dd17e2f 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)

Resolves: rhbz#1709595
2019-05-29 16:29:17 -07:00
Brian C. Lane
cdf0cbbc5e 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#1709595
2019-05-29 15:22:30 -07:00
Brian C. Lane
59bad712ad 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#1709595
2019-05-29 15:21:34 -07:00
Brian C. Lane
ad6fe6cffd 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#1709595
2019-05-29 15:20:28 -07:00
Brian C. Lane
10e46c9178 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#1709595
2019-05-29 15:14:58 -07:00
Brian C. Lane
dbee219e13 Revert "lorax-composer: Check for CDN only repos"
This reverts commit f1af108e5b.

Related: rhbz#1691969
2019-05-13 12:03:39 -07:00
Jiri Kortus
755e71b542 Add test for passing custom option on kernel command line
Related: rhbz#1687743
2019-04-29 12:52:22 +03:00
Jiri Kortus
81ad0509f2 Use verify_image function as a helper for generic tests
Related: rhbz#1704172
2019-04-29 12:52:22 +03:00
Alexander Todorov
07a64aab07 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#1698368
2019-04-19 13:52:32 +03:00
Alexander Todorov
b735c8ce0c Add new test to verify compose paths exist
because they are mentioned in the official documentation

Related: rhbz#1698368
2019-04-19 13:52:32 +03:00
Alexander Todorov
c9978b800c 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#1698368
2019-04-19 13:52:32 +03:00
Chris Roberts
41d4d78f00 Update VMware info for VMware testing
Cluster and Network changed due to new hardware in RDU2 DC

Related: rhbz#1678937
2019-04-18 10:34:55 +03:00
Jiri Kortus
e5fb0b3f37 Add test for starting compose with deleted blueprint
Related: rhbz#1699303
2019-04-17 13:41:42 +03:00
Jiri Kortus
5962533e56 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#1698473
2019-04-17 13:39:39 +03:00
Brian C. Lane
20a9b4fff3 Only use repos with valid urls for test_server.py
libdnf-0.22.5-5 changed something and now the repos with fake urls are
failing when loaded by test_server.py (they still work fine with
test_projects.py) so only use the 'good' repos with the test_server.py
tests -- the others weren't needed for any of its tests anyway.

Related: rhbz#1678937
2019-04-05 11:05:58 -07:00
Brian C. Lane
e85174abce Use strict=False when reading repo files
In some cases they may contain duplicate sections. With it set to False
the last one wins instead of causing a traceback.

Related: rhbz#1678937
2019-04-05 11:05:58 -07:00
Brian C. Lane
a30afe6e5c tests: Skip docs if not installed
And make buildstamp test ignore the version number, since it might be
devel or it might be an actual version when running against the
installed package.

Related: rhbz#1678937
2019-04-05 11:05:58 -07:00
Brian C. Lane
dd2446faf6 tests: Make sure example-development is present for delete test
Use it for the save, delete, push testing for composer-cli
tests. Otherwise the test runs fine the first time and fails after that
if you don't re-install the test environment.

Related: rhbz#1678937
2019-04-05 11:05:58 -07:00
Brian C. Lane
6242ae8b18 tests: Make it easier to update version globs
Use constants so we won't have to edit a dozen places in the test when
the package versions are bumped.

Related: rhbz#1678937
2019-04-05 11:05:58 -07:00
Brian C. Lane
a2252112d4 tests: Select the group to use based on the release
Use c-development on fedora and development on RHEL

Related: rhbz#1678937
2019-04-05 11:05:58 -07:00
David Shea
0467377810 Add a compose type for alibaba.
This compose type creates a partitioned disk as a qcow2 file, but with
only one partition instead of using a separate /boot.

(cherry picked from commit 44e14176bb)

Resolves: rhbz#1689140
2019-04-05 11:38:01 -04:00
David Shea
138db14acd Add a compose check for google cloud images.
(cherry picked from commit c6fcf9d1eb)

Related: rhbz#1689140
2019-04-05 11:32:30 -04:00
David Shea
49810847c4 Add a compose type for Google Compute Engine
(cherry picked from commit bd804c271b)

Resolved: rhbz#1689140
2019-04-05 11:31:56 -04:00
David Shea
a9bb68b26f Add an option to align the image size to a multiplier.
If provided, round the disk image size up to a multiple of the value.
This allows for image formats with specific size-alignment requirements
(e.g., disk size must be in GiB).

(cherry picked from commit 8ef4f431d8)

Related: rhbz#1689140
2019-04-05 11:30:19 -04:00
Jiri Kortus
9e0e2b718f 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#1626122
2019-03-29 23:13:01 +02:00
Brian C. Lane
d7f5f3064b lorax-composer: pass customization.kernel append to extra_boot_args
This allows iso builds to include the extra kernel boot parameters by
passing them to the arch-specific live/*tmpl template.

Also adds tests to make sure it is written to config.toml in the build
metadata.

Resolves: rhbz#1687743
2019-03-27 11:32:19 -07:00
Brian C. Lane
010031a46c lorax-composer: Add the ability to append to the kernel command-line
Sometimes it is necessary to modify the kernel command-line of the
image, this adds support for a [customizations.kernel] section to the
blueprint:

[customizations.kernel]
append = "nosmt=force"

This will be appended to the kickstart's bootloader --append argument.

Includes tests for modifying the bootloader line, the kickstart
template, and examining the final-kickstart.ks created for a compose.

Related: rhbz#1687743
2019-03-27 11:32:19 -07:00
Brian C. Lane
b399076cb0 lorax-composer: Return UnknownBlueprint errors when using deleted blueprints
Reading a blueprint wasn't checking to see if it had been deleted so it
was returning the most recent commit before it had been deleted. This
allowed things like starting a compose with a blueprint that technically
doesn't exist.

One exception to this is the /changes/ route, it must be available so
that you can use the commit hash to undo a delete.

This also adds tests for the various operations.

(cherry picked from commit d32f477e0b)

Resolves: rhbz#1683441
2019-03-27 10:54:47 -07:00
Brian C. Lane
da6e228753 lorax-composer: Delete workspace copy when deleting blueprint
Also extends the blueprint delete test to also check the workspace.

(cherry picked from commit 26bd2c1378)

Related: rhbz#1683441
2019-03-27 10:54:13 -07:00
Brian C. Lane
e90e7653df Move the package requirements for live-iso setup out of the template
In order to support iso creation on multiple arches with the templates
we need to be able to select different packages based on arch.
lorax-composer uses the arch-specific Lorax templates in order to
generate the output iso so this patch:

1. Creates a new template and type to parse it, live-install.tmpl
   which contains only installpkg commands and #if clauses for arch
2. Removes bootloader related packages from the live-iso.ks
3. Remove dracut-config-rescue exclusion because it can cause problems
   with some blueprints.
4. Switch logo requirement to system-logos which is satisfied by
   generic-logos or fedora-logos. This prevents conflicts when a blueprint
   installs fedora-release-workstation.

So in the future, if x86.tmpl, etc. need a new package to support
creating the iso it should be added to the correct section in
./share/live/live-install.tmpl

Resolves: rhbz#1673744
2019-03-21 14:48:27 -07:00
Brian C. Lane
776bb18cee livemedia-creator: Add support for reqpart kickstart command
reqpart can be used to make kickstarts more platform agnostic, creating
needed partitions without lmc having to keep track of the arch-specific
needs. eg. ppc64 needs prepboot and /boot

This increases the size of the disk based on whether reqpart or
reqpart --add-boot is in the kickstart.

Note that this is only valid for partitioned disk output types, not
for filesystem images or live iso output.

Related: rhbz#1673744
2019-03-21 14:48:27 -07:00
Brian C. Lane
d37cf8d0d5 Add get_file_magic to tests/lib.py
Related: rhbz#1673744
2019-03-21 14:48:27 -07:00
Brian C. Lane
1f716641cf Clarify the ks repo only error message
This also moves the run_creator kickstart checks into check_kickstart
so that tests may be added.

Related: rhbz#1673744
2019-03-21 14:48:27 -07:00
Brian C. Lane
3d72aea6b2 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.

Related: rhbz#1673744
2019-03-21 14:48:27 -07:00
Brian C. Lane
57e3329250 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.

Related: rhbz#1673744
2019-03-21 14:48:27 -07:00
Chris Roberts
6b4b3d98a8 Update VMware datastore location to unblock tests
Datastore switched from NFS to iSCSI

Related: rhbz#1678937
2019-03-21 11:27:12 -07:00
Alexander Todorov
551723816c 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#1678937
2019-03-15 11:03:38 +02:00
Alexander Todorov
82492a54bc New test: Build live-iso and boot with KVM
explicitly enables sshd for live-iso during testing

Related: rhbz#1653934
2019-03-04 22:08:22 +02:00
Alexander Todorov
e78e0e610c New test: Build qcow2 compose and test it with QEMU-KVM
Related: rhbz#1653934
2019-03-04 13:18:35 +02:00
Alexander Todorov
50febb4381 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#1653934
2019-02-19 21:16:40 +02:00
Alexander Todorov
b6e86b4216 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#1653934
2019-02-18 12:15:37 +02:00
Jan Stodola
6d477a403a Use existing storage account
To avoid creating a new storage account for every new VM.

Related: rhbz#1653934
2019-02-06 19:19:35 +01:00
Jan Stodola
9d34481d9b Record date/time of VM creation
Related: rhbz#1653934
2019-02-06 19:19:35 +01:00
Jiri Kortus
e019ec2822 Make sure compose build tests run with SELinux in enforcing mode
Related: rhbz#1645189
2019-02-06 12:16:25 +01:00
Jan Stodola
595f11cc10 Expand parameters as separate words
Related: rhbz#1653934
2019-01-28 12:28:23 +02:00
Alexander Todorov
bee2593a13 Add /usr/local/bin to PATH for tests
pip3 will install commands there and later scripts will not be able
to find them.

Related rhbz#1653934
2019-01-24 12:51:01 +02:00
Alexander Todorov
fa8a29972a Do not generate journal.xml from beakerlib
bacause this requires additional Python modules and we don't
really use it!

Related: rhbz#1653934
2019-01-24 12:51:01 +02:00
Alexander Todorov
f54c0bf104 Use any tmux version
the unittest suite is currently executed on Fedora where tmux is
version 2.8 but on RHEL 8 it is 2.7 and depsolve fails when
building images.

Related: rhbz#1653934
2019-01-24 12:51:01 +02:00
Alexander Todorov
b4c1e7c6a8 Make test scripts executable with chmod +x
because this is how Jenkins expects them to be

Related: rhbz#1653934
2019-01-24 12:51:01 +02:00
Alexander Todorov
d61ba3a2cc tmux is version 2.8 on Fedora 28
Related: rhbz#1653934
2019-01-11 14:37:01 -08:00
Alexander Todorov
55bdb8a27a Backport cloud image tests to RHEL 8
Related: rhbz#1653934

note: for now use Fedora 28 for the Docker container until
CentOS 8 is released or we figure out how to use subscriptions
for official RHEL 8 images.
2019-01-11 14:37:01 -08:00
Brian C. Lane
7dad328424 Remove unneeded else from for/else loop. It confuses pylint
(cherry picked from commit 2950f2641b)

Related: rhbz#1664485
2019-01-09 16:26:35 -08:00
David Shea
59e2da0a96 Allow customizations to be specified as a toml list
Support both

  [customizations]
  hostname = "whatever"

and

  [[customizations]]
  hostname = "whatever"

in the blueprint data. The [[ syntax matches the other customization
directives (user, group, sshkey), and as such it's easy to accidentally
use it for the hostname without even realizing it's specifying something
different.

Add some tests for converting customizations to kickstarts.

(cherry picked from commit 35ab6a1336)

Resolves: rhbz#1664485
2019-01-09 16:22:21 -08:00
Brian C. Lane
663a0dcd73 lorax-composer: Handle packages with multiple builds
When the repository has multiple arches, eg. i686 and x86_64, it should
add a new entry to the project's builds list, not create a new project
in the list.

This handles that by adding a modified insort_left function and
examining the packages returned from dnf to make sure they aren't
already listed in the results. It also handles adding them in sorted
order so that no further sorting needs to be done on the results.

Resolves: rhbz#1656642
2018-12-07 11:54:02 -08:00
Brian C. Lane
36fb75abd2 Adjust test_drtfr_gpgkey to pass on Fedora 28 and RHEL 8
Depending on which version of dnf is installed it may return a tuple, or
may return a list. Work around this by only comparing the 1st element of
it.

Related: rhbz#1655876
2018-12-07 11:52:22 -08:00
Brian C. Lane
660e250804 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.

(cherry picked from commit 27aff75aa3)

Related: rhbz#1655876
2018-12-07 11:52:22 -08:00
Brian C. Lane
f1af108e5b lorax-composer: Check for CDN only repos
Anaconda is currently not able to handle cdn repo urls in the kickstart.
Add a new function that checks for extra repos and returns True.

Related: rhbz#1655623
2018-12-07 11:50:52 -08:00
Brian C. Lane
f0bac40d7f lorax-composer: Check the queue and results at startup
If the system ran out of space, or was rebooted unexpectedly, the state
of the queue symlinks, or the results STATUS files may be inconsistent.
This checks them and:
 * Removes broken symlinks from queue/new and queue/run
 * Removes symlinks from run and sets the build to FAILED
 * Sets builds w/o a STATUS to FAILED
 * Sets builds with STATUS of RUNNING to FAILED
 * Creates missing queue/new symlinks to results with STATUS of WAITING

So, any builds that were running during the reboot will be FAILED, and
any that were waiting to be started will be started upon rebooting.

Resolves: rhbz#1647985
(cherry picked from commit 4dd9004d13)
2018-12-06 15:27:48 -08:00
Brian C. Lane
58236a6b61 Add an openstack image type
This is a qcow2 image with cloud-init in the template.

(cherry picked from commit 98f8b23129)

Resolves: rhbz#1628645
2018-10-09 11:55:30 -07:00
Brian C. Lane
0ad0a47968 Update cli tests to use composer-cli name
Related: rhbz#1635763
2018-10-08 16:22:20 -07:00
Brian C. Lane
b1a2d635d0 Adjust the composer-cli tests for the rename to composer
Related: rhbz#1635763
2018-10-05 08:30:34 -07:00
Brian C. Lane
212e0bcb3e 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:29:33 -07:00
Brian C. Lane
de3294280b 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.

Related: rhbz#1613058
2018-10-02 16:50:28 -07:00
Alexander Todorov
920aed16e2 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-10-02 22:52:57 +02:00
Alexander Todorov
959589652b 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-10-02 22:52:57 +02:00