Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to CSI 0.3 #56

Merged
merged 1 commit into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

[[constraint]]
name = "github.com/container-storage-interface/spec"
version = "~0.2.0"
version = "~0.3.0"

[[constraint]]
name = "github.com/golang/protobuf"
version = "1.1.0"

[[constraint]]
branch = "master"
Expand Down
29 changes: 24 additions & 5 deletions pkg/connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/golang/mock/gomock"
"github.com/golang/protobuf/proto"
"github.com/kubernetes-csi/csi-test/driver"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand All @@ -33,6 +34,24 @@ const (
driverName = "foo/bar"
)

type pbMatcher struct {
x proto.Message
}

func (p pbMatcher) Matches(x interface{}) bool {
y := x.(proto.Message)
return proto.Equal(p.x, y)
}

func (p pbMatcher) String() string {
return fmt.Sprintf("pb equal to %v", p.x)
}

func pbMatch(x interface{}) gomock.Matcher {
v := x.(proto.Message)
return &pbMatcher{v}
}

func createMockServer(t *testing.T) (*gomock.Controller, *driver.MockCSIDriver, *driver.MockIdentityServer, *driver.MockControllerServer, CSIConnection, error) {
// Start the mock server
mockController := gomock.NewController(t)
Expand Down Expand Up @@ -106,7 +125,7 @@ func TestGetPluginInfo(t *testing.T) {
}

// Setup expectation
identityServer.EXPECT().GetPluginInfo(gomock.Any(), in).Return(out, injectedErr).Times(1)
identityServer.EXPECT().GetPluginInfo(gomock.Any(), pbMatch(in)).Return(out, injectedErr).Times(1)

name, err := csiConn.GetDriverName(context.Background())
if test.expectError && err == nil {
Expand Down Expand Up @@ -210,7 +229,7 @@ func TestSupportsControllerPublish(t *testing.T) {
}

// Setup expectation
controllerServer.EXPECT().ControllerGetCapabilities(gomock.Any(), in).Return(out, injectedErr).Times(1)
controllerServer.EXPECT().ControllerGetCapabilities(gomock.Any(), pbMatch(in)).Return(out, injectedErr).Times(1)

_, err = csiConn.SupportsControllerPublish(context.Background())
if test.expectError && err == nil {
Expand Down Expand Up @@ -311,7 +330,7 @@ func TestSupportsPluginControllerService(t *testing.T) {
}

// Setup expectation
identityServer.EXPECT().GetPluginCapabilities(gomock.Any(), in).Return(out, injectedErr).Times(1)
identityServer.EXPECT().GetPluginCapabilities(gomock.Any(), pbMatch(in)).Return(out, injectedErr).Times(1)

_, err = csiConn.SupportsPluginControllerService(context.Background())
if test.expectError && err == nil {
Expand Down Expand Up @@ -489,7 +508,7 @@ func TestAttach(t *testing.T) {

// Setup expectation
if in != nil {
controllerServer.EXPECT().ControllerPublishVolume(gomock.Any(), in).Return(out, injectedErr).Times(1)
controllerServer.EXPECT().ControllerPublishVolume(gomock.Any(), pbMatch(in)).Return(out, injectedErr).Times(1)
}

publishInfo, detached, err := csiConn.Attach(context.Background(), test.volumeID, test.readonly, test.nodeID, test.caps, test.attributes, test.secrets)
Expand Down Expand Up @@ -594,7 +613,7 @@ func TestDetachAttach(t *testing.T) {

// Setup expectation
if in != nil {
controllerServer.EXPECT().ControllerUnpublishVolume(gomock.Any(), in).Return(out, injectedErr).Times(1)
controllerServer.EXPECT().ControllerUnpublishVolume(gomock.Any(), pbMatch(in)).Return(out, injectedErr).Times(1)
}

detached, err := csiConn.Detach(context.Background(), test.volumeID, test.nodeID, test.secrets)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions vendor/github.com/container-storage-interface/spec/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/github.com/container-storage-interface/spec/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/container-storage-interface/spec/VERSION

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading