Commit graph

1076 commits

Author SHA1 Message Date
Tom Gundersen
046d08b8ef test/cases: add rhel8.2 tests for x86_65
Generated with

$ sudo ./tools/test-case-generators/generate-test-cases --distro rhel-82 --arch x86_64 --store .osbuild/ --output test/cases/

(Partially) fixes #542.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-04-28 11:10:12 +02:00
Tom Gundersen
f3ad87ea0b test/cases: add f32 tests for x86_64
Generated with

$ sudo ./tools/test-case-generators/generate-test-cases --distro fedora-32 --arch x86_64 --store .osbuild/ --output test/cases/

Fixes #544.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-04-28 11:10:12 +02:00
Tom Gundersen
1d1dcfefb6 tools/generate-test-cases/repos: add GPG keys and update to most recent
Update RHEL-8.2 to the most recent RC now that it has been released.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-04-28 11:10:12 +02:00
Tom Gundersen
b7268b2948 test/README: mention the tests cases and how to generate them
Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-04-28 11:10:12 +02:00
Ondřej Budai
e235fdedb3 tests/image: boot the vhd images on Azure
Previously, vhd images were tested using QEMU. This commit changes that to
boot them in the actual Azure infrastructure.

Azure VMs have quite a lot of dependencies - a network interface, a virtual
network, a network security group, a public ip address and a disk. Azure CLI
and Azure Portal handle the creation of all these resources internally.
However, when using the API, the caller is responsible to create all these
resources before creating an actual VM.

To handle the creation of all the resources in the right order, a deployment
is used. A deployment is a set of resources defined in a JSON document.
It can optionally take parameters to customize each deployment. After the
deployment is finished, the VM is up and ready to be tested using SSH.

Sadly, the deployments are a bit hard to clean-up. One would expect that
deleting a deployment removes all the deployed resources. However, it doesn't
work this way and therefore it's needed to clean up all resources "manually".
For this reason, our deployment sets a unique tag on all the resources created
by the deployment. After this test is finished, the API is queried for all
the resources with the tag and then, they're deleted in the right order.
2020-04-27 20:34:20 +02:00
Ondřej Budai
10c016edca vendor Azure SDK
This should actually be a part of the next commit, but that would make the
review hard, so I decided to create a separate commit just for vendoring.
2020-04-27 20:34:20 +02:00
Ondřej Budai
0041ae5655 tests/image: move constants to a subpackage
The cmd/osbuild-image-tests package is becoming bigger than I would like to.
It will be nice to split it to some smaller pieces at some point.
This commit does the first step - splits off the first subpackage containing
all the constants.
2020-04-27 20:34:20 +02:00
Ondřej Budai
b109ec878e cmd/osbuild-upload-azure: improve error message on wrong arguments
After this commit osbuild-upload-azure tool returns the help text when wrong
arguments were passed to it.
2020-04-27 20:34:20 +02:00
Ondřej Budai
181128c5b9 worker: fix missing logs when osbuild fails
The commit 2435163f broke sending the logs to osbuild-composer. This was
partly because of unusual error handling in the RunOSBuild function.

This commit fixes that by creating a custom error and properly propagating
the result from it.
2020-04-27 19:36:22 +02:00
Major Hayden
a613f778c2 Remove incomplete comment
Signed-off-by: Major Hayden <major@redhat.com>
2020-04-27 11:57:17 +02:00
Major Hayden
8dd6fd24b5 Use download.fp.o for downloading packages
Requests to download.fedoraproject.org are redirected to a regional
mirror that is fairly close to the system that is making the request.
This could speed up downloads slightly since it avoids using the
Fedora proxies.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-27 11:57:17 +02:00
Major Hayden
340cbe32ad Show test results in a better format
Signed-off-by: Major Hayden <major@redhat.com>
2020-04-27 11:57:17 +02:00
Major Hayden
39bebe5944 Fix debug loop variable
Signed-off-by: Major Hayden <major@redhat.com>
2020-04-27 11:57:17 +02:00
Alexander Todorov
7ce08bc788 tests: Make sure TestMain cleans up after itself
os.Exit() doesn't execute defer-ed functions, OTOH we call panic()
in case of setup errors, which does run defer-ed functions. So move
the actual test setup and execution in a separate function which will
execute all defer-ed functions and return the exit code from the
test suite to TestMain.
2020-04-27 11:53:45 +02:00
Major Hayden
5fd2590579 🚚 Run image build test cases together
Pass all of the image test cases directly to the test runner to speed
up the image test process.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-24 14:05:21 +00:00
Ondřej Budai
7b784aaa7e tests/image: drop support for raw.xz images
raw.xz is not used anymore, let's drop the dead code.

