From e34477690c364a537c5635dc67441bcf11c39c67 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 27 May 2020 07:38:30 -0400 Subject: [PATCH] test api: allow to get commit hash from DUT Signed-off-by: Michal Mielewczyk --- test/functional/api/cas/git.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/functional/api/cas/git.py b/test/functional/api/cas/git.py index c3d128d..1ee65cd 100644 --- a/test/functional/api/cas/git.py +++ b/test/functional/api/cas/git.py @@ -9,10 +9,12 @@ from core.test_run import TestRun from connection.local_executor import LocalExecutor -def get_current_commit_hash(): - local_executor = LocalExecutor() - return local_executor.run( - f"cd {TestRun.usr.repo_dir} &&" +def get_current_commit_hash(from_dut: bool = False): + executor = TestRun.executor if from_dut else LocalExecutor() + repo_path = TestRun.usr.working_dir if from_dut else TestRun.usr.repo_dir + + return executor.run( + f"cd {repo_path} &&" f'git show HEAD -s --pretty=format:"%H"').stdout