@@ -66,6 +66,8 @@ def setup_torchserve():
66
66
MODEL_STORE = os .path .join (ROOT_DIR , "model_store/" )
67
67
PLUGIN_STORE = os .path .join (ROOT_DIR , "plugins-path" )
68
68
69
+ Path (test_utils .MODEL_STORE ).mkdir (parents = True , exist_ok = True )
70
+
69
71
test_utils .start_torchserve (no_config_snapshots = True , plugin_folder = PLUGIN_STORE )
70
72
71
73
key = read_key_file ("management" )
@@ -94,10 +96,10 @@ def setup_torchserve_expiration():
94
96
MODEL_STORE = os .path .join (ROOT_DIR , "model_store/" )
95
97
PLUGIN_STORE = os .path .join (ROOT_DIR , "plugins-path" )
96
98
99
+ Path (test_utils .MODEL_STORE ).mkdir (parents = True , exist_ok = True )
100
+
97
101
test_utils .start_torchserve (
98
- snapshot_file = config_file ,
99
- no_config_snapshots = True ,
100
- plugin_folder = PLUGIN_STORE ,
102
+ snapshot_file = config_file , no_config_snapshots = True , plugin_folder = PLUGIN_STORE
101
103
)
102
104
103
105
key = read_key_file ("management" )
@@ -214,13 +216,14 @@ def test_token_management_api(setup_torchserve):
214
216
215
217
216
218
# Test expiration time
219
+ @pytest .mark .module2
217
220
def test_token_expiration_time (setup_torchserve_expiration ):
218
221
key = read_key_file ("management" )
219
222
header = {"Authorization" : f"Bearer { key } " }
220
223
response = requests .get ("http://localhost:8081/models/resnet18" , headers = header )
221
224
assert response .status_code == 200 , "Token check failed"
222
225
223
- time .sleep (60 )
226
+ time .sleep (15 )
224
227
225
228
response = requests .get ("http://localhost:8081/models/resnet18" , headers = header )
226
229
assert response .status_code == 400 , "Token check failed"
0 commit comments