Skip to content

Commit

Permalink
Test Correlation Id string support for BLS (#6963)
Browse files Browse the repository at this point in the history
* Test Correlation Id string support for BLS
  • Loading branch information
pskiran1 authored Mar 11, 2024
1 parent a6ce4f6 commit 79a09f2
Showing 1 changed file with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -88,9 +88,38 @@ def test_infer_request_args(self):
requested_output_names=requested_output_names,
inputs=inputs,
model_name=model_name,
correleation_id=None,
correlation_id=None,
)

# correlation_id set to an integer
infer_request_test = pb_utils.InferenceRequest(
requested_output_names=requested_output_names,
inputs=inputs,
model_name=model_name,
correlation_id=5,
)
self.assertIsInstance(infer_request_test.correlation_id(), int)
self.assertEqual(infer_request_test.correlation_id(), 5)

# correlation_id set to string
infer_request_test = pb_utils.InferenceRequest(
requested_output_names=requested_output_names,
inputs=inputs,
model_name=model_name,
correlation_id="test_str_id-5",
)
self.assertIsInstance(infer_request_test.correlation_id(), str)
self.assertEqual(infer_request_test.correlation_id(), "test_str_id-5")

# correlation_id default
infer_request_test = pb_utils.InferenceRequest(
requested_output_names=requested_output_names,
inputs=inputs,
model_name=model_name,
)
self.assertIsInstance(infer_request_test.correlation_id(), int)
self.assertEqual(infer_request_test.correlation_id(), 0)

# request_id set to None
with self.assertRaises(TypeError) as e:
pb_utils.InferenceRequest(
Expand Down

0 comments on commit 79a09f2

Please sign in to comment.