mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
csi: Add NodeStageVolume to fake client
This commit is contained in:
committed by
Tim Gross
parent
3b667d68c1
commit
c48d5a95a1
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user