Commit graph

231 commits

Author SHA1 Message Date
Jakub Rusz
d927bfbd30 tests: rename Azure resources in API test
Use TEST_ID for any resources created in Azure. Also create all
necessary vm network resources in advance to have predictable names
using TEST_ID as well.
2021-08-19 09:04:28 +02:00
Ondřej Budai
7a298c838b tests: remove all disabling conditions for RHEL 9.0
RHEL 9.0 isn't yet in .gitlab-ci.yml so this actually doesn't change in test
runs but it should make enabling of the tests easier.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-17 16:54:22 +02:00
Ondřej Budai
0336612160 test/ostree: add test case for RHEL 9.0
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-17 16:54:22 +02:00
Ondřej Budai
9ae81cbbeb test/libvirt: enable uefi test for RHEL 9.0
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-17 16:54:22 +02:00
Ondřej Budai
91dd6e3346 test/api: add test case for RHEL 9.0
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-17 16:54:22 +02:00
Achilleas Koutsou
8af0431883 test/casea: trim installer test blueprint 2021-08-11 01:31:47 +02:00
Achilleas Koutsou
ab264abd76 distro/rhel85: tar-installer -> image-installer
Renamed tar-installer to image-installer.
This is a more appropriate name:
- It disassociates the image type from the "tar" image type. The two
  should not be perceived to be connected.
- It's more descriptive. The format of the payload (tar) isn't relevant
  to the purpose of the image type.
2021-08-11 01:31:47 +02:00
Martin Sehnoutka
d149d3ab4e test: Make the Satellite test generic over distributions
The test case used to work only on Fedora 33. This patch introduces
support for all future Fedoras and RHEL 8.

It uses a fair bit of magic because it needs to dynamically discover if
a RHEL runner uses the rhel-8.json or the rhel-8-beta.json repository
override. Furthemore it needs to discover a redirection URL, if any, of
the repository override to correctly configure HTTP proxy.
2021-08-09 12:40:23 +02:00
Martin Sehnoutka
d0c0c8791f test/regression: disable excluded pkgs test for Fedora
It is designed for RHEL only. The switch for distros used to live in the
regression.sh script but it was removed so now the tests need to know if
they are running on a compatible system themselves.
2021-08-09 12:40:23 +02:00
Martin Sehnoutka
e6737f71d1 test/cases/ostree*: remove mod_ssl configuration file
It clashes with osbuild-composer already running on port 443.
2021-08-09 12:40:23 +02:00
Martin Sehnoutka
2d75b25ffe test/cases: new case that verifies composer works behind satellite
Introduce a test case where 2 httpd proxies are used to simulate custom
repos with custom subscriptions. That is, every repo requires
client-side tls certificate with its own CA. Make sure both osbuild and
osbuild-composer can use these repositories by issuing an image build.
2021-08-09 12:40:23 +02:00
Achilleas Koutsou
a49d28dfc4 test/cases: install python3 for installer test
Required by Ansible to run checks
2021-08-09 07:57:15 +02:00
Thomas Lavocat
fd81593026 Tests: Malformed JSON duplicate customization
Fixes #1612
2021-08-06 10:38:20 +02:00
Achilleas Koutsou
6e8ceb2e41 test/cases: complete installer test
Several changes required to get the installer test working in CI.

Blueprint:
- Add packages for SSH and networking
- Use generated SSH key and username variable for user setup

Kickstart:
- The ISO contains a kickstart file with the `liveimg` command. Instead
  of trying to inject a kickstart during virt-install, we override the
  existing file on the ISO. The `modksiso` function reads a kickstart
  file from an existing ISO, adds commands to make the installation
  fully automatic (partitioning, text --non-interactive) and creates a
  new ISO with the modified kickstart file using mkksiso.
- Simple networking added to kickstart file.
- Kernel command line args for installer added via the mkksiso command
  since the `--cdrom` installation source doesn't support injecting
  command line arguments.

virt-install:
- Using `--cdrom` instead of `--location`: latter was failing to
  install.
