Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing support for OpenSUSE Tumbleweed #21335

Draft
wants to merge 59 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
e0f2280
spec: Allow building cockpit for tumbleweed testing
Nykseli May 27, 2024
ab4302e
test: Set opensuse specific cockpit.pam file
SludgeGirl Nov 13, 2024
4cc003e
.gitignore: Ignore test results
SludgeGirl May 29, 2024
eecfb6a
test: Add helper function for system admin user
SludgeGirl Nov 13, 2024
0a8d287
test: fix existing RUF031: Avoid parentheses for tuples in subscripts
SludgeGirl Nov 26, 2024
ec698d4
test: Add SUSE to package cases
SludgeGirl May 29, 2024
0924383
test: Set the lease path to /run/dnsmasq due to apparmour policy on TW
SludgeGirl May 30, 2024
5c1232f
test: Update sshd_path logic to be global
SludgeGirl May 30, 2024
d1dcb7f
system: Add support for suse platforms
SludgeGirl May 30, 2024
575f84b
test: Add support for suse to cpu migitgation tests
SludgeGirl May 30, 2024
d1089ae
test: Add in login.defs path for tumbleweed
SludgeGirl May 30, 2024
8523738
test: Remove password access for all users in sudoers for SUSE
SludgeGirl Jun 3, 2024
bf240b5
test: Add suse specific configuration for pam test
SludgeGirl Jun 3, 2024
8b21fe4
storage: fallback to starting multipathd if mpathconf doesn't exist
SludgeGirl Jun 3, 2024
4d8c106
test: Skip a few unsupported tests
SludgeGirl Jun 3, 2024
9be58b2
test: Exclude suse images from sos report tests
SludgeGirl Jun 4, 2024
2517341
test: Overwrite default tumbleweed cgroup and memoryaccounting settings
SludgeGirl Jun 4, 2024
796b087
test: Skip selinux tests for suse
SludgeGirl Jun 4, 2024
36eee2b
test: run this without superuser since tw assumes it as su
SludgeGirl Jun 5, 2024
d7ec9fd
test: Add check docs case for Tumbleweed
SludgeGirl Jun 6, 2024
8bd5ad4
tests: Tumbleweed doesn't have sshd.socket
SludgeGirl Jun 7, 2024
6e78bd5
test: ChallengeResponseAuthentication to no on tumbleweed otherwise pam
SludgeGirl Jun 7, 2024
e71a3e2
test: Don't run tlog tests on Tumbleweed
SludgeGirl Jun 7, 2024
ec0b8ef
test: set useradd defaults on suse images
Nykseli Jun 10, 2024
8797635
test: temporarily unlock root on suse images
Nykseli Jun 10, 2024
3a04ac5
test: SUSE Images have different path for password complexity require…
SludgeGirl Jun 11, 2024
b1f4327
test: Add faillock configuration for SUSE images
SludgeGirl Jun 11, 2024
d4fcabb
test: Make lastlog silent to prevent unexpected journal messages
SludgeGirl Jun 11, 2024
adc139a
test: SUSE images use a different path for default pam files
SludgeGirl Jun 11, 2024
e531951
test: ignore missing btmp file journal messages
Nykseli Jun 11, 2024
89abe03
tests: add specific login logic for tumbleweed
Nykseli Jun 19, 2024
37ed3bd
test: Skip TestAD for suse images
Nykseli Jun 19, 2024
d43386d
test: Parse comments out of os-release file
Nykseli Jun 19, 2024
fd91467
tests: Check right image on suse images
Nykseli Jun 19, 2024
bc781e4
test: Check the right shell indicator on suse images
Nykseli Jun 19, 2024
78beade
test: prefix values with = so comments don't get matched
SludgeGirl Jun 11, 2024
a55f6f4
firewall: Improve handling of service retrieval for Tumbleweed
SludgeGirl Jun 18, 2024
1cee618
test: Amend mapping for Tumbleweed as 50000 is mrt
SludgeGirl Jun 18, 2024
e8408c3
cockpitconf: Always check against system config directories
SludgeGirl Jun 26, 2024
7c04921
test: Add Tumbleweed workaround for passwordless ssh
SludgeGirl Jun 26, 2024
e57f1fb
test: Add kdump support for tumbleweed
SludgeGirl Jun 26, 2024
dba53de
test: Add Tumbleweeds redis target
SludgeGirl Jun 26, 2024
6703137
test: Update Tumbleweeds pam path
SludgeGirl Jun 26, 2024
d722fbc
test: Update config path for Tumbleweed
SludgeGirl Jun 26, 2024
6b79abd
test: Update suse images to use valkey
SludgeGirl Jul 18, 2024
fa069fa
test: Exclude SUSE images from stratis tests
SludgeGirl Jul 19, 2024
916efb9
test: Resolve default tumbleweed repos to lo
SludgeGirl Jul 19, 2024
cd30555
test: Add in handling for package cases using zypper backend
SludgeGirl Jul 19, 2024
c878e1e
test: Update the correct path for suse's pam
SludgeGirl Jul 23, 2024
4ed8264
test: Add support for suse's valkey.target
SludgeGirl Jul 25, 2024
80e8852
test: Tumbleweed lacks kpatch
SludgeGirl Jul 25, 2024
6b8f564
test: Skip Kerberos tests as suse lacks ipa-client-install util
SludgeGirl Jul 26, 2024
4c242ee
test: Skip testConfiguration since SUSE has it's own test for this
SludgeGirl Jul 26, 2024
832c835
test: Skip TestIPA on tumbleweed due to missing ipa-client-install util
SludgeGirl Jul 29, 2024
20bb19e
test: Add support for TW valkey.target
SludgeGirl Jul 30, 2024
17c5595
test: Only add user group if it doesn't already exist
SludgeGirl Jul 30, 2024
58e6d98
test: Exclude tumbleweed from running auto update test install
SludgeGirl Jul 30, 2024
64ec395
test: Multihost is enabled in tumbleweed by default
SludgeGirl Oct 23, 2024
05fc7c8
test: Skip tests that are unsupported on Tumbleweed
SludgeGirl Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Makefile.in
/tags
/test-*
/test_rsa_key
/Test[A-Z]*
/tmp-dist
/tmp/
/tsconfig.tsbuildinfo
Expand Down
11 changes: 8 additions & 3 deletions pkg/lib/kernelopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ error() {
grub() {
key="${2%=*}" # split off optional =value

# For the non-BLS case, or if someone overrides those with grub2-mkconfig
# or update-grub, change it in /etc/default/grub
# For the non-BLS case, or if someone overrides those with grub2-mkconfig,
# update-grub or update-bootloader, change it in /etc/default/grub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change "system: Add support for suse platforms" to "lib: Add Suse support to kernelopt.sh"

if [ -e /etc/default/grub ]; then
if [ "$1" = set ]; then
# replace existing argument, otherwise append it
Expand All @@ -37,6 +37,11 @@ grub() {
elif [ -e /etc/default/grub ] && type update-grub >/dev/null 2>&1; then
update-grub

# on Suse platforms, use update-bootloader
# Since earlier we updated /etc/default/grub we can just run update-bootloader
elif type update-bootloader >/dev/null 2>&1; then
update-bootloader

# on OSTree, the kernel config is inside the image
elif cur=$(rpm-ostree kargs 2>&1); then
if [ "$1" = set ]; then
Expand All @@ -50,7 +55,7 @@ grub() {
rpm-ostree kargs --delete="$key"
fi
else
error "No supported grub update mechanism found (grubby, update-grub, or rpm-ostree)"
error "No supported grub update mechanism found (grubby, update-grub, update-bootloader or rpm-ostree)"
fi
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/metrics/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"config": {
"redis_package": {
"fedora": "valkey",
"platform:el10": "valkey"
"platform:el10": "valkey",
"opensuse-tumbleweed": "valkey"
}
}
}
21 changes: 14 additions & 7 deletions pkg/metrics/metrics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1323,12 +1323,12 @@ const wait_cond = (cond, objects) => {

const PCPConfigDialog = ({
firewalldRequest,
s_pmlogger, s_pmproxy, s_redis, s_redis_server, s_valkey,
packageInstallCallback,
s_pmlogger, s_pmproxy, s_redis, s_redis_server, s_valkey, s_valkey_target,
packageInstallCallback
}) => {
const Dialogs = useDialogs();
const dialogInitialProxyValue = runningService(s_pmproxy) && (
runningService(s_redis) || runningService(s_redis_server) || runningService(s_valkey));
runningService(s_redis) || runningService(s_redis_server) || runningService(s_valkey) || runningService(s_valkey_target));
const [dialogError, setDialogError] = useState(null);
const [dialogLoggerValue, setDialogLoggerValue] = useState(runningService(s_pmlogger));
const [dialogProxyValue, setDialogProxyValue] = useState(dialogInitialProxyValue);
Expand All @@ -1343,7 +1343,7 @@ const PCPConfigDialog = ({
if (dialogLoggerValue && !s_pmlogger.exists) {
missing.push(...await get_pcp_packages());
}
const redisExists = () => s_redis.exists || s_redis_server.exists || s_valkey.exists;
const redisExists = () => s_redis.exists || s_redis_server.exists || s_valkey.exists || s_valkey_target.exists;
if (dialogProxyValue && !redisExists()) {
const os_release = await read_os_release();
missing.push(get_manifest_config_matchlist("metrics", "redis_package", "redis",
Expand All @@ -1357,7 +1357,7 @@ const PCPConfigDialog = ({
debug("PCPConfig: package installation successful");
await wait_cond(() => (s_pmlogger.exists &&
(!dialogProxyValue || (s_pmproxy.exists && redisExists()))),
[s_pmlogger, s_pmproxy, s_redis, s_redis_server, s_valkey]);
[s_pmlogger, s_pmproxy, s_redis, s_redis_server, s_valkey, s_valkey_target]);
}
};

Expand All @@ -1373,6 +1373,9 @@ const PCPConfigDialog = ({
if (s_valkey.exists && s_valkey.unit?.UnitFileState !== 'masked') {
real_redis = s_valkey;
redis_name = "valkey.service";
} else if (s_valkey_target.exists && s_valkey_target.unit?.UnitFileState !== 'masked') {
real_redis = s_valkey_target;
redis_name = "valkey.target";
} else if (s_redis_server.exists && s_redis_server.unit?.UnitFileState !== 'masked') {
real_redis = s_redis_server;
redis_name = "redis-server.service";
Expand Down Expand Up @@ -1498,19 +1501,22 @@ const PCPConfig = ({ buttonVariant, firewalldRequest }) => {
const s_redis = useObject(() => service.proxy("redis.service"), null, []);
const s_redis_server = useObject(() => service.proxy("redis-server.service"), null, []);
const s_valkey = useObject(() => service.proxy("valkey.service"), null, []);
const s_valkey_target = useObject(() => service.proxy("valkey.target"), null, []);

useEvent(superuser, "changed");
useEvent(s_pmlogger, "changed");
useEvent(s_pmproxy, "changed");
useEvent(s_redis, "changed");
useEvent(s_redis_server, "changed");
useEvent(s_valkey, "changed");
useEvent(s_valkey_target, "changed");

debug("PCPConfig s_pmlogger.state", s_pmlogger.state);
debug("PCPConfig s_pmproxy state", s_pmproxy.state,
"redis exists", s_redis.exists, "state", s_redis.state,
"redis-server exists", s_redis_server.exists, "state", s_redis_server.state,
"valkey exists", s_valkey.exists, "state", s_valkey.state);
"valkey exists", s_valkey.exists, "state", s_valkey.state,
"valkey-target exists", s_valkey_target.exists, "state", s_valkey_target.state);

if (!superuser.allowed)
return null;
Expand All @@ -1521,13 +1527,14 @@ const PCPConfig = ({ buttonVariant, firewalldRequest }) => {
s_pmlogger={s_pmlogger}
s_pmproxy={s_pmproxy}
s_redis={s_redis} s_redis_server={s_redis_server} s_valkey={s_valkey}
s_valkey_target={s_valkey_target}
packageInstallCallback={() => setPackageInstallStatus("done")} />);
}

return (
<Button variant={buttonVariant} icon={<CogIcon />}
isDisabled={ invalidService(s_pmlogger) || invalidService(s_pmproxy) ||
invalidService(s_redis) || invalidService(s_redis_server) || invalidService(s_valkey) }
invalidService(s_redis) || invalidService(s_redis_server) || invalidService(s_valkey) || invalidService(s_valkey_target) }
onClick={show_dialog}
data-test-install-finished={packageInstallStatus}>
{ _("Metrics settings") }
Expand Down
22 changes: 18 additions & 4 deletions pkg/networkmanager/firewall.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,24 @@ class AddEditServicesModal extends React.Component {
componentDidMount() {
firewall.getAvailableServices()
.then(services => this.setState({ services }));
cockpit.file('/etc/services').read()
.then(content => this.setState({
avail_services: this.parseServices(content)
}));
async function fetchServices(component) {
try {
await cockpit.spawn(["test", "-e", "/usr/etc/services"], { err: "ignore" });
cockpit.file('/usr/etc/services').read()
.then(content => component.setState({
avail_services: component.parseServices(content)
}));
} catch (err1) {
Comment on lines +561 to +566
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please don't mix async and promises, use one style or the other
  • Don't call test, you can just .read() the /usr file and handle a null result
  • You always need to read /etc/services first, as users may have copied and modified the file

cockpit.file('/etc/services').read()
.then(content => component.setState({
avail_services: component.parseServices(content)
}));
}
}

if (this.state.avail_services === null) {
fetchServices(this);
}
}

onFilterChanged(value) {
Expand Down
28 changes: 20 additions & 8 deletions pkg/storaged/multipath.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,29 @@ export class MultipathAlert extends React.Component {
const multipathd_running = !this.multipathd_service.state || this.multipathd_service.state === "running";
const multipath_broken = client.broken_multipath_present === true;

function activate(event) {
async function activate(event) {
if (!event || event.button !== 0)
return;
cockpit.spawn(["mpathconf", "--enable", "--with_multipathd", "y"],
{ superuser: "try" })
.catch(function (error) {
dialog_open({
Title: _("Error"),
Body: error.toString()
try {
await cockpit.spawn(["type", "mpathconf"], { err: "ignore" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"type" is a shell builtin, you can't (reliably) call this as command. You need cockpit.script() for this.

cockpit.spawn(["mpathconf", "--enable", "--with_multipathd", "y"],
{ superuser: "try" })
.catch(function (error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't mix Promises and async .

dialog_open({
Title: _("Error"),
Body: error.toString()
});
});
});
} catch (err1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to check the specific error (should be err1.problem: "not-found"), and only try the existence check.

cockpit.spawn(["systemctl", "enable", "--now", "multipathd.service"],
{ superuser: "try" })
.catch(function (error) {
dialog_open({
Title: _("Error"),
Body: error.toString()
});
});
}
}

if (multipath_broken && !multipathd_running)
Expand Down
9 changes: 8 additions & 1 deletion pkg/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ function AccountsPage() {
const handleShadow = cockpit.file("/etc/shadow", { superuser: "try" });
handleShadow.watch(() => debouncedGetLoginDetails(), { read: false });

const handleLogindef = cockpit.file("/etc/login.defs");
let handleLogindef;
try {
await cockpit.spawn(["test", "-e", "/etc/login.defs"], { err: "ignore" });
handleLogindef = cockpit.file("/etc/login.defs");
} catch (err1) {
handleLogindef = cockpit.file("/usr/etc/login.defs");
}
Comment on lines +94 to +100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being watched, which doesn't make sense for /usr/etc/ -- that isn't supposed to change. You always need to watch /etc/login.defs even if it doesn't initially exist (that is fine).

You can do the initial .read() from /usr/etc/login.defs, and ignore it if it returns null (i.e. the file doesn't exist), and merge that initial read with the .watch() results.


handleLogindef.watch((logindef) => {
if (logindef === null)
return;
Expand Down
22 changes: 19 additions & 3 deletions src/common/cockpitconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ regcompx (regex_t *preg, const char *regex, int cflags)
/* For optimization, this modifies string; the returned array has pointers into string
* The array itself gets allocated and must be freed after use. */
static const char **
strsplit (char *string, char delimiter)
strsplit (char *string, char delimiter, unsigned *len_out)
{
const char ** parts = reallocarrayx (NULL, 2, sizeof (char*));
char *cur = string;
Expand Down Expand Up @@ -104,6 +104,10 @@ strsplit (char *string, char delimiter)
}

parts[len] = NULL;

if (len_out)
*len_out = len;

return parts;
}

Expand Down Expand Up @@ -299,9 +303,21 @@ cockpit_conf_get_dirs (void)
env = getenv ("XDG_CONFIG_DIRS");
if (env && env[0])
{
unsigned len_out;

const char ** xdg_config_dirs = NULL;
unsigned len = sizeof (cockpit_config_dirs) / sizeof (char*);
Comment on lines +306 to +309
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please describe in more detail what "cockpitconf: Always check against system config directories" does and why it's needed? I haven't reviewed this in detail, but as this is much less straightforward, please split it into its own PR.

system_config_dirs = reallocarrayx (NULL, len, sizeof (char*));
memcpy (system_config_dirs, cockpit_config_dirs, sizeof (cockpit_config_dirs));

/* strsplit() modifies the string inline, so copy and keep a ref */
env = strdup (env);
system_config_dirs = strsplit (env, ':');
xdg_config_dirs = strsplit (env, ':', &len_out);

system_config_dirs = reallocarrayx (system_config_dirs, len + len_out + 1, sizeof (char*));
memcpy (system_config_dirs + (len-1), xdg_config_dirs, len_out * sizeof (char*));
system_config_dirs[len - 1 + len_out] = NULL;
free (xdg_config_dirs);
}
}

Expand Down Expand Up @@ -348,7 +364,7 @@ cockpit_conf_strv (const char *section,
entry->strv_value = strdupx (entry->value);
for (char *c = entry->strv_value + strlen (entry->strv_value) - 1; c >= entry->strv_value && isspace (*c); --c)
*c = '\0';
entry->strv_cache = strsplit (entry->strv_value, delimiter);
entry->strv_cache = strsplit (entry->strv_value, delimiter, NULL);
entry->strv_delimiter = delimiter;
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/test-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ test_load_dir (void)
cockpit_config_file = "cockpit.conf";

g_assert_cmpstr (cockpit_conf_string ("Section2", "value1"), ==, "string");
g_assert_cmpstr (cockpit_conf_get_dirs ()[1], ==, SRCDIR "/src/ws/mock-config");
g_assert_cmpstr (cockpit_conf_get_dirs ()[2], ==, SRCDIR "/src/ws/mock-config");
cockpit_conf_cleanup ();
}

Expand Down
7 changes: 5 additions & 2 deletions test/common/netlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ def add_veth(self, name, dhcp_cidr=None, dhcp_range=None):
if dhcp_cidr:
# up the remote end, give it an IP, and start DHCP server
self.machine.execute(f"ip a add {dhcp_cidr} dev v_{name}; ip link set v_{name} up")
server = self.machine.spawn("dnsmasq --keep-in-foreground --log-queries --log-facility=- "
f"--conf-file=/dev/null --dhcp-leasefile=/tmp/leases.{name} --no-resolv "

# TODO: Consider running all env's through /run/dnsmasq
lease_path = "/run/dnsmasq" if "suse" in self.machine.image else "/tmp"
Comment on lines +48 to +49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to apply that to all OSes.

server = self.machine.spawn(f"mkdir -p {lease_path}; dnsmasq --keep-in-foreground --log-queries --log-facility=- "
f"--conf-file=/dev/null --dhcp-leasefile={lease_path}/leases.{name} --no-resolv "
f"--bind-interfaces --except-interface=lo --interface=v_{name} --dhcp-range={dhcp_range[0]},{dhcp_range[1]},4h",
f"dhcp-{name}.log")
self.addCleanup(self.machine.execute, "kill %i" % server)
Expand Down
17 changes: 16 additions & 1 deletion test/common/packagelib.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def setUp(self):
self.backend = "dnf5"
self.primary_arch = "noarch"
self.secondary_arch = "x86_64"
elif "suse" in self.machine.image:
self.backend = "zypper"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packagelib.py doesn't actually implement a "zypper" backend. Maybe a future commit will introduce this, but please squash these together then. As a standalone commit this is broken.

self.primary_arch = "noarch"
self.secondary_arch = "x86_64"
elif self.machine.image == "arch":
self.backend = "alpm"
self.primary_arch = "any"
Expand Down Expand Up @@ -157,7 +161,7 @@ def createPackage(self, name, version, release, install=False,
else:
self.createRpm(name, version, release, depends, postinst, install, content, arch, provides)
if updateinfo:
self.updateInfo[(name, version, release)] = updateinfo
self.updateInfo[name, version, release] = updateinfo

def createDeb(self, name, version, depends, postinst, install, content, arch, provides):
"""Create a dummy deb in repo_dir on self.machine
Expand Down Expand Up @@ -262,6 +266,13 @@ def createRpm(self, name, version, release, requires, post, install, content, ar
cp ~/rpmbuild/RPMS/{4}/*.rpm {0}
rm -rf ~/rpmbuild
"""
if self.backend == "zypper":
cmd = """
Comment on lines +269 to +270
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AH, here it is. About fifty commits ago I complained about an incomplete packagelib.py commit -- that "test: Add in handling for package cases using zypper backend" is the one with which it should be squashed 😁

rpmbuild --quiet -bb /tmp/spec
mkdir -p {0}
cp /usr/src/packages/RPMS/{4}/*.rpm {0}
"""

if install:
cmd += "rpm -i {0}/{1}-{2}-{3}.*.rpm"
self.machine.execute(cmd.format(self.repo_dir, name, version, release, arch))
Expand Down Expand Up @@ -435,6 +446,10 @@ def enableRepo(self):
self.machine.write("/etc/pacman.conf", config)
self.machine.execute("pacman -Sy")

elif self.backend == "zypper":
# Need to work out how zypper handles repo changelogs so we can handle that here
self.machine.execute(f"zypper ar --no-gpgcheck --refresh {self.repo_dir} local")

else:
# HACK - https://bugzilla.redhat.com/show_bug.cgi?id=2306114
# We need to explicitly create /var/cache/libdnf5 to make "dnf clean" happy.
Expand Down
21 changes: 18 additions & 3 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ def become_superuser(

# In (open)SUSE images, superuser access always requires the root password
if user is None:
user = "root" if "suse" in self.machine.image else "admin"
user = get_superuser(self.machine.image)

if passwordless:
self.wait_in_text("div[role=dialog]", "Administrative access")
Expand Down Expand Up @@ -1776,7 +1776,7 @@ def setUp(self, restrict: bool = True) -> None:
self.sshd_socket = 'ssh.socket'
else:
self.sshd_service = 'sshd.service'
if image == 'arch':
if image == 'arch' or "suse" in image:
self.sshd_socket = None
else:
self.sshd_socket = 'sshd.socket'
Expand All @@ -1785,7 +1785,7 @@ def setUp(self, restrict: bool = True) -> None:
# only enabled by default on released OSes; see pkg/shell/manifest.json
self.multihost_enabled = image.startswith(("rhel-9", "centos-9")) or image in [
"ubuntu-2204", "ubuntu-2404", "debian-stable",
"fedora-39", "fedora-40"]
"fedora-39", "fedora-40", "opensuse-tumbleweed"]
# Transitional code while we move ubuntu-stable from 24.04 to 24.10
if image == "ubuntu-stable" and m.execute(". /etc/os-release; echo $VERSION_ID").strip() == "24.04":
self.multihost_enabled = True
Expand Down Expand Up @@ -2052,6 +2052,12 @@ def login_and_go(

# timedatex.service shuts down after timeout, runs into race condition with property watching
".*org.freedesktop.timedate1: couldn't get all properties.*Error:org.freedesktop.DBus.Error.NoReply.*",

# https://github.com/cockpit-project/cockpit/issues/19235
"invalid non-UTF8 @data passed as text to web_socket_connection_send.*",
Comment on lines +2056 to +2057
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nack - this is an extremely serious bug, and we can't just hide it. Also, that bug got fixed in June?


# Noise from btmp file missing systems where it doesn't exists
r"cockpit-session: open\(\/var\/log\/btmp\) failed: No such file or directory",
Comment on lines +2059 to +2060
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather fix that in src/session/session-utils.c btmp_log() and turn the warn() into a debug() if errno == ENOENT.

]

default_allowed_messages += os.environ.get("TEST_ALLOW_JOURNAL_MESSAGES", "").split(",")
Expand Down Expand Up @@ -2467,6 +2473,15 @@ def get_decorator(method: object, _class: object, name: str, default: Any = None
return getattr(method, attr, getattr(_class, attr, default))


def get_superuser(image: str) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand this right? The user is still called "admin", but sudo asks for the root password instead of admins'? This wouldn't apply to polkit, so perhaps get_sudo_user?

# In (open)SUSE images, superuser access always requires the root password
return "root" if "suse" in image else "admin"


def get_sshd_config_path(image: str) -> str:
# In (open)SUSE images, superuser access always requires the root password
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That comment is wrong.

return "/usr/etc/ssh/sshd_config" if "suse" in image else "/etc/ssh/sshd_config"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. Like in Fedora OSTree, /usr/etc are the read-only original config files shipped by the package. The tests will run sed -i on them, i.e. modify the read-only config in /usr/. The intended way how to change configs is to write new files into /etc/ssh/ssh_config.d/, not only in TW, also in Fedora and others. Some old distros may not have that directory yet, so that may need a special case -- but let's figure this out separately.

I suggest to split this out into its own PR -- please do a draft with ssh_config.d/, and I'm happy to fix it up for old distros.


###########################
# Test decorators
#
Expand Down
Loading
Loading