Commit graph

12389 commits

Author SHA1 Message Date
Martin Pitt
fb1da1ecc9 test: Drop k8s/openshift container tests
The RHEL 7 ELS cycle excludes the RHEL container images. As they are
unsupported now, we don't need to test them any more.

That will allow us to finally delete the "openshift" image zombie in
bots.

[1] https://access.redhat.com/support/policy/updates/rhel7-els-support-maintenance-policy
2023-12-01 08:59:23 +01:00
Jelle van der Waa
da498fbbb0 test: use importlib instead of deprecated imp
The imp module is slated for removal in 3.12, the current release is
3.11 so a potential next Fedora tasks container major upgrade might
  break.
2023-06-07 11:44:40 +02:00
Marius Vollmer
02fa393fd8 test: Apply Sizzle document hack also on Chromium
Since version 113, it runs into the same problems as Firefox.

Cherry-picked from commit d9426e07a2.
2023-06-07 09:03:57 +02:00
Martin Pitt
ae88d4be75 package.json: Update chrome-remote-interface to 0.32
This fixes tests with current Chromium versions.
2023-04-15 14:56:25 +02:00
Jelle van der Waa
78d61f272b package.json: Update chrome-remote-interface
This release contains a fix for nodejs to prefer ipv4 resolving which
is needed as Firefox the CDP runs only on ipv4 on Fedora rawhide on
packit.
2022-10-28 09:47:08 +02:00
Jelle van der Waa
2dfe3c8bf5 test: Python 3.11 compatibility
Python 3.11 changed it's unittest internals for the Outcome class and no
longer calls testPartExecutor with isTest as it used too. The Outcome
class now has a TestResult attribute which records failures, errors and
successful tests different.
2022-10-28 09:47:08 +02:00
Simon Kobyda
075aedc779 Give more time for candlepin
In recent rhel-7-9 image refresh[1], it seems candlepin began to
timeout:
+ curl -s https://services.cockpit.lan:8443/candlepin --verbose
*   Trying 10.111.112.100...
[timeout]

[1] https://github.com/cockpit-project/bots/pull/3866
2022-09-15 15:19:16 +02:00
Marius Vollmer
33c002e642 test: Wait a bit longer for Candlepin to start
The default of 120 seconds seems to be too short now.

Cherry-picked from main commit eb75907364.
2022-08-30 20:10:40 +02:00
Martin Pitt
866490f1bf test: More thoroughly wait for defined VM
Merely waiting for a VM to appear in `virsh list` is a race condition:
virt-install has two phases, and it un- and redefines the VM in
between. This races with the explicit deletion in the UI: If that
happens while virt-install is still running, the second phase would
re-define VM, and the test times out waiting for the VM to be gone.

Current cockpit-machine's assertDomainDefined() is much more thorough:
it waits for the VM to have the expected properties. Backport that.
2022-08-30 20:10:40 +02:00
Allison Karlitskaya
f953345fae test: more && → ; conversions 2022-08-30 20:10:40 +02:00
Allison Karlitskaya
24c03ba920 test: undo some && damage
This line doesn't actually remove all of those modules — as soon as one
of them fails, the others will fail as well, silently.

Merge them into a single command, and replace a `( || true) &&` with a
simplified `|| true;`.
2022-08-30 20:10:40 +02:00
Allison Karlitskaya
95f0d78573 test: wait after adding disk
We were adding a disk and using `dd if=/dev/sda of=/dev/sda` to simulate
disk activity for testing the metrics backends.  We never actually
waited to make sure the disk came online.

This is an existing issue that was revealed by a timing change: the new
way we run scripts via Machine.execute() is apparently a bit faster.
2022-08-30 20:10:40 +02:00
Allison Karlitskaya
1555ebaad5 test: drop one more case of -f (pgrep)
Similar story: the use of `-f` here is also picking up the shell running
the commands.  Remove the `-f` because it's not required anyway.
2022-08-30 20:10:40 +02:00
Martin Pitt
5d0afce489 test: Fix ws cleanup in TestConnection.testLocalSession
The `pkill -f` killed the SSH connection as well. `-f` is not necessary
there, drop it. Also actually wait for the process to be gone.