- No longer injects a kickstart file (since we handle it separately) and
  doesn't add extra Kernel args.
2021-08-05 16:13:46 +02:00
sanne
57555991e0 test/api: Use relevant distributions testing package conflicts 2021-08-03 15:14:22 +02:00
Tomas Hozza
02ff0fc606 rhel85: redefine the ami image based on RHEL ec2 images
Redefine the `ami` image type in RHEL-8.5 to be based on RHEL
ec2 images. The pipeline has different default settings, therefore the
common "os" pipeline is not used. The RHEL ec2 images have a different
default size than the original `ami` image definition. The RHEL ec2
images use a different default partitioning scheme. Their configuration
is slightly different for each architecture and the x86_64 version
of the image does not support UEFI.

Update rpmrepo snapshots used to generate RHEL-8.5 x86_64 and aarch64
image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00
Juan Abia
c4fa4e4bb7 test: Replace hard coded ssh keys on some test
Generate a new ssh key each time. Only implemented on bash test scripts,
go tests pending.
2021-07-29 09:38:03 +03:00
Lars Karlitski
9c2c92f729 jobqueue: Introduce jobqueue backed by a postgres database
Co-authored-by: sanne <sanne.raymaekers@gmail.com>
2021-07-28 21:52:31 +01:00
Thomas Lavocat
4729990ac0
cloudapi: Add User customization
Cloud api now exposes user customization that let a customer able to add
a new user with a set of groups and a ssh key.

Testing:
* adds 2 users to the AWS image, accessible with a temp ssh key.
* the first one is in the group wheel, the other is not

Fixes #1574
2021-07-28 10:40:25 +02:00
Achilleas Koutsou
e062fe3c44 test/api.sh: suppress shellcheck for sudo redirect 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
359100e1a1 test/api.sh: more robust edge commit validation
Instead of inspecting the tarball directly, extract it and use ostree to
verify the ref and commit ID.

Adds some data to the CI artifacts directory:
- Build manifest
- Tarball file list for s3 edge commit with s3 upload
- Build metadata
2021-07-24 15:54:00 +02:00
Ondřej Budai
dc2458fc23 test/libvirt: run the uefi test also for 8.5
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-24 15:54:00 +02:00
Ondřej Budai
fba77534fd test/api: add RHEL 8.5 case
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
47ae5de5c0 test/cases: stop the spread of the tet typo
Hoping this is the end of this viral typo.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
35f0ef1053 test: regression test installing excluded dependency
Unlike the original regression test which explicitly names the excluded
dependency, this test installs a package that depends on the excluded
package without naming it. Based on the new way we depsolve blueprint
packages in RHEL 8.5, this should now work as well.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
2444e633fb test: separate regression from base tests
- Rewrote regression.sh to be like base tests with list of regression
  test scripts to be run and fail counts
- Separate regression tests in CI to have better control of distro
  runners
2021-07-24 15:54:00 +02:00
Chloe Kaubisch
4c800f29a7 worker: add metrics
use prometheus to gather metrics
2021-07-23 21:54:28 +02:00
Thomas Lavocat
cfc91a3eb6 CloudAPI: Invalid package set returns 400
Previously a bad error code was returned, fixes #1477.

Testing:

I have two test cases to test the solution. The first is a request that
makes depsolve crash by changing the dnf-json script by an almost empty
one that only throws an exception. The second one fails because it
requests a non existing package. The former ends with a 500 error and
the later with a 400.

----8<-----

HTTP/1.1 500 Internal Server Error

Failed to depsolve base packages for ami/x86_64/centos-8: ailed to
depsolve base packages for ami/x86_64/centos-8: unexpected end of JSON
input

----8<-----

HTTP/1.1 400 Bad Request

