Skip to content

Commit

Permalink
add unit test for proxy-url
Browse files Browse the repository at this point in the history
  • Loading branch information
kwibus committed Feb 4, 2024
1 parent 376f179 commit f27bb49
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions kubernetes/base/config/kube_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def _raise_exception(st):
TEST_CLIENT_CERT_BASE64 = _base64(TEST_CLIENT_CERT)
TEST_TLS_SERVER_NAME = "kubernetes.io"

TEST_PROXY_URL = "http://localhost:8888"

TEST_OIDC_TOKEN = "test-oidc-token"
TEST_OIDC_INFO = "{\"name\": \"test\"}"
TEST_OIDC_BASE = ".".join([
Expand Down Expand Up @@ -551,6 +553,12 @@ class TestKubeConfigLoader(BaseTestCase):
"user": "ssl-local-file"
}
},
{
"name": "proxy",
"context": {
"cluster": "proxy",
}
},
{
"name": "non_existing_user",
"context": {
Expand Down Expand Up @@ -652,6 +660,12 @@ class TestKubeConfigLoader(BaseTestCase):
"tls-server-name": TEST_TLS_SERVER_NAME,
}
},
{
"name": "proxy",
"cluster": {
"proxy-url": TEST_PROXY_URL,
}
},
],
"users": [
{
Expand Down Expand Up @@ -1284,6 +1298,16 @@ def test_tls_server_name(self):
active_context="tls-server-name").load_and_set(actual)
self.assertEqual(expected, actual)

def test_proxy_server(self):
expected = FakeConfig(
proxy=TEST_PROXY_URL
)
actual = FakeConfig()
KubeConfigLoader(
config_dict=self.TEST_KUBE_CONFIG,
active_context="proxy").load_and_set(actual)
self.assertEqual(expected, actual)

def test_list_contexts(self):
loader = KubeConfigLoader(
config_dict=self.TEST_KUBE_CONFIG,
Expand Down

0 comments on commit f27bb49

Please sign in to comment.