|
25 | 25 | namespace ray { |
26 | 26 | namespace raylet { |
27 | 27 |
|
28 | | -class FakeClientConnection { |
29 | | - public: |
30 | | - static std::shared_ptr<ClientConnection> Create(instrumented_io_context &io_context) { |
31 | | - local_stream_socket socket(io_context); |
32 | | - return ClientConnection::Create( |
33 | | - [](std::shared_ptr<ClientConnection>, int64_t, const std::vector<uint8_t> &) {}, |
34 | | - [](std::shared_ptr<ClientConnection>, const boost::system::error_code &) {}, |
35 | | - std::move(socket), |
36 | | - "fake_worker_connection", |
37 | | - {}); |
38 | | - } |
39 | | -}; |
40 | | - |
41 | 28 | class FakeWorker : public WorkerInterface { |
42 | 29 | public: |
43 | 30 | FakeWorker(WorkerID worker_id, int port, instrumented_io_context &io_context) |
44 | 31 | : worker_id_(worker_id), |
45 | 32 | port_(port), |
46 | 33 | proc_(Process::CreateNewDummy()), |
47 | | - connection_(FakeClientConnection::Create(io_context)) {} |
| 34 | + connection_([&io_context]() { |
| 35 | + local_stream_socket socket(io_context); |
| 36 | + return ClientConnection::Create( |
| 37 | + [](std::shared_ptr<ClientConnection>, |
| 38 | + int64_t, |
| 39 | + const std::vector<uint8_t> &) {}, |
| 40 | + [](std::shared_ptr<ClientConnection>, const boost::system::error_code &) {}, |
| 41 | + std::move(socket), |
| 42 | + "fake_worker_connection", |
| 43 | + {}); |
| 44 | + }()) {} |
48 | 45 |
|
49 | 46 | WorkerID WorkerId() const override { return worker_id_; } |
50 | 47 | rpc::WorkerType GetWorkerType() const override { return rpc::WorkerType::WORKER; } |
|
0 commit comments