diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/interop/stress_interop_client.cc | 3 | ||||
-rw-r--r-- | test/cpp/interop/stress_interop_client.h | 7 | ||||
-rw-r--r-- | test/cpp/interop/stress_test.cc | 23 |
3 files changed, 15 insertions, 18 deletions
diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc index a75eb99d42..f8c55cf795 100644 --- a/test/cpp/interop/stress_interop_client.cc +++ b/test/cpp/interop/stress_interop_client.cc @@ -45,7 +45,6 @@ namespace grpc { namespace testing { using std::pair; -using std::string; using std::vector; WeightedRandomTestSelector::WeightedRandomTestSelector( @@ -81,7 +80,7 @@ TestCaseType WeightedRandomTestSelector::GetNextTest() const { } StressTestInteropClient::StressTestInteropClient( - int test_id, const string& server_address, + int test_id, const grpc::string& server_address, const WeightedRandomTestSelector& test_selector, long test_duration_secs, long sleep_duration_ms) : test_id_(test_id), diff --git a/test/cpp/interop/stress_interop_client.h b/test/cpp/interop/stress_interop_client.h index 36dfa7ed61..36261e501f 100644 --- a/test/cpp/interop/stress_interop_client.h +++ b/test/cpp/interop/stress_interop_client.h @@ -46,7 +46,6 @@ namespace grpc { namespace testing { using std::pair; -using std::string; using std::vector; // TODO(sreek): Add more test cases here in future @@ -60,7 +59,7 @@ enum TestCaseType { EMPTY_STREAM = 5 }; -const vector<pair<TestCaseType, string>> kTestCaseList = { +const vector<pair<TestCaseType, grpc::string>> kTestCaseList = { {EMPTY_UNARY, "empty_unary"}, {LARGE_UNARY, "large_unary"}, {LARGE_COMPRESSED_UNARY, "large_compressed_unary"}, @@ -84,7 +83,7 @@ class WeightedRandomTestSelector { class StressTestInteropClient { public: - StressTestInteropClient(int test_id, const string& server_address, + StressTestInteropClient(int test_id, const grpc::string& server_address, const WeightedRandomTestSelector& test_selector, long test_duration_secs, long sleep_duration_ms); @@ -95,7 +94,7 @@ class StressTestInteropClient { int test_id_; std::unique_ptr<InteropClient> interop_client_; - const string& server_address_; + const grpc::string& server_address_; const WeightedRandomTestSelector& test_selector_; long test_duration_secs_; long sleep_duration_ms_; diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index a1f6780809..49f3fbcc14 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -83,14 +83,13 @@ using std::pair; using std::thread; using std::vector; -using grpc::string; using grpc::testing::kTestCaseList; using grpc::testing::StressTestInteropClient; using grpc::testing::TestCaseType; using grpc::testing::WeightedRandomTestSelector; using grpc::testing::UNKNOWN_TEST; -TestCaseType GetTestTypeFromName(const string& test_name) { +TestCaseType GetTestTypeFromName(const grpc::string& test_name) { TestCaseType test_case = UNKNOWN_TEST; for (auto it = kTestCaseList.begin(); it != kTestCaseList.end(); it++) { @@ -104,12 +103,12 @@ TestCaseType GetTestTypeFromName(const string& test_name) { } // Converts a string of comma delimited tokens to a vector of tokens -bool ParseCommaDelimitedString(const string& comma_delimited_str, - vector<string>& tokens) { +bool ParseCommaDelimitedString(const grpc::string& comma_delimited_str, + vector<grpc::string>& tokens) { size_t bpos = 0; - size_t epos = string::npos; + size_t epos = grpc::string::npos; - while ((epos = comma_delimited_str.find(',', bpos)) != string::npos) { + while ((epos = comma_delimited_str.find(',', bpos)) != grpc::string::npos) { tokens.emplace_back(comma_delimited_str.substr(bpos, epos - bpos)); bpos = epos + 1; } @@ -122,23 +121,23 @@ bool ParseCommaDelimitedString(const string& comma_delimited_str, // Output: // - Whether parsing was successful (return value) // - Vector of (test_type_enum, weight) pairs returned via 'tests' parameter -bool ParseTestCasesString(const string& test_cases, +bool ParseTestCasesString(const grpc::string& test_cases, vector<pair<TestCaseType, int>>& tests) { bool is_success = true; - vector<string> tokens; + vector<grpc::string> tokens; ParseCommaDelimitedString(test_cases, tokens); for (auto it = tokens.begin(); it != tokens.end(); it++) { // Token is in the form <test_name>:<test_weight> size_t colon_pos = it->find(':'); - if (colon_pos == string::npos) { + if (colon_pos == grpc::string::npos) { gpr_log(GPR_ERROR, "Error in parsing test case string: %s", it->c_str()); is_success = false; break; } - string test_name = it->substr(0, colon_pos); + grpc::string test_name = it->substr(0, colon_pos); int weight = std::stoi(it->substr(colon_pos + 1)); TestCaseType test_case = GetTestTypeFromName(test_name); if (test_case == UNKNOWN_TEST) { @@ -154,7 +153,7 @@ bool ParseTestCasesString(const string& test_cases, } // For debugging purposes -void LogParameterInfo(const vector<string>& addresses, +void LogParameterInfo(const vector<grpc::string>& addresses, const vector<pair<TestCaseType, int>>& tests) { gpr_log(GPR_INFO, "server_addresses: %s", FLAGS_server_addresses.c_str()); gpr_log(GPR_INFO, "test_cases : %s", FLAGS_test_cases.c_str()); @@ -181,7 +180,7 @@ int main(int argc, char** argv) { srand(time(NULL)); // Parse the server addresses - vector<string> server_addresses; + vector<grpc::string> server_addresses; ParseCommaDelimitedString(FLAGS_server_addresses, server_addresses); // Parse test cases and weights |