Skip to content

Commit

Permalink
trunner: add reboot property in yaml
Browse files Browse the repository at this point in the history
JIRA CI-303
  • Loading branch information
mateusz-bloch committed Jul 24, 2023
1 parent 6c0ba39 commit 2d714de
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions psh/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ test:
tests:
- name: gibber
harness: test-gibber.py
reboot: True

- name: auth
harness: test-auth.py
Expand Down
10 changes: 10 additions & 0 deletions trunner/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ConfigParser:
class MainConfig:
targets: Optional[Set] = None
type: Optional[str] = None
should_reboot: bool = False
ignore: bool = False
nightly: bool = False

Expand Down Expand Up @@ -169,6 +170,14 @@ def _parse_shell_command(self, config: dict):
cmd=parsed_cmd,
)

def _parse_reboot(self, config: dict) -> None:
should_reboot = config.get("reboot", self.main.should_reboot)

if not isinstance(should_reboot, bool):
raise ParserError(f"reboot must be a boolean value (true/false) not {should_reboot}")

self.test.should_reboot = should_reboot

def _parse_ignore(self, config: dict) -> None:
ignore = config.get("ignore", self.main.ignore)

Expand Down Expand Up @@ -248,6 +257,7 @@ def _parse_config(self, config: dict):
if self.test.ignore:
return

self._parse_reboot(config)
self._parse_shell_command(config)
self._parse_load(config)
self._parse_kwargs(config)
Expand Down
2 changes: 0 additions & 2 deletions trunner/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ def set_reboot_flag(tests, idx, result):
if idx == len(tests) - 1:
return

tests[idx + 1].should_reboot = False

if result.is_skip():
tests[idx + 1].should_reboot = tests[idx].should_reboot

Expand Down
2 changes: 1 addition & 1 deletion trunner/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class TestOptions:
target: Optional[str] = None
bootloader: Optional[BootloaderOptions] = None
shell: Optional[ShellOptions] = None
should_reboot: bool = True
should_reboot: bool = False
ignore: bool = False
nightly: bool = False
kwargs: Dict = field(default_factory=dict)

0 comments on commit 2d714de

Please sign in to comment.