Yay, deleting code!
2020-04-24 15:27:39 +02:00
Ondřej Budai
8f351026d8 tests/image: drop the qemu-extract boot type
Previous commit switched the ami output type to qemu boot type, therefore
qemu-extract is not needed anymore.
2020-04-24 15:27:39 +02:00
Ondřej Budai
83a3a8d821 change the format of the ami image type to vhdx
Prior this commit the ami image type produced raw.xz images. This was bad for
two reasons:

- The upload was broken because AWS doesn't support tar.xz format
- XZ compression is terribly slow

This commit changes the format to vhdx, which is supported by AWS and also
quite quick. See https://github.com/osbuild/osbuild-composer/issues/257
why vhdx was chosen.

Fixes #257
2020-04-24 15:27:39 +02:00
Ondřej Budai
5d77188de0 bump osbuild to version 12
We will soon need the support for vhdx format, which is supported since
osbuild 12.

This commit bumps the dependency in the spec file and also updates the
submodule.
2020-04-24 15:27:39 +02:00
Ondřej Budai
f21e86cd8c workflow: enable updates-testing repo when installing osbuild on f31
This is the same fix as in 7ff15e1f, but for the old package (and therefore
for f31).

Copy of the 7ff15e1f commit message:

The source of issue here is that our release cycles are synchronized and
if we want to use the latest released osbuild we need to wait for the
bodhi process. It makes sense that we don't want to use latest osbuild
from git master but we should be confident enough in the version we
submit to bodhi.

Using the version from updates-testing therefore fixes the issue with
synchronization and avoids using unreleased versions.
2020-04-24 15:27:39 +02:00
Jakub Rusz
32844d605a vendor: add github.com/stretchr/testify/suite 2020-04-24 11:46:13 +02:00
Jakub Rusz
42efce2811 tests: add coverage for store.go
This adds coverage for the methods working with Blueprints
2020-04-24 11:46:13 +02:00
Jiri Kortus
ae5924d29a Improve coverage for distro packages - F30
Refs: #442
2020-04-24 11:16:39 +02:00
Jiri Kortus
46e230212b Make TestDistro_Manifest more versatile
Move TestDistro_Manifest to a separate package and make it parametric,
so that it can be used to test specific distros.

Refs: #442
2020-04-24 11:16:39 +02:00
Major Hayden
8d59d0c798 🐫 Handle base/image test cases
Speed up test run times by putting base tests and image tests into two
separate jobs in Jenkins. Add support to the testing playbook for both
types of tests and make it easy to add more types later, especially
for image that require booting in the cloud.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-24 08:55:20 +02:00
Ondřej Budai
e890e03d68 tests/image: run the tests in parallel (somewhat)
This commits enables the parallelism for the image tests. However, there's
a catch. Osbuild cannot be reliably run in parallel, so the code uses
a mutex to ensure there's always only one osbuild instance for now. Even
with this limitation, there's a significant speed-up of the tests:

Prior this commit, the image tests run in 40 minutes on Travis. After this
commit, the time is reduced to 32 minutes.

The speed-up will have an even bigger effect when more cloud-upload tests are
added to the test suite.
2020-04-24 08:41:31 +02:00
Jiri Kortus
c4d40b4b0f Fedora31 - fix Size() for vhd
Refs: #442
2020-04-24 08:30:02 +02:00
Major Hayden
3dbfdc4ee6 🐎 Run dnf-json tests in parallel
Run multiple dnf-json tests in parallel to speed up execution. The
total number of parallel tests is limited by the number of CPUs in
the machine that is running the tests.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-23 09:13:22 +02:00
Ondřej Budai
d9cbdede41 tools/prepare-source: use a well-defined go version
go mod works differently in go 1.12 and go 1.13. When someone uses the
prepare-source tool with go >= 1.13, the ci complains because it uses
go 1.12. This commit changes the script to use a well-defined go version.
2020-04-23 08:54:29 +02:00
Major Hayden
1d743f048a 🐣 Add initial RHEL 8.3 support
The osbuild changes were made in osbuild/osbuild#341.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-22 15:25:59 +02:00
Major Hayden
ee441afb14 🥊 Resilient testing + log gathering
Convert the bash script to an ansible playbook so we can gracefully
handle testing failures and gather logs reliably. Colorful output
is nice, too.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-22 11:44:20 +00:00
Ondřej Budai
1e7978b4ef ci/travis: Disable the useless arm64 tests
The tests don't do anything useful currently. This commit disables them
to save some resources and possibly speed up the CI a bit (the free plan
allows us to have only 5 concurrent jobs, so if all slots are full,
PRs have to wait).
2020-04-22 13:00:36 +02:00
Alexander Todorov
cd1e6d3aaf tests: replace cmd.Diff() with require functions 2020-04-20 14:00:49 +02:00
Alexander Todorov
fb7373aa62 tests: Use the require package 2020-04-20 14:00:49 +02:00
Ondřej Budai
5e49b026ca tests: remove the old aws unit test
The old aws unit test is not very useful now, because there's the new
integration test which covers a lot more. Therefore, this commit
removes it.

