Skip to content

Commit

Permalink
Test that ping is not pushed forward on timeed out publish
Browse files Browse the repository at this point in the history
  • Loading branch information
alfred2g committed Feb 4, 2024
1 parent 0589a44 commit 051e80f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/v3/connection_state_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2962,6 +2962,9 @@ static int s_test_mqtt_connection_publish_QoS1_timeout_fn(struct aws_allocator *
(void)allocator;
struct mqtt_connection_state_test *state_test_data = ctx;

struct aws_mqtt_client_connection_311_impl *connection =
state_test_data->mqtt_connection->impl;

struct aws_mqtt_connection_options connection_options = {
.user_data = state_test_data,
.clean_session = false,
Expand Down Expand Up @@ -2997,6 +3000,7 @@ static int s_test_mqtt_connection_publish_QoS1_timeout_fn(struct aws_allocator *
state_test_data);
ASSERT_TRUE(packet_id_1 > 0);

uint64_t first_ping_time = connection->next_ping_time;
/* publish should complete after the shutdown */
s_wait_for_ops_completed(state_test_data);
/* Check the publish has been completed with timeout error */
Expand All @@ -3005,6 +3009,9 @@ static int s_test_mqtt_connection_publish_QoS1_timeout_fn(struct aws_allocator *
aws_mqtt_client_connection_disconnect(state_test_data->mqtt_connection, s_on_disconnect_fn, state_test_data));
s_wait_for_disconnect_to_complete(state_test_data);

uint64_t second_ping_time = connection->next_ping_time;

ASSERT_UINT_EQUALS(first_ping_time, second_ping_time);
return AWS_OP_SUCCESS;
}

Expand Down

0 comments on commit 051e80f

Please sign in to comment.