aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c4
-rw-r--r--test/core/end2end/tests/request_response_with_metadata_and_payload.c4
-rw-r--r--test/core/end2end/tests/request_response_with_payload.c4
-rw-r--r--test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c4
-rw-r--r--test/core/end2end/tests/request_with_large_metadata.c4
-rw-r--r--test/core/end2end/tests/request_with_payload.c4
-rw-r--r--test/cpp/end2end/async_end2end_test.cc5
-rw-r--r--test/cpp/qps/client_sync.cc51
-rw-r--r--test/cpp/qps/qps_driver.cc9
9 files changed, 52 insertions, 37 deletions
diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
index 281091cdf9..9569b73339 100644
--- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
@@ -198,7 +198,7 @@ static void test_request_response_with_metadata_and_payload(
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op++;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -215,7 +215,7 @@ static void test_request_response_with_metadata_and_payload(
cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client);
- GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c
index 1590aa23fa..4478d6edfa 100644
--- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c
@@ -184,7 +184,7 @@ static void test_request_response_with_metadata_and_payload(
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op++;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -201,7 +201,7 @@ static void test_request_response_with_metadata_and_payload(
cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client);
- GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c
index b94b6761eb..d04171c590 100644
--- a/test/core/end2end/tests/request_response_with_payload.c
+++ b/test/core/end2end/tests/request_response_with_payload.c
@@ -175,7 +175,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op++;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -192,7 +192,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client);
- GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
index b4b377b606..3627a43408 100644
--- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
@@ -185,7 +185,7 @@ static void test_request_response_with_metadata_and_payload(
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 2;
op->data.send_status_from_server.trailing_metadata = meta_t;
- op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op++;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -202,7 +202,7 @@ static void test_request_response_with_metadata_and_payload(
cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client);
- GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c
index bf8309914e..8393929920 100644
--- a/test/core/end2end/tests/request_with_large_metadata.c
+++ b/test/core/end2end/tests/request_with_large_metadata.c
@@ -176,7 +176,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op++;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -193,7 +193,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client);
- GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c
index 5fe69e9109..5e2516fb73 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.c
@@ -167,7 +167,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op++;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -184,7 +184,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client);
- GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index d7c190dade..2456755ed5 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -199,8 +199,9 @@ TEST_F(AsyncEnd2endTest, AsyncNextRpc) {
stub_->AsyncEcho(&cli_ctx, send_request, &cli_cq_, tag(1)));
std::chrono::system_clock::time_point time_now(
- std::chrono::system_clock::now()),
- time_limit(std::chrono::system_clock::now() + std::chrono::seconds(5));
+ std::chrono::system_clock::now());
+ std::chrono::system_clock::time_point time_limit(
+ std::chrono::system_clock::now() + std::chrono::seconds(10));
verify_timed_ok(srv_cq_.get(), -1, true, time_now, CompletionQueue::TIMEOUT);
verify_timed_ok(&cli_cq_, -1, true, time_now, CompletionQueue::TIMEOUT);
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 0809eb5b6c..264293561d 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -66,11 +66,11 @@ class SynchronousClient : public Client {
public:
SynchronousClient(const ClientConfig& config) : Client(config) {
num_threads_ =
- config.outstanding_rpcs_per_channel() * config.client_channels();
+ config.outstanding_rpcs_per_channel() * config.client_channels();
responses_.resize(num_threads_);
}
- virtual ~SynchronousClient() {};
+ virtual ~SynchronousClient(){};
protected:
size_t num_threads_;
@@ -79,10 +79,12 @@ class SynchronousClient : public Client {
class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
public:
- SynchronousUnaryClient(const ClientConfig& config):
- SynchronousClient(config) {StartThreads(num_threads_);}
- ~SynchronousUnaryClient() {EndThreads();}
-
+ SynchronousUnaryClient(const ClientConfig& config)
+ : SynchronousClient(config) {
+ StartThreads(num_threads_);
+ }
+ ~SynchronousUnaryClient() { EndThreads(); }
+
bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE {
auto* stub = channels_[thread_idx % channels_.size()].get_stub();
double start = Timer::Now();
@@ -96,43 +98,46 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient {
public:
- SynchronousStreamingClient(const ClientConfig& config):
- SynchronousClient(config) {
- for (size_t thread_idx=0;thread_idx<num_threads_;thread_idx++){
+ SynchronousStreamingClient(const ClientConfig& config)
+ : SynchronousClient(config), context_(num_threads_), stream_(num_threads_) {
+ for (size_t thread_idx = 0; thread_idx < num_threads_; thread_idx++) {
auto* stub = channels_[thread_idx % channels_.size()].get_stub();
- stream_ = stub->StreamingCall(&context_);
+ stream_[thread_idx] = stub->StreamingCall(&context_[thread_idx]);
}
StartThreads(num_threads_);
}
~SynchronousStreamingClient() {
EndThreads();
- if (stream_) {
- SimpleResponse response;
- stream_->WritesDone();
- EXPECT_TRUE(stream_->Finish().IsOk());
+ for (auto stream = stream_.begin(); stream != stream_.end(); stream++) {
+ if (*stream) {
+ (*stream)->WritesDone();
+ EXPECT_TRUE((*stream)->Finish().IsOk());
+ }
}
}
bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE {
double start = Timer::Now();
- if (stream_->Write(request_) && stream_->Read(&responses_[thread_idx])) {
+ if (stream_[thread_idx]->Write(request_) &&
+ stream_[thread_idx]->Read(&responses_[thread_idx])) {
histogram->Add((Timer::Now() - start) * 1e9);
return true;
}
return false;
}
- private:
- grpc::ClientContext context_;
- std::unique_ptr<grpc::ClientReaderWriter<SimpleRequest,
- SimpleResponse>> stream_;
+
+ private:
+ std::vector<grpc::ClientContext> context_;
+ std::vector<std::unique_ptr<grpc::ClientReaderWriter<
+ SimpleRequest, SimpleResponse>>> stream_;
};
-std::unique_ptr<Client>
-CreateSynchronousUnaryClient(const ClientConfig& config) {
+std::unique_ptr<Client> CreateSynchronousUnaryClient(
+ const ClientConfig& config) {
return std::unique_ptr<Client>(new SynchronousUnaryClient(config));
}
-std::unique_ptr<Client>
-CreateSynchronousStreamingClient(const ClientConfig& config) {
+std::unique_ptr<Client> CreateSynchronousStreamingClient(
+ const ClientConfig& config) {
return std::unique_ptr<Client>(new SynchronousStreamingClient(config));
}
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index 93b1247d73..fc8e04201c 100644
--- a/test/cpp/qps/qps_driver.cc
+++ b/test/cpp/qps/qps_driver.cc
@@ -94,6 +94,15 @@ int main(int argc, char** argv) {
server_config.set_threads(FLAGS_server_threads);
server_config.set_enable_ssl(FLAGS_enable_ssl);
+ // If we're running a sync-server streaming test, make sure
+ // that we have at least as many threads as the active streams
+ // or else threads will be blocked from forward progress and the
+ // client will deadlock on a timer.
+ GPR_ASSERT(!(server_type == grpc::testing::SYNCHRONOUS_SERVER &&
+ rpc_type == grpc::testing::STREAMING &&
+ FLAGS_server_threads < FLAGS_client_channels *
+ FLAGS_outstanding_rpcs_per_channel));
+
auto result = RunScenario(client_config, FLAGS_num_clients,
server_config, FLAGS_num_servers,
FLAGS_warmup_seconds, FLAGS_benchmark_seconds,