Skip to content

Commit 6efd33d

Browse files
committed
Add a test to kube_config_test to check the cwd of the ExecProvider
1 parent 1c5bf58 commit 6efd33d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

config/kube_config_test.py

+14
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,20 @@ def test_user_exec_auth_certificates(self, mock):
14411441
active_context="exec_cred_user_certificate").load_and_set(actual)
14421442
self.assertEqual(expected, actual)
14431443

1444+
@mock.patch('kubernetes.config.kube_config.ExecProvider.run', autospec=True)
1445+
def test_user_exec_cwd(self, mock):
1446+
capture = {}
1447+
def capture_cwd(exec_provider):
1448+
capture['cwd'] = exec_provider.cwd
1449+
mock.side_effect = capture_cwd
1450+
1451+
expected = "/some/random/path"
1452+
KubeConfigLoader(
1453+
config_dict=self.TEST_KUBE_CONFIG,
1454+
active_context="exec_cred_user",
1455+
config_base_path=expected).load_and_set(FakeConfig())
1456+
self.assertEqual(expected, capture['cwd'])
1457+
14441458
def test_user_cmd_path(self):
14451459
A = namedtuple('A', ['token', 'expiry'])
14461460
token = "dummy"

0 commit comments

Comments
 (0)