aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-07-19 08:40:38 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-07-19 08:40:38 -0700
commit8d1d2ee1d771d70d24932c552bccfe1bd7d51066 (patch)
treee4508a13bdc3fa98f89cfb22963204ab9790be1b
parent30a4a544be649fd06df84a386f430e5b102de4f7 (diff)
parentb5f32f0aad59c98e89734f7932fc374cdf475b3a (diff)
Merge branch 'filter_call_init_failure' into filter_api
-rw-r--r--test/core/end2end/tests/filter_call_init_fails.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c
index a1699e86c9..1be6b8bdea 100644
--- a/test/core/end2end/tests/filter_call_init_fails.c
+++ b/test/core/end2end/tests/filter_call_init_fails.c
@@ -33,6 +33,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
@@ -238,15 +239,22 @@ static const grpc_channel_filter test_filter = {
static bool maybe_add_filter(grpc_channel_stack_builder *builder, void *arg) {
if (g_enable_filter) {
- return grpc_channel_stack_builder_append_filter(builder, &test_filter,
- NULL, NULL);
+ // Want to add the filter as close to the end as possible, to make
+ // sure that all of the filters work well together. However, we
+ // can't add it at the very end, because the connected channel filter
+ // must be the last one. So we add it right before the last one.
+ grpc_channel_stack_builder_iterator *it =
+ grpc_channel_stack_builder_create_iterator_at_last(builder);
+ GPR_ASSERT(grpc_channel_stack_builder_move_prev(it));
+ return grpc_channel_stack_builder_add_filter_before(it, &test_filter,
+ NULL, NULL);
} else {
return true;
}
}
static void init_plugin(void) {
- grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, MAX_INT,
+ grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
maybe_add_filter, NULL);
}