@@ -306,6 +306,7 @@ class ModelNameValidationTest(unittest.TestCase):
306306 def test_model_name_invalid_load (self ):
307307 client = tritongrpcclient .InferenceServerClient ("localhost:8001" )
308308 for model_name in self .INVALID_TRAVERSAL_NAMES :
309+ print (f"Testing model name: { model_name !r} " )
309310 with self .assertRaises (InferenceServerException ) as cm :
310311 client .load_model (model_name )
311312 self .assertIn (
@@ -318,7 +319,10 @@ def test_model_name_empty_load(self):
318319 client = tritongrpcclient .InferenceServerClient ("localhost:8001" )
319320 with self .assertRaises (InferenceServerException ) as cm :
320321 client .load_model ("" )
321- self .assertIn ("model name must not be empty" , str (cm .exception ))
322+ self .assertIn (
323+ "Model name cannot be empty. Please enter a valid name to deploy." ,
324+ str (cm .exception ),
325+ )
322326
323327 def test_model_name_whitespace_only_load (self ):
324328 client = tritongrpcclient .InferenceServerClient ("localhost:8001" )
@@ -327,7 +331,7 @@ def test_model_name_whitespace_only_load(self):
327331 with self .assertRaises (InferenceServerException ) as cm :
328332 client .load_model (model_name )
329333 self .assertIn (
330- "model name must not contain only whitespace " ,
334+ "Model name cannot be empty. Please enter a valid name to deploy. " ,
331335 str (cm .exception ),
332336 f"Expected whitespace-only rejection for model name: { model_name !r} " ,
333337 )
@@ -348,15 +352,25 @@ def test_model_name_invalid_unload(self):
348352 def test_model_name_valid (self ):
349353 """Verify that a syntactically valid model name is not rejected by
350354 the traversal check -- it should fail with a model not found error instead."""
355+ VALID_MODEL_NAMES = [
356+ "model123" ,
357+ # "model OAI", TRI-769: Fix this test case
358+ "model.version1" ,
359+ "..." ,
360+ "..my_model" ,
361+ "model..1" ,
362+ "model....1" ,
363+ ]
351364 client = tritongrpcclient .InferenceServerClient ("localhost:8001" )
352- with self .assertRaises (InferenceServerException ) as cm :
353- client .load_model ("nonexistent_model" )
354- self .assertNotIn (
355- "path traversal characters" ,
356- str (cm .exception ),
357- "Valid model name should not trigger path traversal rejection" ,
358- )
359- self .assertIn ("failed to poll from model repository" , str (cm .exception ))
365+ for model_name in VALID_MODEL_NAMES :
366+ with self .assertRaises (InferenceServerException ) as cm :
367+ client .load_model (model_name )
368+ self .assertNotIn (
369+ "path traversal characters" ,
370+ str (cm .exception ),
371+ "Valid model name should not trigger path traversal rejection" ,
372+ )
373+ self .assertIn ("failed to poll from model repository" , str (cm .exception ))
360374
361375
362376if __name__ == "__main__" :
0 commit comments