Debian Codegraph @

test/browser/browser.sh

raw
1 #!/bin/bash
2
3 set -eux
4
5 cd "${0%/*}/../.."
6
7 # like "storage-basic", passed on to run-test.sh
8 PLAN="$1"
9
10 # show some system info
11 nproc
12 free -h
13 rpm -qa | grep cockpit
14
15 # allow test to set up things on the machine
16 mkdir -p /root/.ssh
17 curl https://raw.githubusercontent.com/cockpit-project/bots/main/machine/identity.pub >> /root/.ssh/authorized_keys
18 chmod 600 /root/.ssh/authorized_keys
19
20 if [ ! -e /sysroot/ostree ]; then
21 # HACK: setroubleshoot-server crashes/times out randomly (breaking TestServices),
22 # and is hard to disable as it does not use systemd
23 if rpm -q setroubleshoot-server; then
24 dnf remove -y --setopt=clean_requirements_on_remove=False setroubleshoot-server
25 fi
26
27 # HACK: this package creates bogus/broken sda → nvme symlinks; it's new in rawhide TF default instances, not required for
28 # our tests, and only causes trouble; https://github.com/amazonlinux/amazon-ec2-utils/issues/37
29 if rpm -q amazon-ec2-utils; then
30 rpm -e --verbose amazon-ec2-utils
31 # clean up the symlinks, if they exist
32 udevadm trigger /dev/nvme* || true
33 fi
34
35 # dnf installs "missing" weak dependencies, but we don't want them for plans other than "main"
36 if [ "$PLAN" != "main" ] && rpm -q cockpit-packagekit; then
37 dnf remove -y cockpit-packagekit
38 fi
39 fi
40
41 # if we run during cross-project testing against our main-builds COPR, then let that win
42 # even if Fedora has a newer revision
43 main_builds_repo="$(ls /etc/yum.repos.d/*cockpit*main-builds* 2>/dev/null || true)"
44 if [ -n "$main_builds_repo" ]; then
45 echo 'priority=0' >> "$main_builds_repo"
46 dnf distro-sync --setopt=allow_vendor_change=1 -y 'cockpit*'
47 fi
48
49 #HACK: unbreak RHEL 9's default choice of 999999999 rounds, see https://bugzilla.redhat.com/show_bug.cgi?id=1993919
50 sed -ie 's/#SHA_CRYPT_MAX_ROUNDS 5000/SHA_CRYPT_MAX_ROUNDS 5000/' /etc/login.defs
51
52 # make libpwquality less aggressive, so that our "foobar" password works
53 printf 'dictcheck = 0\nminlen = 6\n' >> /etc/security/pwquality.conf
54
55 # set root's password
56 echo root:foobar | chpasswd
57
58 # create user account for logging in
59 if ! id admin 2>/dev/null; then
60 useradd -c Administrator -G wheel admin
61 echo admin:foobar | chpasswd
62 fi
63
64 # disable core dumps, we rather investigate them upstream where test VMs are accessible
65 echo core > /proc/sys/kernel/core_pattern
66
67 # make sure that we can access cockpit through the firewall
68 systemctl start firewalld
69 # wait for d-bus service to be accessible
70 while ! firewall-cmd --state; do sleep 1; done
71 firewall-cmd --add-service=cockpit --permanent
72 firewall-cmd --add-service=cockpit
73
74 # HACK: unbreak subuid assignment for new users; see
75 # https://bugzilla.redhat.com/show_bug.cgi?id=2382662
76 # https://issues.redhat.com/browse/RHEL-103765
77 if [ -e /etc/login.defs ]; then
78 sed -i '/^SUB_.ID_COUNT/ s/\b0/65536/' /etc/login.defs
79 fi
80
81 . /usr/lib/os-release
82 export TEST_OS="${ID}-${VERSION_ID/./-}"
83
84 if [ -e /sysroot/ostree ]; then
85 TEST_OS="${TEST_OS}-bootc"
86
87 # bootc deployments have a r/o /usr/local; make it writable
88 mount -t tmpfs tmpfs /usr/local
89 fi
90
91 if [ "${VARIANT_ID:-}" = "eln" ]; then
92 TEST_OS="fedora-eln"
93 fi
94
95 # HACK: in C10s bootc in TF with a packit COPR, SELinux contexts get messed up
96 # https://github.com/cockpit-project/cockpit/issues/23295
97 # https://redhat.atlassian.net/browse/TFT-4722
98 if [ "$TEST_OS" = "centos-10-bootc" ]; then
99 setenforce 0
100 fi
101
102 # Run tests in the cockpit tasks container, as unprivileged user
103 CONTAINER="$(cat .cockpit-ci/container)"
104 exec podman \
105 run \
106 --rm \
107 --shm-size=1024m \
108 --security-opt=label=disable \
109 --env='TEST_*' \
110 --volume="${TMT_TEST_DATA}":/logs:rw,U --env=LOGS=/logs \
111 --volume="$(pwd)":/source:rw,U --env=SOURCE=/source \
112 "${CONTAINER}" \
113 sh /source/test/browser/run-test.sh "$@"