Skip to content

Commit 532ebe3

Browse files
authored
[fix]: grpc state cleanup fix (#7409)
1 parent 5f10d61 commit 532ebe3

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

qa/L0_grpc_state_cleanup/cleanup_test.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@ def test_simple_infer_error_status(self):
437437

438438
def test_simple_infer_shutdownserver(self):
439439
# This test case is used to check whether all the state objects are
440-
# released when the server is interrupted to shutdown in middle of
441-
# inference run with final parameters being returned.
440+
# released when the server is interrupted to shutdown in the beginning
441+
# of inference run with final parameters being returned.
442442
with self.assertRaises(InferenceServerException) as cm:
443-
self._simple_infer(request_count=10, kill_server=5)
443+
self._simple_infer(request_count=20, kill_server=5)
444444

445445
###
446446
### Streaming Tests
@@ -469,11 +469,18 @@ def test_streaming_timeout(self):
469469
def test_streaming_error_status(self):
470470
# This test case is used to check whether all the state objects are
471471
# released when RPC runs into error.
472+
expected_exceptions = [
473+
"This protocol is restricted, expecting header 'triton-grpc-protocol-infer-key'",
474+
"The stream is no longer in valid state, the error detail is reported through provided callback. A new stream should be started after stopping the current stream.",
475+
]
472476
with self.assertRaises(InferenceServerException) as cm:
473477
self._streaming_infer(request_count=10, should_error=True)
474-
self.assertIn(
475-
"This protocol is restricted, expecting header 'triton-grpc-protocol-infer-key'",
476-
str(cm.exception),
478+
479+
exception_match = False
480+
for expected_exception in expected_exceptions:
481+
exception_match |= expected_exception in str(cm.exception)
482+
self.assertTrue(
483+
exception_match, "Raised unexpected exception {}".format(str(cm.exception))
477484
)
478485

479486
def test_streaming_infer_shutdownserver(self):
@@ -520,11 +527,18 @@ def test_decoupled_timeout(self):
520527
def test_decoupled_error_status(self):
521528
# This test case is used to check whether all the state objects are
522529
# released when RPC runs into error.
530+
expected_exceptions = [
531+
"This protocol is restricted, expecting header 'triton-grpc-protocol-infer-key'",
532+
"The stream is no longer in valid state, the error detail is reported through provided callback. A new stream should be started after stopping the current stream.",
533+
]
523534
with self.assertRaises(InferenceServerException) as cm:
524535
self._decoupled_infer(request_count=10, repeat_count=10, should_error=True)
525-
self.assertIn(
526-
"This protocol is restricted, expecting header 'triton-grpc-protocol-infer-key'",
527-
str(cm.exception),
536+
537+
exception_match = False
538+
for expected_exception in expected_exceptions:
539+
exception_match |= expected_exception in str(cm.exception)
540+
self.assertTrue(
541+
exception_match, "Raised unexpected exception {}".format(str(cm.exception))
528542
)
529543

530544
def test_decoupled_infer_shutdownserver(self):

0 commit comments

Comments
 (0)