Skip to content

Commit

Permalink
test: Enable kdump on Fedora 39
Browse files Browse the repository at this point in the history
https://bodhi.fedoraproject.org/updates/FEDORA-2023-93fab3be92 disables
the kdump/crashkernel configuration by default, so we need to go back to
explicitly enabling it on Fedora 39 as well.

Unify this process on all Fedora versions, and use `kdumpctl` instead of
messing around with `grubby`.
  • Loading branch information
martinpitt committed Oct 25, 2023
1 parent e1aa8e1 commit ad553ed
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions test/verify/check-kdump
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@ class KdumpHelpers(testlib.MachineCase):
self.allow_restart_journal_messages()

def enableKdump(self):
# all current Fedora/CentOS/RHEL images use BootLoaderSpec
if self.machine.image == "fedora-38":
self.machine.execute("grubby --args=crashkernel=192M --update-kernel=ALL")
if self.machine.image.startswith("fedora"):
self.machine.execute("systemctl enable kdump; kdumpctl reset-crashkernel")
self.machine.reboot()

self.machine.start_cockpit()
self.browser.switch_to_top()
self.browser.relogin("/kdump")

def crashKernel(self, message, cancel=False):
b = self.browser
b.click(f"button{self.default_btn_class}")
Expand Down Expand Up @@ -72,20 +67,15 @@ class TestKdump(KdumpHelpers):
m = self.machine

b.wait_timeout(120)
if m.image.startswith("fedora"):
m.execute("systemctl enable --now kdump")
else:
m.execute("until systemctl is-active kdump; do sleep 1; done")

self.login_and_go("/kdump")

b.wait_visible("#app")

def assertActive(active):
b.wait_visible(".pf-v5-c-switch__input" + (active and ":checked" or ":not(:checked)"))

if m.image in ["fedora-38"]:
# crashkernel command line not set
if m.image.startswith("fedora"):
# crashkernel command line not set, needs to be explicitly enabled in Fedora
b.wait_visible(".pf-v5-c-switch__input:disabled")
# right now we have no memory reserved
b.mouse("span + div > .popover-ct-kdump", "mouseenter")
Expand All @@ -107,15 +97,19 @@ class TestKdump(KdumpHelpers):
b.mouse("button:contains(Test configuration)", "mouseenter")
b.wait_in_text(".pf-v5-c-tooltip", "kdump service")
b.mouse("button:contains(Test configuration)", "mouseleave")

# enable it
self.enableKdump()
self.login_and_go("/kdump")
else:
# most OSes have a default crashkernel=
# enabled by default in RHEL
m.execute("until systemctl is-active kdump; do sleep 1; done")
b.wait_in_text("#app", "Service is running")
assertActive(active=True)

# there shouldn't be any crash reports in the target directory
self.assertEqual(m.execute("find /var/crash -maxdepth 1 -mindepth 1 -type d"), "")

self.enableKdump()
b.wait_visible("#app")
self.enableLocalSsh()

Expand Down Expand Up @@ -157,7 +151,6 @@ class TestKdump(KdumpHelpers):
# we should have the amount of memory reserved that crashkernel=auto defaults to for our VM RAM size
b.wait_in_text("#app", "192 MiB")
# service should start up properly and the button should be on
b.wait_in_text("#app", "Service is running")
assertActive(active=True)
b.wait_in_text("#app", "Service is running")
b.wait_text("#kdump-change-target", "Remote over SSH")
Expand Down Expand Up @@ -427,8 +420,10 @@ class TestKdumpNFS(KdumpHelpers):
self.assertEqual(m.execute("find /var/crash -maxdepth 1 -mindepth 1 -type d"), "")

# set up client machine
self.login_and_go("/kdump")
self.enableKdump()
self.login_and_go("/kdump")
with b.wait_timeout(120): # needs to rebuild initrd
b.wait_in_text("#app", "Service is running")

# switch to NFS
b.click("#kdump-change-target")
Expand All @@ -441,14 +436,6 @@ class TestKdumpNFS(KdumpHelpers):
with b.wait_timeout(300):
b.wait_not_present("#kdump-settings-dialog")

# enable service, regenerates initrd and tests NFS settings
if m.image.startswith("fedora"):
b.wait_visible(".pf-v5-c-switch__input:not(:checked)")
b.click(".pf-v5-c-switch__input")
with b.wait_timeout(300):
b.wait_visible(".pf-v5-c-switch__input:checked")
b.wait_in_text("#app", "Service is running")

# explicit nfs option, unset path
conf = m.execute("cat /etc/kdump.conf")
self.assertIn("\nnfs 10.111.113.2:/srv/kdump\n", conf)
Expand Down

0 comments on commit ad553ed

Please sign in to comment.