diff options
author | David Garcia Quintas <dgq@google.com> | 2016-05-04 19:44:37 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-05-04 19:44:37 -0700 |
commit | 1621c4d37c4cc9cfe01b99be3eb82e8b3a8b17a4 (patch) | |
tree | 6ae905c3e7cbe6cd674433c78a6b696028035af6 /test/core | |
parent | 1acf9131a1dab7510e49979fa00d89e2fc9fd116 (diff) |
Added support for trailing metadata
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/end2end/fixtures/h2_loadreporting.c | 37 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/hpack.dictionary | 2 |
2 files changed, 28 insertions, 11 deletions
diff --git a/test/core/end2end/fixtures/h2_loadreporting.c b/test/core/end2end/fixtures/h2_loadreporting.c index 13feba29f1..4ed02f9728 100644 --- a/test/core/end2end/fixtures/h2_loadreporting.c +++ b/test/core/end2end/fixtures/h2_loadreporting.c @@ -76,15 +76,26 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( typedef struct { int64_t total_bytes; - bool processed; + bool fully_processed; + uint32_t initial_token; + uint32_t final_token; } aggregated_bw_stats; -static void sample_fn(const grpc_call_stats *stats, void *lr_data) { - aggregated_bw_stats *custom_stats = (aggregated_bw_stats *)lr_data; - custom_stats->total_bytes = - (int64_t)(stats->transport_stream_stats.outgoing.data_bytes + - stats->transport_stream_stats.incoming.data_bytes); - custom_stats->processed = true; +static void sample_fn(const grpc_load_reporting_call_data *call_data, + void *user_data) { + GPR_ASSERT(user_data != NULL); + aggregated_bw_stats *custom_stats = (aggregated_bw_stats *)user_data; + if (call_data == NULL) { + /* initial invocation */ + custom_stats->initial_token = 0xDEADBEEF; + } else { + /* final invocation */ + custom_stats->total_bytes = + (int64_t)(call_data->stats->transport_stream_stats.outgoing.data_bytes + + call_data->stats->transport_stream_stats.incoming.data_bytes); + custom_stats->final_token = 0xCAFED00D; + custom_stats->fully_processed = true; + } } void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, @@ -131,11 +142,11 @@ int main(int argc, char **argv) { aggregated_bw_stats *aggr_stats_client = gpr_malloc(sizeof(aggregated_bw_stats)); aggr_stats_client->total_bytes = -1; - aggr_stats_client->processed = false; + aggr_stats_client->fully_processed = false; aggregated_bw_stats *aggr_stats_server = gpr_malloc(sizeof(aggregated_bw_stats)); aggr_stats_server->total_bytes = -1; - aggr_stats_server->processed = false; + aggr_stats_server->fully_processed = false; g_client_lrc = grpc_load_reporting_config_create(sample_fn, aggr_stats_client); @@ -155,11 +166,15 @@ int main(int argc, char **argv) { grpc_load_reporting_config_destroy(g_client_lrc); grpc_load_reporting_config_destroy(g_server_lrc); - if (aggr_stats_client->processed) { + if (aggr_stats_client->fully_processed) { GPR_ASSERT(aggr_stats_client->total_bytes >= 0); + GPR_ASSERT(aggr_stats_client->initial_token == 0xDEADBEEF); + GPR_ASSERT(aggr_stats_client->final_token == 0xCAFED00D); } - if (aggr_stats_server->processed) { + if (aggr_stats_server->fully_processed) { GPR_ASSERT(aggr_stats_server->total_bytes >= 0); + GPR_ASSERT(aggr_stats_server->initial_token == 0xDEADBEEF); + GPR_ASSERT(aggr_stats_server->final_token == 0xCAFED00D); } gpr_free(aggr_stats_client); diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index b081368ff6..097e9a8922 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -63,6 +63,7 @@ "\x13if-unmodified-since" "\x0Dlast-modified" "\x04link" +"\x0Eload-reporting" "\x08location" "\x0Cmax-forwards" "\x07:method" @@ -136,6 +137,7 @@ "\x00\x13if-unmodified-since\x00" "\x00\x0Dlast-modified\x00" "\x00\x04link\x00" +"\x00\x0Eload-reporting\x00" "\x00\x08location\x00" "\x00\x0Cmax-forwards\x00" "\x00\x07:method\x03GET" |