Skip to content

Commit

Permalink
squash: reboot optional
Browse files Browse the repository at this point in the history
  • Loading branch information
happz committed Nov 30, 2023
1 parent 6da1466 commit 274811a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/execute/reboot/basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ rlJournalStart
for interactive in "" "--interactive"; do
rlPhaseStartTest "Simple reboot test (interactivity: $interactive)"
rlRun -s "tmt run --scratch -i $run -dddvvva execute -h tmt $interactive"
rlAssertGrep "Reboot during test '/test' with reboot count 1" $rlRun_LOG
rlAssertGrep "Soft reboot during test '/test' with reboot count 1" $rlRun_LOG
rlAssertGrep "After first reboot" $rlRun_LOG
rlAssertGrep "Reboot during test '/test' with reboot count 2" $rlRun_LOG
rlAssertGrep "Soft reboot during test '/test' with reboot count 2" $rlRun_LOG
rlAssertGrep "After second reboot" $rlRun_LOG
rlAssertGrep "Reboot during test '/test' with reboot count 3" $rlRun_LOG
rlAssertGrep "Soft reboot during test '/test' with reboot count 3" $rlRun_LOG
rlAssertGrep "After third reboot" $rlRun_LOG
rlRun "rm $rlRun_LOG"

Expand Down
2 changes: 2 additions & 0 deletions tests/test/check/data/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@

check:
- name: watchdog

interval: 5
reboot: true

ping: true
ping-packets: 1
Expand Down
4 changes: 2 additions & 2 deletions tests/test/check/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ tier: 2
test: ./test-watchdog.sh

environment:
PROVISION_METHODS: local virtual
PROVISION_METHODS: local

adjust:
- when: how == full
environment:
PROVISION_METHODS: virtual
PROVISION_METHODS: local virtual
tag+: [additional_coverage]
5 changes: 5 additions & 0 deletions tmt/checks/watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class GuestContext:
class WatchdogCheck(Check):
interval: int = field(default=60)

reboot: bool = field(default=False)

ping: bool = field(default=False)
ping_packets: int = field(default=1)
ping_threshold: int = field(default=10)
Expand All @@ -97,6 +99,9 @@ class WatchdogCheck(Check):
def notify(self, invocation: 'TestInvocation') -> None:
""" Notify invocation that hard reboot is required """

if not self.reboot:
return

invocation.hard_reboot_requested = True
invocation.terminate_process()

Expand Down

0 comments on commit 274811a

Please sign in to comment.