csi: Add NodeStageVolume to fake client

This commit is contained in:
Danielle Lancashire
2020-01-23 12:28:57 +01:00
committed by Tim Gross
parent 3b667d68c1
commit c48d5a95a1
2 changed files with 16 additions and 0 deletions

View File

@@ -50,6 +50,9 @@ type Client struct {
NextNodeGetInfoResponse *csi.NodeGetInfoResponse
NextNodeGetInfoErr error
NodeGetInfoCallCount int64
NextNodeStageVolumeErr error
NodeStageVolumeCallCount int64
}
// PluginInfo describes the type and version of a plugin.
@@ -146,6 +149,18 @@ func (c *Client) NodeGetInfo(ctx context.Context) (*csi.NodeGetInfoResponse, err
return c.NextNodeGetInfoResponse, c.NextNodeGetInfoErr
}
// NodeStageVolume is used when a plugin has the STAGE_UNSTAGE volume capability
// to prepare a volume for usage on a host. If err == nil, the response should
// be assumed to be successful.
func (c *Client) NodeStageVolume(ctx context.Context, volumeID string, publishContext map[string]string, stagingTargetPath string, capabilities *csi.VolumeCapability) error {
c.Mu.Lock()
defer c.Mu.Unlock()
c.NodeStageVolumeCallCount++
return c.NextNodeStageVolumeErr
}
// Shutdown the client and ensure any connections are cleaned up.
func (c *Client) Close() error {
return nil

View File

@@ -95,6 +95,7 @@ func (f *NodeClient) Reset() {
f.NextErr = nil
f.NextCapabilitiesResponse = nil
f.NextGetInfoResponse = nil
f.NextStageVolumeResponse = nil
}
func (c *NodeClient) NodeGetCapabilities(ctx context.Context, in *csipbv1.NodeGetCapabilitiesRequest, opts ...grpc.CallOption) (*csipbv1.NodeGetCapabilitiesResponse, error) {