Skip to content

Commit 003d6f2

Browse files
pintaoz-awspintaoz
andauthored
Fix hyperpod exec command failure (#87)
* Fix hyperpod exec command failure * Fix tests --------- Co-authored-by: pintaoz <[email protected]>
1 parent df48c82 commit 003d6f2

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

src/hyperpod_cli/service/exec_command.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,7 @@ def exec_command(
3434
all_pods: Optional[bool],
3535
bash_command: tuple,
3636
):
37-
before_seperator = bash_command[: bash_command.index("-")]
38-
39-
if before_seperator:
40-
raise RuntimeError(
41-
f"please provide bash command after -, unexpected char found {before_seperator}"
42-
)
43-
44-
after_seperator = bash_command[bash_command.index("-") + 1 :]
45-
bash_command_str: str = " ".join(after_seperator)
37+
bash_command_str: str = " ".join(bash_command)
4638

4739
k8s_client = KubernetesClient()
4840
list_pods_service = ListPods()

test/unit_tests/service/test_exec_command_service.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def test_exec_with_pod_without_namespace(
5757
None,
5858
False,
5959
(
60-
"-",
6160
"date",
6261
),
6362
)
@@ -86,7 +85,6 @@ def test_exec_with_pod_with_namespace(
8685
"kubeflow",
8786
False,
8887
(
89-
"-",
9088
"date",
9189
),
9290
)
@@ -110,23 +108,6 @@ def test_exec_with_pod_with_namespace_unknown_pod(
110108
"kubeflow",
111109
False,
112110
(
113-
"-",
114-
"date",
115-
),
116-
)
117-
118-
def test_exec_with_input_before_dash_raises_exception(
119-
self,
120-
):
121-
with self.assertRaises(RuntimeError):
122-
self.mock_exec_command.exec_command(
123-
"sample-job",
124-
"sample-job-master-0",
125-
"kubeflow",
126-
False,
127-
(
128-
"date",
129-
"-",
130111
"date",
131112
),
132113
)
@@ -154,7 +135,6 @@ def test_exec_with_pod_with_namespace_all_pod(
154135
"kubeflow",
155136
True,
156137
(
157-
"-",
158138
"date",
159139
),
160140
)
@@ -184,7 +164,6 @@ def test_exec_with_pod_with_namespace_all_pod_api_exception(
184164
"kubeflow",
185165
True,
186166
(
187-
"-",
188167
"date",
189168
),
190169
)

0 commit comments

Comments
 (0)