19
19
import re
20
20
21
21
parent = Path (__file__ ).resolve ().parents [1 ]
22
+ aw_dir = ".codeflare/appwrapper/"
22
23
sys .path .append (str (parent ) + "/src" )
23
24
24
25
from kubernetes import client , config
@@ -241,10 +242,12 @@ def test_config_creation():
241
242
242
243
def test_cluster_creation ():
243
244
cluster = createClusterWithConfig ()
244
- assert cluster .app_wrapper_yaml == " unit-test-cluster.yaml"
245
+ assert cluster .app_wrapper_yaml == f" { aw_dir } unit-test-cluster.yaml"
245
246
assert cluster .app_wrapper_name == "unit-test-cluster"
246
247
assert filecmp .cmp (
247
- "unit-test-cluster.yaml" , f"{ parent } /tests/test-case.yaml" , shallow = True
248
+ f"{ aw_dir } unit-test-cluster.yaml" ,
249
+ f"{ parent } /tests/test-case.yaml" ,
250
+ shallow = True ,
248
251
)
249
252
250
253
@@ -258,10 +261,12 @@ def test_cluster_creation_priority(mocker):
258
261
config .name = "prio-test-cluster"
259
262
config .dispatch_priority = "default"
260
263
cluster = Cluster (config )
261
- assert cluster .app_wrapper_yaml == " prio-test-cluster.yaml"
264
+ assert cluster .app_wrapper_yaml == f" { aw_dir } prio-test-cluster.yaml"
262
265
assert cluster .app_wrapper_name == "prio-test-cluster"
263
266
assert filecmp .cmp (
264
- "prio-test-cluster.yaml" , f"{ parent } /tests/test-case-prio.yaml" , shallow = True
267
+ f"{ aw_dir } prio-test-cluster.yaml" ,
268
+ f"{ parent } /tests/test-case-prio.yaml" ,
269
+ shallow = True ,
265
270
)
266
271
267
272
@@ -275,7 +280,7 @@ def test_default_cluster_creation(mocker):
275
280
)
276
281
cluster = Cluster (default_config )
277
282
278
- assert cluster .app_wrapper_yaml == " unit-test-default-cluster.yaml"
283
+ assert cluster .app_wrapper_yaml == f" { aw_dir } unit-test-default-cluster.yaml"
279
284
assert cluster .app_wrapper_name == "unit-test-default-cluster"
280
285
assert cluster .config .namespace == "opendatahub"
281
286
@@ -285,7 +290,7 @@ def arg_check_apply_effect(group, version, namespace, plural, body, *args):
285
290
assert version == "v1beta1"
286
291
assert namespace == "ns"
287
292
assert plural == "appwrappers"
288
- with open (" unit-test-cluster.yaml" ) as f :
293
+ with open (f" { aw_dir } unit-test-cluster.yaml" ) as f :
289
294
aw = yaml .load (f , Loader = yaml .FullLoader )
290
295
assert body == aw
291
296
assert args == tuple ()
@@ -2147,7 +2152,7 @@ def parse_j(cmd):
2147
2152
2148
2153
2149
2154
def test_AWManager_creation ():
2150
- testaw = AWManager (" test.yaml" )
2155
+ testaw = AWManager (f" { aw_dir } test.yaml" )
2151
2156
assert testaw .name == "test"
2152
2157
assert testaw .namespace == "ns"
2153
2158
assert testaw .submitted == False
@@ -2171,7 +2176,7 @@ def arg_check_aw_apply_effect(group, version, namespace, plural, body, *args):
2171
2176
assert version == "v1beta1"
2172
2177
assert namespace == "ns"
2173
2178
assert plural == "appwrappers"
2174
- with open (" test.yaml" ) as f :
2179
+ with open (f" { aw_dir } test.yaml" ) as f :
2175
2180
aw = yaml .load (f , Loader = yaml .FullLoader )
2176
2181
assert body == aw
2177
2182
assert args == tuple ()
@@ -2187,7 +2192,7 @@ def arg_check_aw_del_effect(group, version, namespace, plural, name, *args):
2187
2192
2188
2193
2189
2194
def test_AWManager_submit_remove (mocker , capsys ):
2190
- testaw = AWManager (" test.yaml" )
2195
+ testaw = AWManager (f" { aw_dir } test.yaml" )
2191
2196
testaw .remove ()
2192
2197
captured = capsys .readouterr ()
2193
2198
assert (
@@ -2294,12 +2299,12 @@ def test_export_env():
2294
2299
2295
2300
# Make sure to always keep this function last
2296
2301
def test_cleanup ():
2297
- os .remove (" unit-test-cluster.yaml" )
2298
- os .remove (" prio-test-cluster.yaml" )
2299
- os .remove (" unit-test-default-cluster.yaml" )
2300
- os .remove (" test.yaml" )
2301
- os .remove (" raytest2.yaml" )
2302
- os .remove (" quicktest.yaml" )
2302
+ os .remove (f" { aw_dir } unit-test-cluster.yaml" )
2303
+ os .remove (f" { aw_dir } prio-test-cluster.yaml" )
2304
+ os .remove (f" { aw_dir } unit-test-default-cluster.yaml" )
2305
+ os .remove (f" { aw_dir } test.yaml" )
2306
+ os .remove (f" { aw_dir } raytest2.yaml" )
2307
+ os .remove (f" { aw_dir } quicktest.yaml" )
2303
2308
os .remove ("tls-cluster-namespace/ca.crt" )
2304
2309
os .remove ("tls-cluster-namespace/tls.crt" )
2305
2310
os .remove ("tls-cluster-namespace/tls.key" )
0 commit comments