Skip to content

Commit 5462844

Browse files
author
Otto van der Schaaf
committed
s/DistributedResponseFragment/DistributedServiceResponse/
Signed-off-by: Otto van der Schaaf <[email protected]>
1 parent 02038a0 commit 5462844

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

api/distributor/distributor.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ message DistributedRequest {
1818
repeated envoy.config.core.v3.Address services = 3 [(validate.rules).repeated .min_items = 1];
1919
}
2020

21-
message DistributedResponseFragment {
21+
message DistributedServiceResponse {
2222
oneof distributed_response_type {
2323
google.rpc.Status error = 1;
2424
nighthawk.client.ExecutionResponse execution_response = 2;
@@ -29,7 +29,7 @@ message DistributedResponseFragment {
2929

3030
// Carries responses associated with a DistributedRequest.
3131
message DistributedResponse {
32-
repeated DistributedResponseFragment fragment = 1;
32+
repeated DistributedServiceResponse service_response = 1;
3333
}
3434

3535
// Service which distributes messages to one or more other services for handling, and streams back

source/distributor/service_impl.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ NighthawkDistributorServiceImpl::handleRequest(const nighthawk::DistributedReque
6666
for (const envoy::config::core::v3::Address& service : request.services()) {
6767
absl::StatusOr<nighthawk::client::ExecutionResponse> execution_response =
6868
handleExecutionRequest(service, request.execution_request());
69-
nighthawk::DistributedResponseFragment* response_fragment = response.add_fragment();
70-
response_fragment->mutable_service()->MergeFrom(service);
69+
nighthawk::DistributedServiceResponse* service_response = response.add_service_response();
70+
service_response->mutable_service()->MergeFrom(service);
7171
if (execution_response.ok()) {
72-
*response_fragment->mutable_execution_response() = execution_response.value();
72+
*service_response->mutable_execution_response() = execution_response.value();
7373
} else {
74-
response_fragment->mutable_error()->set_code(
74+
service_response->mutable_error()->set_code(
7575
static_cast<int>(execution_response.status().code()));
76-
response_fragment->mutable_error()->set_message(
76+
service_response->mutable_error()->set_message(
7777
std::string("Distributed Execution Request failed: ") +
7878
std::string(execution_response.status().message()));
7979
has_errors = true;

test/distributor/distributor_service_test.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ TEST_P(DistributorServiceTest, ValidStartRequestNonExistingServiceYieldsResponse
149149
auto status = reader_writer->Finish();
150150
EXPECT_FALSE(status.ok());
151151
EXPECT_THAT(status.error_message(), HasSubstr("One or more execution requests failed"));
152-
ASSERT_EQ(response_.fragment_size(), 1);
153-
EXPECT_TRUE(response_.fragment(0).has_error());
154-
EXPECT_EQ(response_.fragment(0).error().code(), grpc::StatusCode::UNAVAILABLE);
155-
EXPECT_THAT(response_.fragment(0).error().message(),
152+
ASSERT_EQ(response_.service_response_size(), 1);
153+
EXPECT_TRUE(response_.service_response(0).has_error());
154+
EXPECT_EQ(response_.service_response(0).error().code(), grpc::StatusCode::UNAVAILABLE);
155+
EXPECT_THAT(response_.service_response(0).error().message(),
156156
HasSubstr("Distributed Execution Request failed: Failed to write request to the "
157157
"Nighthawk Service gRPC channel"));
158158
}
@@ -173,7 +173,7 @@ TEST_P(DistributorServiceWithMockServiceClientTest, DistributeToTwoServicesYield
173173
ASSERT_TRUE(reader_writer->Read(&response_));
174174
auto status = reader_writer->Finish();
175175
EXPECT_TRUE(status.ok());
176-
EXPECT_EQ(response_.fragment_size(), 2);
176+
EXPECT_EQ(response_.service_response_size(), 2);
177177
}
178178

179179
TEST_P(DistributorServiceWithMockServiceClientTest,
@@ -192,8 +192,8 @@ TEST_P(DistributorServiceWithMockServiceClientTest,
192192
auto status = reader_writer->Finish();
193193
EXPECT_FALSE(status.ok());
194194
EXPECT_THAT(status.error_message(), HasSubstr("One or more execution requests failed"));
195-
ASSERT_EQ(response_.fragment_size(), 1);
196-
EXPECT_THAT(response_.fragment(0).error().message(),
195+
ASSERT_EQ(response_.service_response_size(), 1);
196+
EXPECT_THAT(response_.service_response(0).error().message(),
197197
HasSubstr("artificial nighthawk service error"));
198198
}
199199

0 commit comments

Comments
 (0)