Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit 6d36aa2

Browse files
committed
fixes bug and modify assertion
1 parent f3e7ec3 commit 6d36aa2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

config/kube_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _create_temp_file_with_content(content, temp_file_path=None):
6969
if content_key in _temp_files:
7070
return _temp_files[content_key]
7171
if temp_file_path and not os.path.isdir(temp_file_path):
72-
os.makedirs(name=temp_file_path, exist_ok=True)
72+
os.makedirs(name=temp_file_path)
7373
_, name = tempfile.mkstemp(dir=temp_file_path)
7474
_temp_files[content_key] = name
7575
with open(name, 'wb') as fd:

config/kube_config_test.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1291,19 +1291,18 @@ def test_load_kube_config_from_dict(self):
12911291
self.assertEqual(expected, actual)
12921292

12931293
def test_load_kube_config_from_dict_with_temp_file_path(self):
1294-
expected = FakeConfig(host=TEST_HOST,
1295-
token=BEARER_TOKEN_FORMAT % TEST_DATA_BASE64)
12961294
actual = FakeConfig()
12971295
tmp_path = os.path.join(
12981296
os.path.dirname(
12991297
os.path.dirname(
13001298
os.path.abspath(__file__))),
13011299
'tmp_file_path_test')
13021300
load_kube_config_from_dict(config_dict=self.TEST_KUBE_CONFIG,
1303-
context="simple_token",
1301+
context="ssl",
13041302
client_configuration=actual,
13051303
temp_file_path=tmp_path)
1306-
self.assertEqual(expected, actual)
1304+
self.assertFalse(True if not os.listdir(tmp_path) else False)
1305+
_cleanup_temp_files
13071306

13081307
def test_load_kube_config_from_empty_file_like_object(self):
13091308
config_file_like_object = io.StringIO()

0 commit comments

Comments
 (0)