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

test: Add fake default route to work around podman 5 regression #20153

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Changes from all commits
Commits
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
20 changes: 13 additions & 7 deletions test/verify/check-metrics
Original file line number Diff line number Diff line change
Expand Up @@ -751,19 +751,25 @@ class TestHistoryMetrics(testlib.MachineCase):
class TestCurrentMetrics(testlib.MachineCase):
def setUp(self):
super().setUp()
m = self.machine
# packagekit/dnf often eats a lot of CPU; silence it to have better control over CPU usage
packagekitd = "/usr/lib/packagekitd" if self.machine.image == "arch" else "/usr/libexec/packagekitd"
self.machine.execute(f"systemctl mask packagekit && killall -9 {packagekitd} && killall -9 dnf || true")
packagekitd = "/usr/lib/packagekitd" if m.image == "arch" else "/usr/libexec/packagekitd"
m.execute(f"systemctl mask packagekit && killall -9 {packagekitd} && killall -9 dnf || true")

self.addCleanup(self.machine.execute, "systemctl unmask packagekit")
self.addCleanup(m.execute, "systemctl unmask packagekit")
# make sure to clean up our test resource consumers on failures
self.addCleanup(self.machine.execute, "systemctl stop cockpittest.slice 2>/dev/null || true")
self.addCleanup(self.machine.execute, "su - admin -c 'XDG_RUNTIME_DIR=/run/user/$(id -u admin) "
"systemctl --user stop cockpittest.slice 2>/dev/null || true'")
self.addCleanup(m.execute, "systemctl stop cockpittest.slice 2>/dev/null || true")
self.addCleanup(m.execute, "su - admin -c 'XDG_RUNTIME_DIR=/run/user/$(id -u admin) "
"systemctl --user stop cockpittest.slice 2>/dev/null || true'")

self.busybox_image = self.machine.execute("podman images --format '{{.Repository}}' | grep busybox").strip()
self.busybox_image = m.execute("podman images --format '{{.Repository}}' | grep busybox").strip()
self.login_and_go("/metrics")

# hack around https://github.com/containers/podman/issues/21896 for our offline test VMs
if not m.execute("ip route show default").strip() and "5.0" in m.execute("podman version"):
m.execute("nmcli con add type dummy con-name fake ifname fake0 ip4 1.2.3.4/24 gw4 1.2.3.1")
self.addCleanup(m.execute, "nmcli con delete fake")

def testCPU(self):
b = self.browser
m = self.machine
Expand Down
Loading