diff options
author | 2016-09-26 10:26:36 -0700 | |
---|---|---|
committer | 2016-09-26 10:26:36 -0700 | |
commit | af76e6523a0fb23fcfa639f25958967084279560 (patch) | |
tree | a85981a500bd3576c1a955d536d2eeb83c0f649f /test | |
parent | 012372f04488abc66a2c843cd312ee7865011b8e (diff) |
Fixes
Diffstat (limited to 'test')
-rw-r--r-- | test/core/end2end/connection_refused_test.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.c index ec0644728f..4149159a37 100644 --- a/test/core/end2end/connection_refused_test.c +++ b/test/core/end2end/connection_refused_test.c @@ -35,9 +35,11 @@ #include <grpc/grpc.h> #include <grpc/support/alloc.h> +#include <grpc/support/host_port.h> #include <grpc/support/log.h> #include "test/core/end2end/cq_verifier.h" +#include "test/core/util/port.h" #include "test/core/util/test_config.h" static void *tag(intptr_t i) { return (void *)i; } @@ -65,10 +67,16 @@ static void run_test(bool fail_fast) { cqv = cq_verifier_create(cq); /* create a call, channel to a port which will refuse connection */ - chan = grpc_insecure_channel_create("localhost:54321", NULL, NULL); + int port = grpc_pick_unused_port_or_die(); + char *addr; + gpr_join_host_port(&addr, "localhost", port); + + chan = grpc_insecure_channel_create(addr, NULL, NULL); call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/Foo", "nonexistant", deadline, NULL); + gpr_free(addr); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; |