Add remaining inteorp tests to stress client

pull/6449/head
Sree Kuchibhotla 9 years ago
parent ad0f792254
commit 5130427b30
  1. 54
      test/cpp/interop/stress_interop_client.cc
  2. 25
      test/cpp/interop/stress_interop_client.h
  3. 9
      test/cpp/interop/stress_test.cc

@ -127,31 +127,67 @@ void StressTestInteropClient::MainLoop(std::shared_ptr<QpsGauge> qps_gauge) {
}
}
// TODO(sree): Add all interop tests
void StressTestInteropClient::RunTest(TestCaseType test_case) {
bool StressTestInteropClient::RunTest(TestCaseType test_case) {
bool is_success = false;
switch (test_case) {
case EMPTY_UNARY: {
interop_client_->DoEmpty();
is_success = interop_client_->DoEmpty();
break;
}
case LARGE_UNARY: {
interop_client_->DoLargeUnary();
is_success = interop_client_->DoLargeUnary();
break;
}
case LARGE_COMPRESSED_UNARY: {
interop_client_->DoLargeCompressedUnary();
is_success = interop_client_->DoLargeCompressedUnary();
break;
}
case CLIENT_STREAMING: {
interop_client_->DoRequestStreaming();
is_success = interop_client_->DoRequestStreaming();
break;
}
case SERVER_STREAMING: {
interop_client_->DoResponseStreaming();
is_success = interop_client_->DoResponseStreaming();
break;
}
case SERVER_COMPRESSED_STREAMING: {
is_success = interop_client_->DoResponseCompressedStreaming();
break;
}
case SLOW_CONSUMER: {
is_success = interop_client_->DoResponseStreamingWithSlowConsumer();
break;
}
case HALF_DUPLEX: {
is_success = interop_client_->DoHalfDuplex();
break;
}
case PING_PONG: {
is_success = interop_client_->DoPingPong();
break;
}
case CANCEL_AFTER_BEGIN: {
is_success = interop_client_->DoCancelAfterBegin();
break;
}
case CANCEL_AFTER_FIRST_RESPONSE: {
is_success = interop_client_->DoCancelAfterFirstResponse();
break;
}
case TIMEOUT_ON_SLEEPING_SERVER: {
is_success = interop_client_->DoTimeoutOnSleepingServer();
break;
}
case EMPTY_STREAM: {
interop_client_->DoEmptyStream();
is_success = interop_client_->DoEmptyStream();
break;
}
case STATUS_CODE_AND_MESSAGE: {
is_success = interop_client_->DoStatusWithMessage();
break;
}
case CUSTOM_METADATA: {
is_success = interop_client_->DoCustomMetadata();
break;
}
default: {
@ -160,6 +196,8 @@ void StressTestInteropClient::RunTest(TestCaseType test_case) {
break;
}
}
return is_success;
}
} // namespace testing

@ -49,7 +49,6 @@ namespace testing {
using std::pair;
using std::vector;
// TODO(sreek): Add more test cases here in future
enum TestCaseType {
UNKNOWN_TEST = -1,
EMPTY_UNARY = 0,
@ -57,7 +56,16 @@ enum TestCaseType {
LARGE_COMPRESSED_UNARY = 2,
CLIENT_STREAMING = 3,
SERVER_STREAMING = 4,
EMPTY_STREAM = 5
SERVER_COMPRESSED_STREAMING = 5,
SLOW_CONSUMER = 6,
HALF_DUPLEX = 7,
PING_PONG = 8,
CANCEL_AFTER_BEGIN = 9,
CANCEL_AFTER_FIRST_RESPONSE = 10,
TIMEOUT_ON_SLEEPING_SERVER = 11,
EMPTY_STREAM = 12,
STATUS_CODE_AND_MESSAGE = 13,
CUSTOM_METADATA = 14
};
const vector<pair<TestCaseType, grpc::string>> kTestCaseList = {
@ -66,7 +74,16 @@ const vector<pair<TestCaseType, grpc::string>> kTestCaseList = {
{LARGE_COMPRESSED_UNARY, "large_compressed_unary"},
{CLIENT_STREAMING, "client_streaming"},
{SERVER_STREAMING, "server_streaming"},
{EMPTY_STREAM, "empty_stream"}};
{SERVER_COMPRESSED_STREAMING, "server_compressed_streaming"},
{SLOW_CONSUMER, "slow_consumer"},
{HALF_DUPLEX, "half_duplex"},
{PING_PONG, "ping_pong"},
{CANCEL_AFTER_BEGIN, "cancel_after_begin"},
{CANCEL_AFTER_FIRST_RESPONSE, "cancel_after_first_response"},
{TIMEOUT_ON_SLEEPING_SERVER, "timeout_on_sleeping_server"},
{EMPTY_STREAM, "empty_stream"},
{STATUS_CODE_AND_MESSAGE, "status_code_and_message"},
{CUSTOM_METADATA, "custom_metadata"}};
class WeightedRandomTestSelector {
public:
@ -95,7 +112,7 @@ class StressTestInteropClient {
void MainLoop(std::shared_ptr<QpsGauge> qps_gauge);
private:
void RunTest(TestCaseType test_case);
bool RunTest(TestCaseType test_case);
int test_id_;
const grpc::string& server_address_;

@ -89,7 +89,16 @@ DEFINE_string(test_cases, "",
" large_compressed_unary\n"
" client_streaming\n"
" server_streaming\n"
" server_compressed_streaming\n"
" slow_consumer\n"
" half_duplex\n"
" ping_pong\n"
" cancel_after_begin\n"
" cancel_after_first_response\n"
" timeout_on_sleeping_server\n"
" empty_stream\n"
" status_code_and_message\n"
" custom_metadata\n"
" Example: \"empty_unary:20,large_unary:10,empty_stream:70\"\n"
" The above will execute 'empty_unary', 20% of the time,"
" 'large_unary', 10% of the time and 'empty_stream' the remaining"

Loading…
Cancel
Save