@@ -3475,6 +3475,52 @@ AWS_TEST_CASE(
34753475 rrc_request_response_success_empty_correlation_token_sequence ,
34763476 s_rrc_request_response_success_empty_correlation_token_sequence_fn )
34773477
3478+ /*
3479+ * Test that multiple rr operations with identical correlation tokens all get executed
3480+ */
3481+ static int s_rrc_request_response_success_duplicate_correlation_token_fn (struct aws_allocator * allocator , void * ctx ) {
3482+ (void )ctx ;
3483+
3484+ aws_mqtt_library_init (allocator );
3485+
3486+ struct mqtt5_client_test_options client_test_options ;
3487+ struct aws_rr_client_test_fixture fixture ;
3488+ ASSERT_SUCCESS (s_init_fixture_request_operation_success (& fixture , & client_test_options , allocator , NULL , NULL ));
3489+
3490+ struct aws_byte_cursor expected_response_topic = aws_byte_cursor_from_c_str ("test/accepted" );
3491+ struct aws_byte_cursor expected_payload = aws_byte_cursor_from_c_str ("{\"token\":\"token1\"}" );
3492+ struct aws_byte_cursor record_key = aws_byte_cursor_from_c_str ("testkey" );
3493+ struct aws_byte_cursor record_key_2 = aws_byte_cursor_from_c_str ("testkey2" );
3494+ struct aws_byte_cursor record_key_3 = aws_byte_cursor_from_c_str ("testkey3" );
3495+
3496+ ASSERT_SUCCESS (s_rrc_test_submit_test_request (
3497+ & fixture , RRC_PHDT_SUCCESS , "test" , record_key , "test/accepted" , "token1" , NULL , false));
3498+ ASSERT_SUCCESS (s_rrc_test_submit_test_request (
3499+ & fixture , RRC_PHDT_SUCCESS , "test" , record_key_2 , "test/accepted" , "token1" , NULL , false));
3500+ ASSERT_SUCCESS (s_rrc_test_submit_test_request (
3501+ & fixture , RRC_PHDT_SUCCESS , "test" , record_key_3 , "test/accepted" , "token1" , NULL , false));
3502+
3503+ // Requests using a duplicate correlation token should all complete. They will be executed in-order and
3504+ // the queue blocked until a previous operation using the duplicate correlation token completes its task.
3505+ s_rrc_wait_on_request_completion (& fixture , record_key_3 );
3506+ ASSERT_SUCCESS (s_rrc_verify_request_completion (
3507+ & fixture , record_key , AWS_ERROR_SUCCESS , & expected_response_topic , & expected_payload ));
3508+ ASSERT_SUCCESS (s_rrc_verify_request_completion (
3509+ & fixture , record_key_2 , AWS_ERROR_SUCCESS , & expected_response_topic , & expected_payload ));
3510+ ASSERT_SUCCESS (s_rrc_verify_request_completion (
3511+ & fixture , record_key_3 , AWS_ERROR_SUCCESS , & expected_response_topic , & expected_payload ));
3512+
3513+ s_aws_rr_client_test_fixture_clean_up (& fixture , false);
3514+
3515+ aws_mqtt_library_clean_up ();
3516+
3517+ return AWS_OP_SUCCESS ;
3518+ }
3519+
3520+ AWS_TEST_CASE (
3521+ rrc_request_response_success_duplicate_correlation_token ,
3522+ s_rrc_request_response_success_duplicate_correlation_token_fn )
3523+
34783524struct rrc_multi_test_operation {
34793525 const char * prefix ;
34803526 const char * token ;
0 commit comments