From 0b3bc760f8f9d7cc5b05058432ed2e6b2b082de0 Mon Sep 17 00:00:00 2001 From: yunmingyang Date: Thu, 10 Oct 2024 14:53:58 +0800 Subject: [PATCH] test: add a test that checking uptime when there is a invalid time in the log --- test/check-machines-lifecycle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/check-machines-lifecycle b/test/check-machines-lifecycle index 5a8daa1af..fdfb965d9 100755 --- a/test/check-machines-lifecycle +++ b/test/check-machines-lifecycle @@ -244,6 +244,15 @@ class TestMachinesLifecycle(machineslib.VirtualMachinesCase): b.click(".pf-v5-c-modal-box__footer button:contains(Cancel)") b.wait_not_present("#vm-subVmTest2-system-confirm-action-modal") + # uptime parsing robustness: invalid time + self.machine.execute( + r"sed -i 's/^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}.*starting up/0.5: starting up/g' " + args2['qemulog']) + b.click("#vm-subVmTest2-system-shutdown-button") + b.wait_visible("#vm-subVmTest2-system-confirm-action-modal") + b.wait_in_text("#uptime", "years") + b.click(".pf-v5-c-modal-box__close button") + b.wait_not_present("#vm-subVmTest2-system-confirm-action-modal") + # uptime parsing robustness: unparseable format self.machine.execute(f"sed -i '/: starting up/ s/^/invalidtime/' {args2['qemulog']}") b.click("#vm-subVmTest2-system-shutdown-button")