@@ -3316,6 +3316,10 @@ AWS_TEST_CASE(
33163316 rrc_request_response_failure_missing_correlation_token ,
33173317 s_rrc_request_response_failure_missing_correlation_token_fn )
33183318
3319+ /*
3320+ * Use of a duplicate correlation token should result in a validation error at the point the request is submitted
3321+ * to the request response client.
3322+ */
33193323static int s_rrc_request_response_failure_duplicate_correlation_token_fn (struct aws_allocator * allocator , void * ctx ) {
33203324 (void )ctx ;
33213325
@@ -3360,6 +3364,49 @@ AWS_TEST_CASE(
33603364 rrc_request_response_failure_duplicate_correlation_token ,
33613365 s_rrc_request_response_failure_duplicate_correlation_token_fn )
33623366
3367+ /*
3368+ * Reuse of a correlation token should be successful as long as the previous operation has completed.
3369+ */
3370+ static int s_rrc_request_response_success_duplicate_correlation_token_fn (struct aws_allocator * allocator , void * ctx ) {
3371+ (void )ctx ;
3372+
3373+ aws_mqtt_library_init (allocator );
3374+
3375+ struct mqtt5_client_test_options client_test_options ;
3376+ struct aws_rr_client_test_fixture fixture ;
3377+ ASSERT_SUCCESS (s_init_fixture_request_operation_success (& fixture , & client_test_options , allocator , NULL , NULL ));
3378+
3379+ struct aws_byte_cursor record_key = aws_byte_cursor_from_c_str ("testkey" );
3380+ ASSERT_SUCCESS (s_rrc_test_submit_test_request (
3381+ & fixture , RRC_PHDT_SUCCESS , "test" , record_key , "test/accepted" , "token1" , NULL , false));
3382+
3383+ s_rrc_wait_on_request_completion (& fixture , record_key );
3384+
3385+ struct aws_byte_cursor expected_response_topic = aws_byte_cursor_from_c_str ("test/accepted" );
3386+ struct aws_byte_cursor expected_payload = aws_byte_cursor_from_c_str ("{\"token\":\"token1\"}" );
3387+ ASSERT_SUCCESS (s_rrc_verify_request_completion (
3388+ & fixture , record_key , AWS_ERROR_SUCCESS , & expected_response_topic , & expected_payload ));
3389+
3390+ struct aws_byte_cursor record_key_2 = aws_byte_cursor_from_c_str ("testkey2" );
3391+ ASSERT_SUCCESS (s_rrc_test_submit_test_request (
3392+ & fixture , RRC_PHDT_SUCCESS , "test" , record_key_2 , "test/accepted" , "token1" , NULL , false));
3393+
3394+ s_rrc_wait_on_request_completion (& fixture , record_key_2 );
3395+
3396+ ASSERT_SUCCESS (s_rrc_verify_request_completion (
3397+ & fixture , record_key_2 , AWS_ERROR_SUCCESS , & expected_response_topic , & expected_payload ));
3398+
3399+ s_aws_rr_client_test_fixture_clean_up (& fixture , false);
3400+
3401+ aws_mqtt_library_clean_up ();
3402+
3403+ return AWS_OP_SUCCESS ;
3404+ }
3405+
3406+ AWS_TEST_CASE (
3407+ rrc_request_response_success_duplicate_correlation_token ,
3408+ s_rrc_request_response_success_duplicate_correlation_token_fn )
3409+
33633410static int s_rrc_request_response_failure_invalid_correlation_token_type_fn (
33643411 struct aws_allocator * allocator ,
33653412 void * ctx ) {
0 commit comments