Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update timeouts to be more container/emu-friendly #264

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions tests/v3/connection_state_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
static const int TEST_LOG_SUBJECT = 60000;
static const int ONE_SEC = 1000000000;

#define DEFAULT_TEST_PING_TIMEOUT_MS 1000
#define DEFAULT_TEST_KEEP_ALIVE_S 2

struct received_publish_packet {
struct aws_byte_buf topic;
struct aws_byte_buf payload;
Expand Down Expand Up @@ -808,8 +811,8 @@ static int s_test_mqtt_connection_timeout_fn(struct aws_allocator *allocator, vo
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.keep_alive_time_secs = 1,
.ping_timeout_ms = 100,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
};

mqtt_mock_server_set_max_ping_resp(state_test_data->mock_server, 0);
Expand Down Expand Up @@ -934,8 +937,8 @@ static int s_test_mqtt_connection_connack_timeout_fn(struct aws_allocator *alloc
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.keep_alive_time_secs = 1,
.ping_timeout_ms = 100,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
};

mqtt_mock_server_set_max_connack(state_test_data->mock_server, 0);
Expand Down Expand Up @@ -1747,8 +1750,8 @@ static int s_test_mqtt_connection_offline_publish_fn(struct aws_allocator *alloc
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.keep_alive_time_secs = 1,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
};

ASSERT_SUCCESS(aws_mqtt_client_connection_connect(state_test_data->mqtt_connection, &connection_options));
Expand Down Expand Up @@ -1865,8 +1868,8 @@ static int s_test_mqtt_connection_disconnect_while_reconnecting(struct aws_alloc
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.keep_alive_time_secs = 1,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
};

ASSERT_SUCCESS(aws_mqtt_client_connection_connect(state_test_data->mqtt_connection, &connection_options));
Expand Down Expand Up @@ -1941,8 +1944,8 @@ static int s_test_mqtt_connection_closes_while_making_requests_fn(struct aws_all
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.keep_alive_time_secs = 1,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
};

struct aws_byte_cursor pub_topic = aws_byte_cursor_from_c_str("/test/topic");
Expand Down Expand Up @@ -2023,8 +2026,8 @@ static int s_test_mqtt_connection_resend_packets_fn(struct aws_allocator *alloca
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.keep_alive_time_secs = 1,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
};

struct aws_byte_cursor pub_topic = aws_byte_cursor_from_c_str("/test/topic");
Expand Down Expand Up @@ -2088,7 +2091,7 @@ static int s_test_mqtt_connection_not_retry_publish_QoS_0_fn(struct aws_allocato
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = 16960, /* basically stop automatically sending PINGREQ */
};

Expand Down Expand Up @@ -2155,7 +2158,7 @@ static int s_test_mqtt_connection_consistent_retry_policy_fn(struct aws_allocato
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.protocol_operation_timeout_ms = 3000,
.keep_alive_time_secs = 16960, /* basically stop automatically sending PINGREQ */
};
Expand Down Expand Up @@ -2255,8 +2258,8 @@ static int s_test_mqtt_connection_not_resend_packets_on_healthy_connection_fn(
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.keep_alive_time_secs = 1,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
};

struct aws_byte_cursor pub_topic = aws_byte_cursor_from_c_str("/test/topic");
Expand Down Expand Up @@ -2377,8 +2380,8 @@ static int s_test_mqtt_clean_session_not_retry_fn(struct aws_allocator *allocato
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.keep_alive_time_secs = 1,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = DEFAULT_TEST_KEEP_ALIVE_S,
};

ASSERT_SUCCESS(aws_mqtt_client_connection_connect(state_test_data->mqtt_connection, &connection_options));
Expand Down Expand Up @@ -2446,7 +2449,7 @@ static int s_test_mqtt_clean_session_discard_previous_fn(struct aws_allocator *a
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = 16960, /* basically stop automatically sending PINGREQ */
};

Expand Down Expand Up @@ -2516,7 +2519,7 @@ static int s_test_mqtt_clean_session_keep_next_session_fn(struct aws_allocator *
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.keep_alive_time_secs = 16960, /* basically stop automatically sending PINGREQ */
};

Expand Down Expand Up @@ -2588,7 +2591,7 @@ static int s_test_mqtt_connection_publish_QoS1_timeout_fn(struct aws_allocator *
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.protocol_operation_timeout_ms = 3000,
.keep_alive_time_secs = 16960, /* basically stop automatically sending PINGREQ */
};
Expand Down Expand Up @@ -2648,7 +2651,7 @@ static int s_test_mqtt_connection_unsub_timeout_fn(struct aws_allocator *allocat
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.protocol_operation_timeout_ms = 3000,
.keep_alive_time_secs = 16960, /* basically stop automatically sending PINGREQ */
};
Expand Down Expand Up @@ -2704,7 +2707,7 @@ static int s_test_mqtt_connection_publish_QoS1_timeout_connection_lost_reset_tim
.host_name = aws_byte_cursor_from_c_str(state_test_data->endpoint.address),
.socket_options = &state_test_data->socket_options,
.on_connection_complete = s_on_connection_complete_fn,
.ping_timeout_ms = 10,
.ping_timeout_ms = DEFAULT_TEST_PING_TIMEOUT_MS,
.protocol_operation_timeout_ms = 3000,
.keep_alive_time_secs = 16960, /* basically stop automatically sending PINGREQ */
};
Expand Down