Skip to content

Commit

Permalink
Merge branch 'main' of github.com:awslabs/aws-c-mqtt into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bretambrose committed Nov 25, 2022
2 parents 11ae38e + 2f97156 commit 0d85286
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions tests/v5/mqtt5_client_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -2582,35 +2582,22 @@ static int s_mqtt5_client_flow_control_iot_core_throughput_fn(struct aws_allocat

aws_mqtt_library_init(allocator);

uint64_t start_time1 = 0;
aws_high_res_clock_get_ticks(&start_time1);

ASSERT_SUCCESS(s_do_iot_core_throughput_test(allocator, false));

uint64_t end_time1 = 0;
aws_high_res_clock_get_ticks(&end_time1);

uint64_t test_time1 = end_time1 - start_time1;

uint64_t start_time2 = 0;
aws_high_res_clock_get_ticks(&start_time2);
uint64_t start_time = 0;
aws_high_res_clock_get_ticks(&start_time);

ASSERT_SUCCESS(s_do_iot_core_throughput_test(allocator, true));

uint64_t end_time2 = 0;
aws_high_res_clock_get_ticks(&end_time2);

uint64_t test_time2 = end_time2 - start_time2;
uint64_t end_time = 0;
aws_high_res_clock_get_ticks(&end_time);

/* We expect the unthrottled test to complete quickly */
ASSERT_TRUE(test_time1 < AWS_TIMESTAMP_NANOS);
uint64_t test_time = end_time - start_time;

/*
* We expect the throttled version to take around 5 seconds, since we're sending 21 almost-max size (127k) packets
* against a limit of 512KB/s. Since the packets are submitted immediately on CONNACK, the rate limiter
* token bucket is starting at zero and so will give us immediate throttling.
*/
ASSERT_TRUE(test_time2 > 5 * (uint64_t)AWS_TIMESTAMP_NANOS);
ASSERT_TRUE(test_time > 5 * (uint64_t)AWS_TIMESTAMP_NANOS);

aws_mqtt_library_clean_up();

Expand Down

0 comments on commit 0d85286

Please sign in to comment.