| 321 | |
| 322 | |
| 323 | Try<Connection> MockCSIPlugin::startup(const Option<string>& address) |
| 324 | { |
| 325 | ServerBuilder builder; |
| 326 | |
| 327 | if (address.isSome()) { |
| 328 | builder.AddListeningPort(address.get(), InsecureServerCredentials()); |
| 329 | } |
| 330 | |
| 331 | builder.RegisterService(static_cast<csi::v0::Identity::Service*>(this)); |
| 332 | builder.RegisterService(static_cast<csi::v0::Controller::Service*>(this)); |
| 333 | builder.RegisterService(static_cast<csi::v0::Node::Service*>(this)); |
| 334 | builder.RegisterService(static_cast<csi::v1::Identity::Service*>(this)); |
| 335 | builder.RegisterService(static_cast<csi::v1::Controller::Service*>(this)); |
| 336 | builder.RegisterService(static_cast<csi::v1::Node::Service*>(this)); |
| 337 | |
| 338 | server = builder.BuildAndStart(); |
| 339 | if (!server) { |
| 340 | return Error("Unable to start a mock CSI plugin."); |
| 341 | } |
| 342 | |
| 343 | return address.isSome() |
| 344 | ? Connection(address.get()) |
| 345 | : Connection(server->InProcessChannel(ChannelArguments())); |
| 346 | } |
| 347 | |
| 348 | |
| 349 | Try<Nothing> MockCSIPlugin::shutdown() |
no test coverage detected