Content-Length: 226Failed to depsolve base packages for
ami/x86_64/centos-8: DNF error occured: MarkingErrors: Error occurred
when marking packages for installation: Problems in request:
missing packages: jesuisunpaquetquinexistepas_idonotexist
2021-07-21 16:21:15 +02:00
Achilleas Koutsou
583bfc0b4a test/cases/ostree: save build logs and manifests
Copy log and manifest for each build to the ci-artifacts/ directory to
be stored at the end of the build for troubleshooting.
2021-07-21 11:21:42 +02:00
Jakub Rusz
ab3234260a tests: fix wrong default value in azure.sh test
It's not possible to create vm with the single quotes in the name.
Removing it to enable running locally.
2021-07-16 10:59:15 +02:00
Tomas Hozza
3a0540dff0 test/api.sh: randomize used GCP zone from the region
The `api.sh` test currently always defaults to "<REGION>-a" zone when
creating instance using the built image. The resources in a zone may get
exhausted and the solution is to use a different zone. Currently even a
CI job retry won't help with mitigation of such error during a CI run.

Modify `api.sh` to pick random GCP zone for a given region when creating
a compute instance. Use only GCP zones which are "UP".

The `cloud-cleaner` relied on the behavior of `api.sh` to always choose
the "<REGION>-a" zone. Guessing the chosen zone in `cloud-cleaner` is
not viable, but thankfully the instance name is by default unique for
the whole GCP project. Modify `cloud-cleaner` to iterate over all
available zones in the used region and try to delete the specific
instance in each of them.

Make `ComputeZonesInRegion` method from the `internal/cloud/gcp` package
exported and use it in `cloud-cleaner` for getting the list of available
zones in a region.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-16 10:14:30 +02:00
Tomas Hozza
1fd151ce28 test/api.sh: fix generation of predictable TEST_ID in GitLab CI
The `test/cases/api.sh` script relied on environment variables specific
to Jenkins for detecting it if is running in a CI environment. If this
was the case, it used other environment variables to construct a
predictable `TEST_ID` which could be used for names of resources created
in cloud-provider environment as part of the test. This is important to
ensure that `cloud-cleaner` can "guess" resource names and delete them
in case the test script fails to clean up after itself.

With the move from Jenkins to GitLab CI, this stopped to work and the
script started to generate random `TEST_ID`, which can not be guessed by
the `cloud-cleaner` tool.

Modify the `test/cases/api.sh` to detect the CI environment using the
`CI` environment variable, which is always predefined in the GitLab CI
environment [1].

[1] https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-16 10:14:30 +02:00
Jakub Rusz
1b5ca0f163 tests: make azure.sh easier to run locally
We've dropped Jenkins already and this change helps by setting
CI variables to a default value in case they're not present.
2021-07-09 19:52:52 +01:00
sanne
4385c39d66 worker: Introduce heartbeats
An occupied worker checks about every 15 seconds if it's current job was
cancelled. Use this to introduce a heartbeat mechanism, where if
composer hasn't heard from the worker in 2 minutes, the job times out
and is set to fail.
2021-07-08 21:14:38 +01:00
Ondřej Budai
0201822c50 tests: remove all traces of Fedora 32
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-05 11:16:08 +02:00
Xiaofeng Wang
4e4012df28 test: Update ostree.sh to cover bz#1896178
For RHEL 8.5, user and ssh key are added in blueprint.
For Fedora 33, RHEL 8.3 and 8.4, user and ssh key have to be
added in ks file due to bz#1896178.