Drop the second cockpit-ws as well.

This is a backport of 6c830af22d.
2022-08-30 20:10:40 +02:00
Allison Karlitskaya
065695e32e test: drop script= kwarg to Machine.execute()
Scripts can now be handed directly to the command positional argument.

Remove some redundant cases of `#!/bin/sh` or `set -e`.
2022-08-30 20:10:40 +02:00
Martin Pitt
65060c9a34 test: Avoid uploading to ~user directories
scp is deprecated, and in Fedora 36 you can't scp something to a ~user
directory any more:

    scp: server expand-path extension is required for ~user paths in SFTP mode

Specify an absolute path instead.

Cherry-picked from main commit 588163c862
2022-07-21 08:31:46 +02:00
Martin Pitt
561c30cd31 webpack: Avoid md4 hash for OpenSSL 3 compatibility
Fedora-36/CentOS/RHEL 9 switched to OpenSSL 3, which does not support
the `md4` hash any more. webpack hardcodes that in a lot of places, so
monkey-patch `crypto.createHash()` to substitute sha256 for md4.

Hack to work around https://github.com/webpack/webpack/issues/13572

Cherry-picked from https://github.com/cockpit-project/starter-kit/commit/3220617fec508

This is solved in current webpack 5 versions, but we don't want to
update this old stable branch to that.
2022-07-21 08:31:46 +02:00
Matej Marusak
6ecc2e73f6 test: Disable storing of coredump
Hack to work around out infra issue.
2022-06-28 14:56:57 +02:00
Martin Pitt
8063342784 test: Rewrite image-prepare using image-customize
Use `image-customize --build` for building and installing the packages
on all operating systems except CoreOS.

