Skip to content

Commit

Permalink
feat: Support SINGLE_NODE_MULTI_WRITER capability (#725)
Browse files Browse the repository at this point in the history
See #327
  • Loading branch information
Lukas Metzner authored Oct 2, 2024
1 parent d46a54b commit cd53c23
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
53 changes: 38 additions & 15 deletions internal/driver/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,25 +741,48 @@ func TestControllerServiceValidateVolumeCapabilities(t *testing.T) {
return &csi.Volume{ID: id}, nil
}

req := &proto.ValidateVolumeCapabilitiesRequest{
VolumeId: "1",
VolumeCapabilities: []*proto.VolumeCapability{
{
AccessMode: &proto.VolumeCapability_AccessMode{
Mode: proto.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
testCases := []struct {
Name string
Req *proto.ValidateVolumeCapabilitiesRequest
Code codes.Code
}{
{
Name: "SINGLE_NODE_WRITER",
Req: &proto.ValidateVolumeCapabilitiesRequest{
VolumeId: "1",
VolumeCapabilities: []*proto.VolumeCapability{
{
AccessMode: &proto.VolumeCapability_AccessMode{
Mode: proto.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
},
},
},
},
Code: codes.OK,
},
{
Name: "SINGLE_NODE_MULTI_WRITER",
Req: &proto.ValidateVolumeCapabilitiesRequest{
VolumeId: "1",
VolumeCapabilities: []*proto.VolumeCapability{
{
AccessMode: &proto.VolumeCapability_AccessMode{
Mode: proto.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER,
},
},
},
},
Code: codes.OK,
},
}
resp, err := env.service.ValidateVolumeCapabilities(env.ctx, req)
if err != nil {
t.Fatal(err)
}
if resp.Confirmed == nil {
t.Fatal("expected confirmation")
}
if len(resp.Confirmed.VolumeCapabilities) != 1 {
t.Errorf("unexpected confirmed capabilities: %v", resp.Confirmed.VolumeCapabilities)

for _, testCase := range testCases {
t.Run(testCase.Name, func(t *testing.T) {
_, err := env.service.ValidateVolumeCapabilities(env.ctx, testCase.Req)
if status.Code(err) != testCase.Code {
t.Fatalf("unexpected error: %v", err)
}
})
}
}

Expand Down
2 changes: 2 additions & 0 deletions internal/driver/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func isCapabilitySupported(cap *proto.VolumeCapability) bool {
switch cap.AccessMode.Mode {
case proto.VolumeCapability_AccessMode_SINGLE_NODE_WRITER:
return true
case proto.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER:
return true
default:
return false
}
Expand Down
1 change: 0 additions & 1 deletion test/e2e/kubernetes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ parallel: bin
serial: bin
$(GINKGO) $(GINKGO_ARGS) \
-focus='External.Storage.*(\[Feature:|\[Serial\])' \
-skip='\[Feature:SELinuxMountReadWriteOncePod\]' \
$(E2E) -- $(E2E_ARGS)

test: parallel serial

0 comments on commit cd53c23

Please sign in to comment.