Skip to content

Commit

Permalink
chore: fix wrong stressor init in validator; review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Huamin Chen <[email protected]>
  • Loading branch information
rootfs committed Nov 14, 2024
1 parent e62c168 commit 7798367
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 5 additions & 1 deletion e2e/tools/validator/src/validator/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ def stress(cfg: config.Validator, script_path: str, report_dir: str):
total_runtime_seconds = cfg.stressor.total_runtime_seconds
curve_type = cfg.stressor.curve_type
stress_test = remote.run_script(
script_path=script_path, total_runtime_seconds=total_runtime_seconds, curve_type=curve_type
script_path=script_path,
**{
"t": total_runtime_seconds,
"c": curve_type,
}
)
res.start_time = stress_test.start_time
res.end_time = stress_test.end_time
Expand Down
11 changes: 3 additions & 8 deletions e2e/tools/validator/src/validator/stresser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,13 @@ def copy(self, script_path, target_script):
self.ssh_client.exec_command(f"chmod +x {target_script}")
logger.info("copying script %s to remote - %s - successful", script_path, target_script)

def run_script(
self, script_path: str, total_runtime_seconds: int = 1200, curve_type: str = "default"
) -> ScriptResult:
def run_script(self, script_path: str, target_script: str = "/tmp/stress.sh", **kwargs) -> ScriptResult:
self.connect()
logger.info("Running script %s ...", script_path)

# ruff: noqa: S108 (Suppressed hard-coded path because we want to intentionally copy stress.sh inside `/tmp` dir)
target_script = "/tmp/stress.sh"
cli_options = f"-t {total_runtime_seconds} -c {curve_type}"
cli_options = " ".join([f"-{k} {v}" for k, v in kwargs.items()]) if kwargs else ""
command = f"{target_script} {cli_options}"
self.copy(script_path, target_script)

logger.info("Running command %s ...", command)
# ruff: noqa: DTZ005 (Suppressed non-time-zone aware object creation as it is not necessary for this use case)
start_time = datetime.now()
_, stdout, stderr = self.ssh_client.exec_command(command)
Expand Down

0 comments on commit 7798367

Please sign in to comment.