bz#1896178 has been fixed already on RHEL 8.5 only, but still exists
on Fedora 33, RHEL 8.3 and 8.4. This update covers Fedora 33,
RHEL 8.5, RHEL 8.4 and RHEL 8.3.
2021-07-05 11:15:58 +02:00
Achilleas Koutsou
6e22e1de64 test/cases: fix installers test
COMPOSE_ID shouldn't be set but taken from the build response
2021-07-02 17:57:22 +02:00
Xiaofeng Wang
35263e5ab4 test: Remove fedora 32 test
GitLab CI dropped Fedora 32 support, fedora 32 test should be
removed.
2021-07-01 13:34:12 +02:00
Achilleas Koutsou
a877326671 test: add installer integration test
Builds a tar-installer, installs the OS, boots it, and checks if the
packages selected in the blueprint are installed.
2021-07-01 12:48:32 +02:00
Yuxin Sun
6cd6e81e85 Add subscription test case and Azure boot up case
Signed-off-by: Yuxin Sun <yuxisun@redhat.com>
2021-06-30 12:29:33 +02:00
Achilleas Koutsou
f557bf9a8b test/cases/ostree: test new image types
ostree.sh: add case for RHEL 8.5 edge-commit
ostree-ng.sh: conditional container and installer type and file names
2021-06-29 17:26:43 +01:00
Achilleas Koutsou
0ddfc32957 test: verify selected package appears in metadata
Add postgresql to all builds and verify that it's listed in the metadata
2021-06-29 09:33:05 +01:00
Achilleas Koutsou
7e01a9125b test: verify commit ID hash returned from API 2021-06-29 09:33:05 +01:00
Jakub Rusz
b1e40b5ce7 tests: modify image_tests for Gitlab CI 2021-06-28 13:49:57 +03:00
Yuxin Sun
704a3675b9 Update fedora-33 test repo
Signed-off-by: Yuxin Sun <yuxisun@redhat.com>
2021-06-25 08:40:49 +03:00
Alexander Todorov
1eb51b7bab Test Azure images on HyperV Gen1 and Gen2
Related: rhbz#1896264
2021-06-22 13:44:19 +03:00
Tomas Hozza
e6c3d78ec4 image tests: ignore 'selinux/context-mismatch' in image-info report on RHEL-8
Add a new CLI option to `osbuild-image-tests` called
`-skip-selinux-ctx-check` to workaround the limitation of `setfiles` on
RHEL-8 [1]. If the option is passed to the binary, then the
'selinux/context-mismatch' part is removed from the "expected" and
"actual" image-info report, before these two reports are compared.

Modify `image_tests.sh` to run `osbuild-image-tests` with
`-skip-selinux-ctx-check` when run on RHEL-8.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1973754

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-22 13:25:59 +03:00
Tomas Hozza
bce603586e image-info: changes related to reading SELinux labels unknown to host
When `image-info` inspects ostree images, the `/usr/etc` is bind-mounted
to `/etc`. This results in conflicting SELinux policy specification for
these files and makes the outcome dependent on the `setfiles` build.
All the files in `/etc` have mismatch in the expected vs. actual SELinux
context.

Exclude `/etc` from the check of SELinux ctx mismatches in case the
analysed tree is from an ostree-based image.

Sort the list returned `read_selinux_ctx_mismatch()` based on the item's
`filename` key, to make the result consistent across runs.

`image-info` can not read SELinux labels from the images, which are not
known to the host. This makes the report content depend on the host
environment. As a temporary workaround, relabel the image-info script with
osbuild_exec_t label to allow it to read unknown SELinux labels.

Modify documentation in `test/README.md` to explain the issue with
`image-info` and unknown SELinux labels.

Modify the `generate-all-test-cases` to relabel `image-info` before
generating test cases.

Modify the `image_tests.sh` to relabel `image-info` before running image
test cases.

Add 'tar' image for 'rhel-8' on 's390x' back to the matrix of generated
test cases, as it was removed by mistake. Regenerate the image test
case. Remove 'tar' image from 'rhel-84' on 's390x' from the matrix of
generated test cases, as it is not supported.

Regenerate all affected image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-22 13:25:59 +03:00
Achilleas Koutsou
8f778af653 test: add API test for S3 upload target
Run on RHEL only.
2021-06-18 14:02:09 +01:00
Ondřej Budai
bc1a7dc30c tests: fix journalctl killing once again
3a8c6c8a introduced a new logic for killing journalctl. Unfortunately, it
doesn't work properly. In ostree tests, multiple journalctls are spawned
but there can be only one trap active at a time. This caused all but the last
journalctls to hang indefinitely. Unfortunately, hanging background processes
is something that causes the GitLab CI to hang indefinitely as well.

This commit modifies the logic a bit: The trap is still set. However, there's
also an explicit kill of journalctl after the compose is finished. After the
process is successfully killed, the trap is removed.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-06-10 07:40:36 +02:00