CoreOS still conceptually needs the "build rpms on Fedora" step
(image-customize can't copy out files), and installation is really
special as well. Copy bot's images/scripts/fedora-coreos.install with
minor adjustments.

Adjust and adopt bots' images/scripts/lib/containers.install for the
bastion test.

Move the remaining setup and OS specific hacks to test/vm.install.

This brings cockpit in line with how starter-kit and derivatives prepare
their test images, and gets rid of a lot of redundancy. In particular,
this gets rid of the last cockpit specific *.install files in the bots
repository.

Drop the following CLI options:
 - `--overlay`, `--install-only`: Nobody ever uses this; we have faster
   tools to hack existing images.
 - `--build-image`: The test image determines the build image, there is only
   one correct value anyway
 - `--build-only`, `--sit`, not currently supported by image-customize

Adjust atomiclib.py to the changed path of the built binaries.

Ported from main commit e060058027, with a few changes:

 - Replace the usage of make_dist.py (which does not yet exist in this
   branch, and is overkill) with a copy of its `make_dist()` function,
   and drop the jumpstart part.  Also copy test/common/parent.py, as
   that's harmless, and helps to keep the image-prepare code in sync
   with main.

 - Drop fedora-coreos and RHEL 8 split package build support; this
   branch does not yet know about it, and we don't test it.

 - Drop the Debian/Ubuntu/RHEL 8 hacks from test/vm.install, not used on
   this branch.

 - Add a simple `sed` to put a correct version number into the .spec.
   This avoids backporting multiple intrusive changes that moved
   cockpit.spec to *.in and added the create-spec tool.

 - Port the `--define="centos 0"` hack as additional build option from
   bots `lib/fedora.install --rhel`. This ensures cockpit-subscriptions
   gets built for RHEL, but not CentOS.
2022-02-22 09:37:26 +01:00
Martin Pitt
191cd57bfe Fix Build against Go 1.16
Go 1.16 now defaults to `GO111MODULE=on` [1], which breaks our build, with a
*really* unhelpful error message, too:

    package cockpit-kube-auth is not in GOROOT (/usr/lib/golang/src/cockpit-kube-auth)

Switch back to the old behaviour.

[1] https://go.dev/doc/go1.16

Fixes #16920
See https://bugzilla.redhat.com/show_bug.cgi?id=2050088
2022-02-03 20:39:40 +01:00
Martin Pitt
f046e9d56e tools: Adjust build-debian-copyright for package.json changes from NPM 7
Until version 6, the `author` field was an object with `name` and
`email` properties. Now it is a plain "Name <email>" string. Adjust the
copyright detection fallback to get along with both.
2021-10-12 18:54:57 +02:00
Martin Pitt
b0a8b8f211 npm: Enable legacy module resolution
npm 7 (as in Fedora 35) has stricter module resolution, which makes the
build of the stable rhel-7.9 branch fail in multiple ways. Enforce the
legacy method, to minimize the potential impact and keep the package
buildable.
2021-10-12 18:54:57 +02:00
Martin Pitt
6be52277d5 package.json: Fix incompatible less loader
npm 7 more carefully checks peer dependencies, and discovers that our
current less-loader is not marked as compatible with our current less
version:

```
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: CockpitDevelopmentDependencies@undefined
npm ERR! Found: less@3.0.4
npm ERR! node_modules/less
npm ERR!   dev less@"~3.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer less@"^2.3.1" from less-loader@4.0.6
npm ERR! node_modules/less-loader
npm ERR!   dev less-loader@"~4.0.6" from the root project
```

Bump less-loader to major version 5 to fix that.
2021-10-12 18:54:57 +02:00
Matej Marusak
5ad3f7ed26 test: Make expected exception a bit more general
Firefox returns a bit different wording.

Cherry-picked from main commit 6eebd26109
2021-09-21 14:15:57 +02:00
Martin Pitt
a630ac84ce test: Enable TLS for mock insights server
Latest insights-client dropped the `insecure_connection` option and only
accepts TLS. Change mock-insights to serve TLS, and re-use our "alice"
certificate for it.

Disable certificate verification, as apparently there is no way to
convince the later stages of insights-client to accept a locally added
CA.

Backported from main commit 12850afd86. src/tls/ is not a thing yet
in this branch, so add the alice certificate to test/verify/files/
instead.
2021-07-08 09:33:06 +02:00
Martin Pitt
3fbdfc6d30 test: Select first pool from candlepin
The POOL_COMMAND on recent candlepin versions now finds two pools with
almost exactly the same properties. Ensure that we only pick the first
matching one, to avoid building a broken multi-line command.
2021-04-19 08:10:06 +02:00
Martin Pitt
674164df23 test: Drop usage of Machine.atomic_image
This was dropped in
https://github.com/cockpit-project/bots/commit/ac9b124ee1a7

Drop cases which were Atomic specific.
2021-04-12 09:22:29 +02:00
Martin Pitt
b03af362e2 test: Use predictable host names in check-multi-machine
This makes the test stricter, and also makes them work on OSes that
don't set a host name by default (like fedora-coreos). The new Overview
page doesn't render `#system_information_hostname_text` at all without a
host name.

Cherry-picked from master commit 1cfa5787b6
2021-03-24 09:03:16 +01:00
Martin Pitt
012f991f5e test: Adjust for changed services image
https://github.com/cockpit-project/bots/pull/1768 moves the services
image from CentOS 7 to Fedora CoreOS and containerizes the candlepin
server. Adjust tests accordingly.

Cherry-picked from master commit d2c9f0c269

Changes:

 - Completely sync over pkg/realmd/README.md from current master, as the
   information here was heavily out of date (e.g. the "ipa" image has
   not existed for some time).

 - Replace the JSON filtering in Python with `jq`, as there is no Python
   on Fedora CoreOS.
2021-03-18 14:47:27 +01:00
Martin Pitt
6e876f97c5 test: Drop ovirt tests
cockpit-machines-ovirt has been an evolutionary dead end. The code in
this branch is frozen, and in the unlikely chance that we'll ever have
to touch it again, it will have to be tested manually anyway -- our
ovirt image is many years old and has been unbuildable for almost as
long (and thus has an ovirt version which is long out of support).
Relying on that will not increase any confidence in code adjustments.
2021-03-16 10:13:13 +01:00
Matej Marusak
268182b1d0 test: fix an m.execute() invocation in check-realms
TestKerberos.testNegotiate() is using an undocumented feature of
m.execute() by passing the individual arguments of curl as a list rather
than a string.  This feature has long been broken: ssh just concatenates
the arguments back together anyway.  This is plainly illustrated by the
fact that this test has been calling m.execute() with

  '/usr/bin/curl -v -s'

as the first argument, and it's been working.

Split that out properly in preparation for an upcoming change to the
bots to make this function properly.

Cherry-picked from master commits 426bd42b3 and a2c78179fe.
2021-01-30 10:34:16 +01:00
Marius Vollmer
ae76f2fc1b test: Configure the real Candlepin CA certificate on the client
This allows us to remove the various --insecure and insecure=0 options
when contacting Candlepin.

More importantly, it allows insights-client to perform its performance
metric upload to Candlepin, something that can't be configured to be
done insecurely.
2020-12-10 20:30:41 +01:00
Marius Vollmer
c7b87d5054 storage: Include stderr of fsadm in dialog 2020-12-09 13:33:46 +02:00
Marius Vollmer
080e66745d
terminal: Protect against invalid resizes (#15017)
This is a backport of part of 6341cf1734
and prevents check-embed from flaking.
2020-12-08 13:46:33 +02:00
Allison Karlitskaya
8812d394b6 test: remove tangd-update workraound on centos-7
The latest tang release in centos-7 (version 6-2) now contains a fix for
https://bugzilla.redhat.com/show_bug.cgi?id=1703445.

Closes #14947
2020-11-24 00:45:31 +01:00
sanne raymaekers
e7d95b7b38 test: Fix check-embed to work with chromium>=85
The default "Referrer-Policy" for chromium is now
strict-origin-when-cross-origin, which caused the previous version of
the test to fail as js from the local embed-cockpit.html file to the
iframe was considered cross-origin.

By making the embed file the default shell, it is no longer
cross-origin.

Cherry-picked from master commit f5985b36

Closes #14743
2020-10-15 08:49:19 +02:00
Sanne Raymaekers
53ed58a307
tests: Increase timeout in check-sosreport
This test on rhel-atomic keeps running into the timeout.

See cockpit-project/bots#1271

Closes #14712
2020-10-08 06:39:11 +02:00
Marius Vollmer
af768ffec6
test: Fix check-openshift testNodeNavigation
The test was expecting the "Login failed" error message in the
curtain, for unknown reasons.  It actually appears in the dialog, and
always has, I think.

Closes #14656
2020-09-23 12:29:01 +02:00
Martin Pitt
b735008a41
ws: Use default krb5 enctypes from mock KDC
Recently krb5 started to be stricter about unrecognized enctypes [1],
and that commit is now in Fedora Rawhide. This broke test-kerberos with

    cockpit-ws:ERROR:src/ws/test-kerberos.c:301:test_authenticate:
    assertion failed (GSS_S_CONTINUE_NEEDED == status): (1 == 851968): Unspecified GSS failure.
    Minor code may provide more information (Decrypt integrity check failed)

Between Fedora 33 and CentOS 8 there is no set of encryption types that
is supported everywhere; also, we don't particularly care about the
encryption type for this unit test, so just use whatever kerberos
considers a good default [2].

[1] https://github.com/krb5/krb5/commit/be5396ada0e8dab
[2] https://web.mit.edu/kerberos/krb5-latest/doc/admin/conf_files/kdc_conf.html#encryption-types

Cherry-picked from master commit 8eed6e7

Closes #14531
2020-08-31 11:18:21 +02:00
Matej Marusak
4131648d81
test: Replace deprecated time.clock() with time.process_time()
This method is deprecated since Python version 3.3 and is removed in Python version 3.8.
Fedora 32 ships by default Python 3.8

Cherry-picked from master commit e0badff

Closes #14530
2020-08-31 10:28:11 +02:00
Matej Marusak
8dfe099eee
package.json: Pin down eslint-plugin-react
See  https://github.com/yannickcr/eslint-plugin-react/issues/2728

Closes #14415
2020-07-27 12:46:08 +02:00
andreasn
1c9408c05a package.json: Fix version for novnc
Latest 1.2 update of novnc breaks current version of @patternfly/react-console, so set it to version 1.1.0.

Cherry-picked from master commit 76f4802
2020-07-16 06:16:52 +02:00
Katerina Koukiou
08dd0a5677 machines: getDefaultVolumeFormat expects a pool object not a pool name
Closes #14219
2020-06-10 13:54:36 +02:00
Katerina Koukiou
20dea8d77d machines: fix wrongly backported state variable name
On master it is format but here it should be diskFileFormat.
2020-06-10 13:54:36 +02:00
Katerina Koukiou
93ab723a2d machines: Fix default volume format detection in Disk Add dialog
Previously we were correctly calling the getDefaultVolumeFormat when
opening the dialog, thus the default format for the preselected pool was
correctly detected. However, when a user changed so some other pool,
we didn't re-detect the default format, which was problematic if the
user didn't change the preseleted format afterwards.

This commit also adjusts the relevant test which didn't fail before
because the problematic pool was first on the list so the
getDefaultVolumeFormat was correctly called in the dialog constructor.

Relevant to https://bugzilla.redhat.com/show_bug.cgi?id=1833198

Closes #14201
Cherry-picked from master commit 2cd9bf.
2020-06-06 13:14:46 +02:00
Katerina Koukiou
0eb98c4fd3 Drop tests for cockpit-machines relying on virsh for communication with libvirt
libvirt-dbus 1.2.0 exists in rhel-7-9 and centos-7 images, there is no
need to run these tests any more.
2020-06-06 13:14:46 +02:00
Marius Vollmer
7eff27b8fc test: Retry realmd operation if another is still active
Cherry-picked from master commit c45d993e29

Closes #14197
2020-06-04 20:32:38 +02:00
Martin Pitt
348127f099 test: Drop get_temp_dir() usage from image-prepare
We are going to eliminate `$TEST_DATA`, it currently influences too many
things which really don't belong together. There is little reason to put
the built rpms into some user-controlled path -- in particular, we
*don't* want to put them into some persistent and possibly remote
storage if `$TEST_DATA` points to a container volume.

get_temp_dir() is too unspecific to be used as public API, so let's
eliminate it. This is the only consumer outside of bots itself.

Cherry-picked from master commit acd4f87ed7.
2020-06-04 20:32:38 +02:00
Marius Vollmer
3adf7e8943 all: Add { superuser: "try" } for things that might need Polkit
Cockpit should always use the maximum privileges it has.  Otherwise
actions might be rejected that are actually allowed.

Cherry-picked from master commit 168f819ebd, restricted to a safe and
non-intrusive subset.

https://bugzilla.redhat.com/show_bug.cgi?id=1841559

Closes #14184
2020-06-03 07:53:56 +02:00
Katerina Koukiou
a986621399
machines: fix setting of volume format when adding new disks to VMs
Don't try to set the disk driver type to something which is neither
qcow2 or raw.
Volumes on some pool types can have different format types though.
In that case, just omit settings the disk driver type, and let QEMU
autoset the default.

Relevant to https://bugzilla.redhat.com/show_bug.cgi?id=1833198

Cherry-picked from master commit 5e5a243.

Closes #14154
2020-06-02 17:51:58 +02:00