Skip to content

Commit cf8f70e

Browse files
remove hardcoded port 6443 in auth (#74)
1 parent c811a2f commit cf8f70e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/codeflare_sdk/cluster/auth.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def login(self) -> str:
6565
Depending on the cluster, a user can choose to login in with "--insecure-skip-tls-verify` by setting `skip_tls`
6666
to `True`.
6767
"""
68-
args = [f"--token={self.token}", f"--server={self.server}:6443"]
68+
args = [f"--token={self.token}", f"--server={self.server}"]
6969
if self.skip_tls:
7070
args.append("--insecure-skip-tls-verify")
7171
try:
@@ -84,7 +84,7 @@ def logout(self) -> str:
8484
"""
8585
This function is used to logout of an OpenShift cluster.
8686
"""
87-
args = [f"--token={self.token}", f"--server={self.server}:6443"]
87+
args = [f"--token={self.token}", f"--server={self.server}"]
8888
response = oc.invoke("logout", args)
8989
return response.out()
9090

tests/unit_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_token_auth_login_logout(mocker):
116116
mock_res = mocker.patch.object(openshift.Result, "out")
117117
mock_res.side_effect = lambda: att_side_effect(fake_res)
118118

119-
token_auth = TokenAuthentication(token="testtoken", server="testserver")
119+
token_auth = TokenAuthentication(token="testtoken", server="testserver:6443")
120120
assert token_auth.login() == (
121121
"login",
122122
["--token=testtoken", "--server=testserver:6443"],
@@ -137,7 +137,7 @@ def test_token_auth_login_tls(mocker):
137137
# assert token_auth.login() == "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"
138138

139139
token_auth = TokenAuthentication(
140-
token="testtoken", server="testserver", skip_tls=True
140+
token="testtoken", server="testserver:6443", skip_tls=True
141141
)
142142
assert token_auth.login() == (
143143
"login",

0 commit comments

Comments
 (0)