Skip to content

Commit f27bb49

Browse files
committed
add unit test for proxy-url
1 parent 376f179 commit f27bb49

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

kubernetes/base/config/kube_config_test.py

+24
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ def _raise_exception(st):
104104
TEST_CLIENT_CERT_BASE64 = _base64(TEST_CLIENT_CERT)
105105
TEST_TLS_SERVER_NAME = "kubernetes.io"
106106

107+
TEST_PROXY_URL = "http://localhost:8888"
108+
107109
TEST_OIDC_TOKEN = "test-oidc-token"
108110
TEST_OIDC_INFO = "{\"name\": \"test\"}"
109111
TEST_OIDC_BASE = ".".join([
@@ -551,6 +553,12 @@ class TestKubeConfigLoader(BaseTestCase):
551553
"user": "ssl-local-file"
552554
}
553555
},
556+
{
557+
"name": "proxy",
558+
"context": {
559+
"cluster": "proxy",
560+
}
561+
},
554562
{
555563
"name": "non_existing_user",
556564
"context": {
@@ -652,6 +660,12 @@ class TestKubeConfigLoader(BaseTestCase):
652660
"tls-server-name": TEST_TLS_SERVER_NAME,
653661
}
654662
},
663+
{
664+
"name": "proxy",
665+
"cluster": {
666+
"proxy-url": TEST_PROXY_URL,
667+
}
668+
},
655669
],
656670
"users": [
657671
{
@@ -1284,6 +1298,16 @@ def test_tls_server_name(self):
12841298
active_context="tls-server-name").load_and_set(actual)
12851299
self.assertEqual(expected, actual)
12861300

1301+
def test_proxy_server(self):
1302+
expected = FakeConfig(
1303+
proxy=TEST_PROXY_URL
1304+
)
1305+
actual = FakeConfig()
1306+
KubeConfigLoader(
1307+
config_dict=self.TEST_KUBE_CONFIG,
1308+
active_context="proxy").load_and_set(actual)
1309+
self.assertEqual(expected, actual)
1310+
12871311
def test_list_contexts(self):
12881312
loader = KubeConfigLoader(
12891313
config_dict=self.TEST_KUBE_CONFIG,

0 commit comments

Comments
 (0)