You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2019/04/05 06:34:06 UTC
[mesos] 04/04: Extended `CSIClientTest` to test the CSI v1 client
wrapper.
This is an automated email from the ASF dual-hosted git repository.
chhsiao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 6e73de1d185cf6e9b14f268042e57e3bbaddd68d
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
AuthorDate: Sun Mar 31 17:17:15 2019 -0700
Extended `CSIClientTest` to test the CSI v1 client wrapper.
Review: https://reviews.apache.org/r/70363
---
src/tests/csi_client_tests.cpp | 31 +++
src/tests/mock_csi_plugin.cpp | 208 ++++++++++++++++++---
src/tests/mock_csi_plugin.hpp | 137 +++++++++++++-
.../storage_local_resource_provider_tests.cpp | 8 +-
4 files changed, 344 insertions(+), 40 deletions(-)
diff --git a/src/tests/csi_client_tests.cpp b/src/tests/csi_client_tests.cpp
index a2a181b..992341e 100644
--- a/src/tests/csi_client_tests.cpp
+++ b/src/tests/csi_client_tests.cpp
@@ -24,6 +24,7 @@
#include <stout/tests/utils.hpp>
#include "csi/v0_client.hpp"
+#include "csi/v1_client.hpp"
#include "tests/mock_csi_plugin.hpp"
@@ -126,6 +127,36 @@ INSTANTIATE_TEST_CASE_P(
RPCParam::Printer());
+INSTANTIATE_TEST_CASE_P(
+ V1,
+ CSIClientTest,
+ Values(
+ RPCParam::create(&csi::v1::Client::getPluginInfo),
+ RPCParam::create(&csi::v1::Client::getPluginCapabilities),
+ RPCParam::create(&csi::v1::Client::probe),
+ RPCParam::create(&csi::v1::Client::createVolume),
+ RPCParam::create(&csi::v1::Client::deleteVolume),
+ RPCParam::create(&csi::v1::Client::controllerPublishVolume),
+ RPCParam::create(&csi::v1::Client::controllerUnpublishVolume),
+ RPCParam::create(&csi::v1::Client::validateVolumeCapabilities),
+ RPCParam::create(&csi::v1::Client::listVolumes),
+ RPCParam::create(&csi::v1::Client::getCapacity),
+ RPCParam::create(&csi::v1::Client::controllerGetCapabilities),
+ RPCParam::create(&csi::v1::Client::createSnapshot),
+ RPCParam::create(&csi::v1::Client::deleteSnapshot),
+ RPCParam::create(&csi::v1::Client::listSnapshots),
+ RPCParam::create(&csi::v1::Client::controllerExpandVolume),
+ RPCParam::create(&csi::v1::Client::nodeStageVolume),
+ RPCParam::create(&csi::v1::Client::nodeUnstageVolume),
+ RPCParam::create(&csi::v1::Client::nodePublishVolume),
+ RPCParam::create(&csi::v1::Client::nodeUnpublishVolume),
+ RPCParam::create(&csi::v1::Client::nodeGetVolumeStats),
+ RPCParam::create(&csi::v1::Client::nodeExpandVolume),
+ RPCParam::create(&csi::v1::Client::nodeGetCapabilities),
+ RPCParam::create(&csi::v1::Client::nodeGetInfo)),
+ RPCParam::Printer());
+
+
// This test verifies that the all methods of CSI clients work.
TEST_P(CSIClientTest, Call)
{
diff --git a/src/tests/mock_csi_plugin.cpp b/src/tests/mock_csi_plugin.cpp
index 1024570..cbcb59f 100644
--- a/src/tests/mock_csi_plugin.cpp
+++ b/src/tests/mock_csi_plugin.cpp
@@ -26,13 +26,10 @@ using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;
-using mesos::csi::v0::Controller;
-using mesos::csi::v0::Identity;
-using mesos::csi::v0::Node;
-
using process::grpc::client::Connection;
using testing::_;
+using testing::A;
using testing::Invoke;
using testing::Return;
@@ -42,12 +39,13 @@ namespace tests {
MockCSIPlugin::MockCSIPlugin()
{
- EXPECT_CALL(*this, GetPluginInfo(_, _, _))
+ EXPECT_CALL(*this, GetPluginInfo(_, _, A<csi::v0::GetPluginInfoResponse*>()))
.WillRepeatedly(Return(Status::OK));
- // Enable all plugin capabilities by default for testing with the test CSI
- // plugin in forwarding mode.
- EXPECT_CALL(*this, GetPluginCapabilities(_, _, _))
+ // Enable all plugin service capabilities by default for testing with the test
+ // CSI plugin in forwarding mode.
+ EXPECT_CALL(*this, GetPluginCapabilities(
+ _, _, A<csi::v0::GetPluginCapabilitiesResponse*>()))
.WillRepeatedly(Invoke([](
ServerContext* context,
const csi::v0::GetPluginCapabilitiesRequest* request,
@@ -58,33 +56,37 @@ MockCSIPlugin::MockCSIPlugin()
return Status::OK;
}));
- EXPECT_CALL(*this, Probe(_, _, _))
+ EXPECT_CALL(*this, Probe(_, _, A<csi::v0::ProbeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, CreateVolume(_, _, _))
+ EXPECT_CALL(*this, CreateVolume(_, _, A<csi::v0::CreateVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, DeleteVolume(_, _, _))
+ EXPECT_CALL(*this, DeleteVolume(_, _, A<csi::v0::DeleteVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, ControllerPublishVolume(_, _, _))
+ EXPECT_CALL(*this, ControllerPublishVolume(
+ _, _, A<csi::v0::ControllerPublishVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, ControllerUnpublishVolume(_, _, _))
+ EXPECT_CALL(*this, ControllerUnpublishVolume(
+ _, _, A<csi::v0::ControllerUnpublishVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, ValidateVolumeCapabilities(_, _, _))
+ EXPECT_CALL(*this, ValidateVolumeCapabilities(
+ _, _, A<csi::v0::ValidateVolumeCapabilitiesResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, ListVolumes(_, _, _))
+ EXPECT_CALL(*this, ListVolumes(_, _, A<csi::v0::ListVolumesResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, GetCapacity(_, _, _))
+ EXPECT_CALL(*this, GetCapacity(_, _, A<csi::v0::GetCapacityResponse*>()))
.WillRepeatedly(Return(Status::OK));
- // Enable all controller capabilities by default for testing with the test CSI
- // plugin in forwarding mode.
- EXPECT_CALL(*this, ControllerGetCapabilities(_, _, _))
+ // Enable all controller RPC capabilities by default for testing with the test
+ // CSI plugin in forwarding mode.
+ EXPECT_CALL(*this, ControllerGetCapabilities(
+ _, _, A<csi::v0::ControllerGetCapabilitiesResponse*>()))
.WillRepeatedly(Invoke([](
ServerContext* context,
const csi::v0::ControllerGetCapabilitiesRequest* request,
@@ -94,31 +96,36 @@ MockCSIPlugin::MockCSIPlugin()
response->add_capabilities()->mutable_rpc()->set_type(
csi::v0::ControllerServiceCapability::RPC::PUBLISH_UNPUBLISH_VOLUME);
response->add_capabilities()->mutable_rpc()->set_type(
- csi::v0::ControllerServiceCapability::RPC::GET_CAPACITY);
- response->add_capabilities()->mutable_rpc()->set_type(
csi::v0::ControllerServiceCapability::RPC::LIST_VOLUMES);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v0::ControllerServiceCapability::RPC::GET_CAPACITY);
return Status::OK;
}));
- EXPECT_CALL(*this, NodeStageVolume(_, _, _))
+ EXPECT_CALL(*this, NodeStageVolume(
+ _, _, A<csi::v0::NodeStageVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, NodeUnstageVolume(_, _, _))
+ EXPECT_CALL(*this, NodeUnstageVolume(
+ _, _, A<csi::v0::NodeUnstageVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, NodePublishVolume(_, _, _))
+ EXPECT_CALL(*this, NodePublishVolume(
+ _, _, A<csi::v0::NodePublishVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, NodeUnpublishVolume(_, _, _))
+ EXPECT_CALL(*this, NodeUnpublishVolume(
+ _, _, A<csi::v0::NodeUnpublishVolumeResponse*>()))
.WillRepeatedly(Return(Status::OK));
- EXPECT_CALL(*this, NodeGetId(_, _, _))
+ EXPECT_CALL(*this, NodeGetId(_, _, A<csi::v0::NodeGetIdResponse*>()))
.WillRepeatedly(Return(Status::OK));
- // Enable all node capabilities by default for testing with the test CSI
+ // Enable all node RPC capabilities by default for testing with the test CSI
// plugin in forwarding mode.
- EXPECT_CALL(*this, NodeGetCapabilities(_, _, _))
+ EXPECT_CALL(*this, NodeGetCapabilities(
+ _, _, A<csi::v0::NodeGetCapabilitiesResponse*>()))
.WillRepeatedly(Invoke([](
ServerContext* context,
const csi::v0::NodeGetCapabilitiesRequest* request,
@@ -128,6 +135,142 @@ MockCSIPlugin::MockCSIPlugin()
return Status::OK;
}));
+
+ EXPECT_CALL(*this, GetPluginInfo(_, _, A<csi::v1::GetPluginInfoResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ // Enable all plugin service capabilities by default for testing with the test
+ // CSI plugin in forwarding mode.
+ EXPECT_CALL(*this, GetPluginCapabilities(
+ _, _, A<csi::v1::GetPluginCapabilitiesResponse*>()))
+ .WillRepeatedly(Invoke([](
+ ServerContext* context,
+ const csi::v1::GetPluginCapabilitiesRequest* request,
+ csi::v1::GetPluginCapabilitiesResponse* response) {
+ response->add_capabilities()->mutable_service()->set_type(
+ csi::v1::PluginCapability::Service::CONTROLLER_SERVICE);
+ response->add_capabilities()->mutable_service()->set_type(
+ csi::v1::PluginCapability::Service::VOLUME_ACCESSIBILITY_CONSTRAINTS);
+
+ return Status::OK;
+ }));
+
+ EXPECT_CALL(*this, Probe(_, _, A<csi::v1::ProbeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, CreateVolume(_, _, A<csi::v1::CreateVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, DeleteVolume(_, _, A<csi::v1::DeleteVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, ControllerPublishVolume(
+ _, _, A<csi::v1::ControllerPublishVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, ControllerUnpublishVolume(
+ _, _, A<csi::v1::ControllerUnpublishVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, ValidateVolumeCapabilities(
+ _, _, A<csi::v1::ValidateVolumeCapabilitiesResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, ListVolumes(_, _, A<csi::v1::ListVolumesResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, GetCapacity(_, _, A<csi::v1::GetCapacityResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ // Enable all controller RPC capabilities by default for testing with the test
+ // CSI plugin in forwarding mode.
+ EXPECT_CALL(*this, ControllerGetCapabilities(
+ _, _, A<csi::v1::ControllerGetCapabilitiesResponse*>()))
+ .WillRepeatedly(Invoke([](
+ ServerContext* context,
+ const csi::v1::ControllerGetCapabilitiesRequest* request,
+ csi::v1::ControllerGetCapabilitiesResponse* response) {
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::CREATE_DELETE_VOLUME);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::PUBLISH_UNPUBLISH_VOLUME);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::LIST_VOLUMES);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::GET_CAPACITY);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::CREATE_DELETE_SNAPSHOT);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::LIST_SNAPSHOTS);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::CLONE_VOLUME);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::PUBLISH_READONLY);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::ControllerServiceCapability::RPC::EXPAND_VOLUME);
+
+ return Status::OK;
+ }));
+
+ EXPECT_CALL(*this, CreateSnapshot(
+ _, _, A<csi::v1::CreateSnapshotResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, DeleteSnapshot(
+ _, _, A<csi::v1::DeleteSnapshotResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, ListSnapshots(_, _, A<csi::v1::ListSnapshotsResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, ControllerExpandVolume(
+ _, _, A<csi::v1::ControllerExpandVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, NodeStageVolume(
+ _, _, A<csi::v1::NodeStageVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, NodeUnstageVolume(
+ _, _, A<csi::v1::NodeUnstageVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, NodePublishVolume(
+ _, _, A<csi::v1::NodePublishVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, NodeUnpublishVolume(
+ _, _, A<csi::v1::NodeUnpublishVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, NodeGetVolumeStats(
+ _, _, A<csi::v1::NodeGetVolumeStatsResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ EXPECT_CALL(*this, NodeExpandVolume(
+ _, _, A<csi::v1::NodeExpandVolumeResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
+
+ // Enable all node RPC capabilities by default for testing with the test CSI
+ // plugin in forwarding mode.
+ EXPECT_CALL(*this, NodeGetCapabilities(
+ _, _, A<csi::v1::NodeGetCapabilitiesResponse*>()))
+ .WillRepeatedly(Invoke([](
+ ServerContext* context,
+ const csi::v1::NodeGetCapabilitiesRequest* request,
+ csi::v1::NodeGetCapabilitiesResponse* response) {
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::NodeServiceCapability::RPC::STAGE_UNSTAGE_VOLUME);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::NodeServiceCapability::RPC::GET_VOLUME_STATS);
+ response->add_capabilities()->mutable_rpc()->set_type(
+ csi::v1::NodeServiceCapability::RPC::EXPAND_VOLUME);
+
+ return Status::OK;
+ }));
+
+ EXPECT_CALL(*this, NodeGetInfo(_, _, A<csi::v1::NodeGetInfoResponse*>()))
+ .WillRepeatedly(Return(Status::OK));
}
@@ -139,9 +282,12 @@ Try<Connection> MockCSIPlugin::startup(const Option<string>& address)
builder.AddListeningPort(address.get(), InsecureServerCredentials());
}
- builder.RegisterService(static_cast<Identity::Service*>(this));
- builder.RegisterService(static_cast<Controller::Service*>(this));
- builder.RegisterService(static_cast<Node::Service*>(this));
+ builder.RegisterService(static_cast<csi::v0::Identity::Service*>(this));
+ builder.RegisterService(static_cast<csi::v0::Controller::Service*>(this));
+ builder.RegisterService(static_cast<csi::v0::Node::Service*>(this));
+ builder.RegisterService(static_cast<csi::v1::Identity::Service*>(this));
+ builder.RegisterService(static_cast<csi::v1::Controller::Service*>(this));
+ builder.RegisterService(static_cast<csi::v1::Node::Service*>(this));
server = builder.BuildAndStart();
if (!server) {
diff --git a/src/tests/mock_csi_plugin.hpp b/src/tests/mock_csi_plugin.hpp
index 2e3cbfd..d7da1ed 100644
--- a/src/tests/mock_csi_plugin.hpp
+++ b/src/tests/mock_csi_plugin.hpp
@@ -14,8 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef __TESTS_MOCKCSIPLUGIN_HPP__
-#define __TESTS_MOCKCSIPLUGIN_HPP__
+#ifndef __TESTS_MOCK_CSI_PLUGIN_HPP__
+#define __TESTS_MOCK_CSI_PLUGIN_HPP__
#include <memory>
#include <string>
@@ -25,6 +25,7 @@
#include <grpcpp/grpcpp.h>
#include <mesos/csi/v0.hpp>
+#include <mesos/csi/v1.hpp>
#include <process/grpc.hpp>
@@ -38,13 +39,19 @@ namespace internal {
namespace tests {
// Definition of a mock CSI plugin to be used in tests with gmock.
-class MockCSIPlugin : public csi::v0::Identity::Service,
- public csi::v0::Controller::Service,
- public csi::v0::Node::Service
+class MockCSIPlugin
+ : public csi::v0::Identity::Service,
+ public csi::v0::Controller::Service,
+ public csi::v0::Node::Service,
+ public csi::v1::Identity::Service,
+ public csi::v1::Controller::Service,
+ public csi::v1::Node::Service
{
public:
MockCSIPlugin();
+ // CSI v0 RPCs.
+
MOCK_METHOD3(GetPluginInfo, grpc::Status(
grpc::ServerContext*,
const csi::v0::GetPluginInfoRequest*,
@@ -130,8 +137,126 @@ public:
const csi::v0::NodeGetCapabilitiesRequest*,
csi::v0::NodeGetCapabilitiesResponse*));
+ // CSI v1 RPCs.
+
+ MOCK_METHOD3(GetPluginInfo, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::GetPluginInfoRequest*,
+ csi::v1::GetPluginInfoResponse*));
+
+ MOCK_METHOD3(GetPluginCapabilities, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::GetPluginCapabilitiesRequest*,
+ csi::v1::GetPluginCapabilitiesResponse*));
+
+ MOCK_METHOD3(Probe, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ProbeRequest*,
+ csi::v1::ProbeResponse*));
+
+ MOCK_METHOD3(CreateVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::CreateVolumeRequest*,
+ csi::v1::CreateVolumeResponse*));
+
+ MOCK_METHOD3(DeleteVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::DeleteVolumeRequest*,
+ csi::v1::DeleteVolumeResponse*));
+
+ MOCK_METHOD3(ControllerPublishVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ControllerPublishVolumeRequest*,
+ csi::v1::ControllerPublishVolumeResponse*));
+
+ MOCK_METHOD3(ControllerUnpublishVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ControllerUnpublishVolumeRequest*,
+ csi::v1::ControllerUnpublishVolumeResponse*));
+
+ MOCK_METHOD3(ValidateVolumeCapabilities, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ValidateVolumeCapabilitiesRequest*,
+ csi::v1::ValidateVolumeCapabilitiesResponse*));
+
+ MOCK_METHOD3(ListVolumes, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ListVolumesRequest*,
+ csi::v1::ListVolumesResponse*));
+
+ MOCK_METHOD3(GetCapacity, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::GetCapacityRequest*,
+ csi::v1::GetCapacityResponse*));
+
+ MOCK_METHOD3(ControllerGetCapabilities, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ControllerGetCapabilitiesRequest*,
+ csi::v1::ControllerGetCapabilitiesResponse*));
+
+ MOCK_METHOD3(CreateSnapshot, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::CreateSnapshotRequest*,
+ csi::v1::CreateSnapshotResponse*));
+
+ MOCK_METHOD3(DeleteSnapshot, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::DeleteSnapshotRequest*,
+ csi::v1::DeleteSnapshotResponse*));
+
+ MOCK_METHOD3(ListSnapshots, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ListSnapshotsRequest*,
+ csi::v1::ListSnapshotsResponse*));
+
+ MOCK_METHOD3(ControllerExpandVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::ControllerExpandVolumeRequest*,
+ csi::v1::ControllerExpandVolumeResponse*));
+
+ MOCK_METHOD3(NodeStageVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodeStageVolumeRequest*,
+ csi::v1::NodeStageVolumeResponse*));
+
+ MOCK_METHOD3(NodeUnstageVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodeUnstageVolumeRequest*,
+ csi::v1::NodeUnstageVolumeResponse*));
+
+ MOCK_METHOD3(NodePublishVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodePublishVolumeRequest*,
+ csi::v1::NodePublishVolumeResponse*));
+
+ MOCK_METHOD3(NodeUnpublishVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodeUnpublishVolumeRequest*,
+ csi::v1::NodeUnpublishVolumeResponse*));
+
+ MOCK_METHOD3(NodeGetVolumeStats, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodeGetVolumeStatsRequest*,
+ csi::v1::NodeGetVolumeStatsResponse*));
+
+ MOCK_METHOD3(NodeExpandVolume, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodeExpandVolumeRequest*,
+ csi::v1::NodeExpandVolumeResponse*));
+
+ MOCK_METHOD3(NodeGetCapabilities, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodeGetCapabilitiesRequest*,
+ csi::v1::NodeGetCapabilitiesResponse*));
+
+ MOCK_METHOD3(NodeGetInfo, grpc::Status(
+ grpc::ServerContext*,
+ const csi::v1::NodeGetInfoRequest*,
+ csi::v1::NodeGetInfoResponse*));
+
Try<process::grpc::client::Connection> startup(
const Option<std::string>& address = None());
+
Try<Nothing> shutdown();
private:
@@ -142,4 +267,4 @@ private:
} // namespace internal {
} // namespace mesos {
-#endif // __TESTS_MOCKCSIPLUGIN_HPP__
+#endif // __TESTS_MOCK_CSI_PLUGIN_HPP__
diff --git a/src/tests/storage_local_resource_provider_tests.cpp b/src/tests/storage_local_resource_provider_tests.cpp
index da8db41..bd35150 100644
--- a/src/tests/storage_local_resource_provider_tests.cpp
+++ b/src/tests/storage_local_resource_provider_tests.cpp
@@ -87,6 +87,8 @@ using process::reap;
using process::grpc::StatusError;
+using testing::_;
+using testing::A;
using testing::AllOf;
using testing::AtMost;
using testing::Between;
@@ -4793,7 +4795,7 @@ TEST_F(StorageLocalResourceProviderTest, RetryRpcWithExponentialBackoff)
MockCSIPlugin plugin;
ASSERT_SOME(plugin.startup(mockCsiEndpoint));
- EXPECT_CALL(plugin, GetCapacity(_, _, _))
+ EXPECT_CALL(plugin, GetCapacity(_, _, A<csi::v0::GetCapacityResponse*>()))
.WillRepeatedly(Invoke([](
grpc::ServerContext* context,
const csi::v0::GetCapacityRequest* request,
@@ -4805,7 +4807,7 @@ TEST_F(StorageLocalResourceProviderTest, RetryRpcWithExponentialBackoff)
Queue<csi::v0::CreateVolumeRequest> createVolumeRequests;
Queue<Try<csi::v0::CreateVolumeResponse, StatusError>> createVolumeResults;
- EXPECT_CALL(plugin, CreateVolume(_, _, _))
+ EXPECT_CALL(plugin, CreateVolume(_, _, A<csi::v0::CreateVolumeResponse*>()))
.WillRepeatedly(Invoke([&](
grpc::ServerContext* context,
const csi::v0::CreateVolumeRequest* request,
@@ -4830,7 +4832,7 @@ TEST_F(StorageLocalResourceProviderTest, RetryRpcWithExponentialBackoff)
Queue<csi::v0::DeleteVolumeRequest> deleteVolumeRequests;
Queue<Try<csi::v0::DeleteVolumeResponse, StatusError>> deleteVolumeResults;
- EXPECT_CALL(plugin, DeleteVolume(_, _, _))
+ EXPECT_CALL(plugin, DeleteVolume(_, _, A<csi::v0::DeleteVolumeResponse*>()))
.WillRepeatedly(Invoke([&](
grpc::ServerContext* context,
const csi::v0::DeleteVolumeRequest* request,