Skip to content

Commit

Permalink
revise mock_server for fault injection mode
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Feb 20, 2025
1 parent a4664b8 commit e04a31a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mock/tateyama/faulty_service/mock_faulty_request_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ void mock_faulty_service::query(std::shared_ptr<request>, std::shared_ptr<respon

(void) ch->release(*wrt);
(void) res->release_channel(*ch);
// #else
// (void) vw->write_int(100);
#endif

jogasaki::proto::sql::response::Response head{};
Expand All @@ -104,6 +102,7 @@ void mock_faulty_service::query(std::shared_ptr<request>, std::shared_ptr<respon
}
res->body_head(head.SerializeAsString());

#if 0
std::thread th([res]{
std::this_thread::sleep_for(std::chrono::seconds(10));

Expand All @@ -114,6 +113,10 @@ void mock_faulty_service::query(std::shared_ptr<request>, std::shared_ptr<respon
res->body(response_message.SerializeAsString());
});
th.detach();
#else
std::this_thread::sleep_for(std::chrono::seconds(10));
std::cout << " ---- finish ----" << std::endl;
#endif
}

void mock_faulty_service::commit(std::shared_ptr<request>, std::shared_ptr<response> res) {
Expand Down
3 changes: 3 additions & 0 deletions mock/tateyama/server/mock_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ mock_server_main(int argc, char **argv) {
std::stringstream ss{};
ss << "[ipc_endpoint]\n";
ss << "database_name=mock\n";
ss << "[session]\n";
ss << "enable_timeout=true\n";
ss << "refresh_timeout=121\n";
ss << "[glog]\n";
ss << "logtostderr=false\n";
auto conf = std::make_shared<tateyama::api::configuration::whole>(ss, default_configuration_for_mock_server);
Expand Down

0 comments on commit e04a31a

Please sign in to comment.