Small testing fixes

- end2end test deadlines may complete before checking IsCancelled
  => don't expect it to be false in these cases
- add exponential backoff to port_posix
- ensure run_tests rebuilds targets with a regex I commonly use
pull/4921/head
Craig Tiller 9 years ago
parent 7c43f49092
commit b0f275e4af
  1. 1
      src/proto/grpc/testing/echo_messages.proto
  2. 3
      test/core/util/port_posix.c
  3. 3
      test/cpp/end2end/end2end_test.cc
  4. 4
      tools/run_tests/run_tests.py

@ -41,6 +41,7 @@ message RequestParams {
int32 response_message_length = 6;
bool echo_peer = 7;
string expected_client_identity = 8; // will force check_auth_context.
bool skip_cancelled_check = 9;
}
message EchoRequest {

@ -37,6 +37,7 @@
#include "test/core/util/port.h"
#include <math.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <stdio.h>
@ -229,10 +230,10 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
grpc_httpcli_request req;
memset(&req, 0, sizeof(req));
GPR_ASSERT(pr->retries < 10);
sleep(1 + (unsigned)(pow(1.3, pr->retries) * rand() / RAND_MAX));
pr->retries++;
req.host = pr->server;
req.path = "/get";
sleep(1);
grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pollset, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server,
pr);

@ -244,7 +244,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
gpr_time_from_micros(request->param().server_cancel_after_us(),
GPR_TIMESPAN)));
return Status::CANCELLED;
} else {
} else if (!request->has_param() || !request->param().skip_cancelled_check()) {
EXPECT_FALSE(context->IsCancelled());
}
@ -823,6 +823,7 @@ TEST_P(ProxyEnd2endTest, RpcDeadlineExpires) {
EchoRequest request;
EchoResponse response;
request.set_message("Hello");
request.mutable_param()->set_skip_cancelled_check(true);
ClientContext context;
std::chrono::system_clock::time_point deadline =

@ -151,9 +151,9 @@ class CLanguage(object):
def make_targets(self, test_regex):
if platform_string() != 'windows' and test_regex != '.*':
# use the regex to minimize the number of things to build
return [target['name']
return [os.path.basename(target['name'])
for target in get_c_tests(False, self.test_lang)
if re.search(test_regex, target['name'])]
if re.search(test_regex, '/' + target['name'])]
if platform_string() == 'windows':
# don't build tools on windows just yet
return ['buildtests_%s' % self.make_target]

Loading…
Cancel
Save