Fixes #512
2020-04-19 21:54:43 +02:00
Alexander Todorov
869bb2afd7 tests: Use the require/assert package and replace cmp.Diff 2020-04-19 18:20:57 +02:00
Major Hayden
3740e9bc6b 🐎 Allow qemu to use all available CPUs
Speed up the boot tests by allowing qemu to use all of the available
CPUs on the system. Our CI VMs have at least 2 CPUs and this shortens
the time required for a boot test.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-17 17:10:56 +02:00
Major Hayden
af0f3a4585 🦥 Try running some integration tests together
We may be able to shorten test time by running some tests
simultaneously.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-16 15:24:58 +00:00
Lars Karlitski
4a710429de worker: rename API to Server
This makes it symmetric with the client:

    s := worker.NewServer()
    c := worker.NewClient()
2020-04-16 01:02:16 +02:00
Lars Karlitski
ac40b0e73b jobqueue: rename to worker
This package does not contain an actual queue, but a server and client
implementation for osbuild's worker API. Name it accordingly.

The queue is in package `store` right now, but about to be split off.
This rename makes the `jobqueue` name free for that effort.
2020-04-16 01:02:16 +02:00
Jacob Kozol
76bd5ab984 docs: update cockpit-composer repo url
Cockpit-composer has moved from the weldr github organization to the
osbuild organization and its github url has changed. The url in the
man-page source is updated.
2020-04-15 20:26:55 +02:00
Jacob Kozol
39a162368c README: update cockpit-composer repo url
Cockpit-composer has moved from the weldr github organization to the
osbuild organization and its github url has changed. The README's url is
updated.
2020-04-15 20:26:55 +02:00
Ondřej Budai
dbfc2a0929 10
Release osbuild-composer version 10
2020-04-15 16:59:42 +02:00
Martin Sehnoutka
aa39579ff8 travis: disable image tests on arm to workaround kernel bug
The image tests fail in travis because there is a bug in the kernel,
that travis uses. See this upstream bug report for a reference:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1872757
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
e34607b955 travis: plug in arm image test cases
The test generation script we use outputs the test cases prefixed with
"fedora_$RELEASE" so I renamed all the current test cases to follow this
convention and also changed the travis job names so that it can run both
x86_64 test cases and aarch64 test cases.
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
58b550061b test/cases: include fedora test cases for aarch64
These tests were generated by the script in tools/ directory and are not
modified in any way.
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
439b005514 distro: harcode partuuids
We need to make partition uuids stable to be able to run image-info
tests on images using gpt. For example all aarch64 images use gpt.

Also change the type of the (part) UUID to string because that's what
the other UUIDs use and it is easier to work with.
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
e887518736 image-tests: Include qemu command specific for aarch64
The osbuild-image-tests don't currently support boot test for any
alternative architecture because the qemu-system-x86_64 command is
hardcoded. This patch introduces a branch specific to aarch64, but
without a KVM support as I was unable to make it run in Beaker, which is
currently the only offering we have with ARM machines. As a workaround
the boot tests will be skipped if kvm kernel module is not found and only
image-info tests will run.
2020-04-15 15:22:57 +02:00
Brian C. Lane
f960985c17 client: Add functions to support compose testing
Also adds new types to weldr/json.go to support them.
ComposeEntry had to be duplicated instead of used as-is because it
enforces image type strings that do not match what the API uses (the API
types are all lower case, the internal names are capitalized).
2020-04-15 11:35:05 +02:00
Brian C. Lane
7c86dc533c client: Add GetRawBody function to return the io.ReadCloser from the request
And refactor GetRaw to use it.
2020-04-15 11:35:05 +02:00