aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/client_config
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-06-09 07:50:50 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-06-09 07:50:50 -0700
commit0ca68b7cb19d2735f965d283b9974d8cd42df51d (patch)
tree10abff4f54d5c109e8aa813a340729ba1ef2689f /test/core/client_config
parent16ebf5a124026f8e9d59894b214d2e743590a93e (diff)
parent1bc2976a0f51e14d3525aecbf4b3450445ed2d1b (diff)
Merge github.com:grpc/grpc into error
Diffstat (limited to 'test/core/client_config')
-rw-r--r--test/core/client_config/lb_policies_test.c35
-rw-r--r--test/core/client_config/set_initial_connect_string_test.c1
2 files changed, 16 insertions, 20 deletions
diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c
index 2ec46124a8..1534360dea 100644
--- a/test/core/client_config/lb_policies_test.c
+++ b/test/core/client_config/lb_policies_test.c
@@ -275,6 +275,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
GPR_ASSERT(c);
completed_client = 0;
+ memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
@@ -327,6 +328,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
}
if (s_idx >= 0) {
+ memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
@@ -415,6 +417,7 @@ static grpc_call **perform_multirequest(servers_fixture *f,
kill_server(f, i);
}
+ memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
@@ -640,7 +643,7 @@ static void print_failed_expectations(const int *expected_connection_sequence,
const size_t num_iters) {
size_t i;
for (i = 0; i < num_iters; i++) {
- gpr_log(GPR_ERROR, "FAILURE: Iter, expected, actual:%d (%d, %d)", i,
+ gpr_log(GPR_ERROR, "FAILURE: Iter (expected, actual): %d (%d, %d)", i,
expected_connection_sequence[i % expected_seq_length],
actual_connection_sequence[i]);
}
@@ -664,8 +667,6 @@ static void verify_vanilla_round_robin(const servers_fixture *f,
const int actual = actual_connection_sequence[i];
const int expected = expected_connection_sequence[i % expected_seq_length];
if (actual != expected) {
- gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected,
- actual, i);
print_failed_expectations(expected_connection_sequence,
actual_connection_sequence, expected_seq_length,
num_iters);
@@ -692,24 +693,21 @@ static void verify_vanishing_floor_round_robin(
memcpy(expected_connection_sequence, actual_connection_sequence + 2,
expected_seq_length * sizeof(int));
- /* first three elements of the sequence should be [<1st>, -1] */
- if (actual_connection_sequence[0] != expected_connection_sequence[0]) {
- gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d",
- expected_connection_sequence[0], actual_connection_sequence[0], 0);
- print_failed_expectations(expected_connection_sequence,
- actual_connection_sequence, expected_seq_length,
- 1u);
- abort();
- }
-
+ /* first two elements of the sequence should be [0 (1st server), -1 (failure)]
+ */
+ GPR_ASSERT(actual_connection_sequence[0] == 0);
GPR_ASSERT(actual_connection_sequence[1] == -1);
+ /* the next two element must be [3, 0], repeating from that point: the 3 is
+ * brought forth by servers 1 and 2 disappearing after the intial pick of 0 */
+ GPR_ASSERT(actual_connection_sequence[2] == 3);
+ GPR_ASSERT(actual_connection_sequence[3] == 0);
+
+ /* make sure that the expectation obliges */
for (i = 2; i < num_iters; i++) {
const int actual = actual_connection_sequence[i];
const int expected = expected_connection_sequence[i % expected_seq_length];
if (actual != expected) {
- gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected,
- actual, i);
print_failed_expectations(expected_connection_sequence,
actual_connection_sequence, expected_seq_length,
num_iters);
@@ -757,8 +755,6 @@ static void verify_partial_carnage_round_robin(
const int actual = actual_connection_sequence[i];
const int expected = expected_connection_sequence[i % expected_seq_length];
if (actual != expected) {
- gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected,
- actual, i);
print_failed_expectations(expected_connection_sequence,
actual_connection_sequence, expected_seq_length,
num_iters);
@@ -856,8 +852,6 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
const int expected =
expected_connection_sequence[j++ % expected_seq_length];
if (actual != expected) {
- gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected,
- actual, i);
print_failed_expectations(expected_connection_sequence,
actual_connection_sequence, expected_seq_length,
num_iters);
@@ -887,7 +881,8 @@ int main(int argc, char **argv) {
GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, NULL, NULL) == NULL);
spec = test_spec_create(NUM_ITERS, NUM_SERVERS);
- /* everything is fine, all servers stay up the whole time and life's peachy */
+ /* everything is fine, all servers stay up the whole time and life's peachy
+ */
spec->verifier = verify_vanilla_round_robin;
spec->description = "test_all_server_up";
run_spec(spec);
diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c
index 1641128301..0a0da92ce2 100644
--- a/test/core/client_config/set_initial_connect_string_test.c
+++ b/test/core/client_config/set_initial_connect_string_test.c
@@ -136,6 +136,7 @@ static void start_rpc(int use_creds, int target_port) {
state.call = grpc_channel_create_call(
state.channel, NULL, GRPC_PROPAGATE_DEFAULTS, state.cq, "/Service/Method",
"localhost", gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+ memset(&state.op, 0, sizeof(state.op));
state.op.op = GRPC_OP_SEND_INITIAL_METADATA;
state.op.data.send_initial_metadata.count = 0;
state.op.flags = 0;