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

Bump the golang group across 1 directory with 21 updates #43

Merged
merged 16 commits into from
Jan 8, 2025
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
43 changes: 23 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,35 @@ require (
github.com/akutz/gosync v0.1.0
github.com/akutz/memconn v0.1.0
github.com/container-storage-interface/spec v1.6.0
github.com/onsi/ginkgo v1.4.0
github.com/onsi/gomega v1.3.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.10.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v0.0.1
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
go.etcd.io/etcd/client/v3 v3.5.0
golang.org/x/net v0.26.0
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2
go.etcd.io/etcd/client/v3 v3.5.17
golang.org/x/net v0.33.0
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.35.1
)

require (
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/thecodeteam/gosync v0.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.17 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.17 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
268 changes: 87 additions & 181 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mock/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// New returns a new Mock Storage Plug-in Provider.
func New() gocsi.StoragePluginProvider {
svc := service.New()
svc := service.NewServer()
return &gocsi.StoragePlugin{
Controller: svc,
Identity: svc,
Expand Down
123 changes: 123 additions & 0 deletions mock/service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"strconv"
"strings"

"google.golang.org/grpc"

log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
Expand All @@ -15,11 +17,36 @@ import (
"github.com/container-storage-interface/spec/lib/go/csi"
)

func (s *serviceClient) CreateVolume(
ctx context.Context,
req *csi.CreateVolumeRequest, _ ...grpc.CallOption) (
*csi.CreateVolumeResponse, error,
) {
return s.service.CreateVolume(ctx, req)
}

func (s *service) CreateVolume(
ctx context.Context,
req *csi.CreateVolumeRequest) (
*csi.CreateVolumeResponse, error,
) {
if len(req.Name) > 128 {
return nil, status.Errorf(codes.InvalidArgument,
"exceeds size limit: Name: max=128, size=%d", len(req.Name))
}

for k, v := range req.Parameters {
if len(k) > 128 {
return nil, status.Errorf(codes.InvalidArgument,
"exceeds size limit: Parameters[%s]: max=128, size=%d", k, len(k))
}

if len(v) > 128 {
return nil, status.Errorf(codes.InvalidArgument,
"exceeds size limit: Parameters[%s]: max=128, size=%d", k, len(v))
}
}

// Check to see if the volume already exists.
if i, v := s.findVolByName(ctx, req.Name); i >= 0 {
return &csi.CreateVolumeResponse{Volume: &v}, nil
Expand All @@ -45,6 +72,14 @@ func (s *service) CreateVolume(
return &csi.CreateVolumeResponse{Volume: &v}, nil
}

func (s *serviceClient) DeleteVolume(
ctx context.Context,
req *csi.DeleteVolumeRequest, _ ...grpc.CallOption) (
*csi.DeleteVolumeResponse, error,
) {
return s.service.DeleteVolume(ctx, req)
}

func (s *service) DeleteVolume(
_ context.Context,
req *csi.DeleteVolumeRequest) (
Expand All @@ -69,6 +104,14 @@ func (s *service) DeleteVolume(
return &csi.DeleteVolumeResponse{}, nil
}

func (s *serviceClient) ControllerPublishVolume(
ctx context.Context,
req *csi.ControllerPublishVolumeRequest, _ ...grpc.CallOption) (
*csi.ControllerPublishVolumeResponse, error,
) {
return s.service.ControllerPublishVolume(ctx, req)
}

func (s *service) ControllerPublishVolume(
_ context.Context,
req *csi.ControllerPublishVolumeRequest) (
Expand Down Expand Up @@ -108,6 +151,14 @@ func (s *service) ControllerPublishVolume(
}, nil
}

func (s *serviceClient) ControllerUnpublishVolume(
ctx context.Context,
req *csi.ControllerUnpublishVolumeRequest, _ ...grpc.CallOption) (
*csi.ControllerUnpublishVolumeResponse, error,
) {
return s.service.ControllerUnpublishVolume(ctx, req)
}

func (s *service) ControllerUnpublishVolume(
_ context.Context,
req *csi.ControllerUnpublishVolumeRequest) (
Expand Down Expand Up @@ -149,6 +200,14 @@ func (s *service) ControllerUnpublishVolume(
return &csi.ControllerUnpublishVolumeResponse{}, nil
}

func (s *serviceClient) ValidateVolumeCapabilities(
ctx context.Context,
req *csi.ValidateVolumeCapabilitiesRequest, _ ...grpc.CallOption) (
*csi.ValidateVolumeCapabilitiesResponse, error,
) {
return s.service.ValidateVolumeCapabilities(ctx, req)
}

func (s *service) ValidateVolumeCapabilities(
_ context.Context,
req *csi.ValidateVolumeCapabilitiesRequest) (
Expand All @@ -163,6 +222,14 @@ func (s *service) ValidateVolumeCapabilities(
}, nil
}

func (s *serviceClient) ListVolumes(
ctx context.Context,
req *csi.ListVolumesRequest, _ ...grpc.CallOption) (
*csi.ListVolumesResponse, error,
) {
return s.service.ListVolumes(ctx, req)
}

func (s *service) ListVolumes(
_ context.Context,
req *csi.ListVolumesRequest) (
Expand Down Expand Up @@ -239,6 +306,14 @@ func (s *service) ListVolumes(
}, nil
}

func (s *serviceClient) GetCapacity(
ctx context.Context,
req *csi.GetCapacityRequest, _ ...grpc.CallOption) (
*csi.GetCapacityResponse, error,
) {
return s.service.GetCapacity(ctx, req)
}

func (s *service) GetCapacity(
_ context.Context,
_ *csi.GetCapacityRequest) (
Expand All @@ -249,6 +324,14 @@ func (s *service) GetCapacity(
}, nil
}

func (s *serviceClient) ControllerGetCapabilities(
ctx context.Context,
req *csi.ControllerGetCapabilitiesRequest, _ ...grpc.CallOption) (
*csi.ControllerGetCapabilitiesResponse, error,
) {
return s.service.ControllerGetCapabilities(ctx, req)
}

func (s *service) ControllerGetCapabilities(
_ context.Context,
_ *csi.ControllerGetCapabilitiesRequest) (
Expand Down Expand Up @@ -302,6 +385,14 @@ func (s *service) ControllerGetCapabilities(
}, nil
}

func (s *serviceClient) CreateSnapshot(
ctx context.Context,
req *csi.CreateSnapshotRequest, _ ...grpc.CallOption) (
*csi.CreateSnapshotResponse, error,
) {
return s.service.CreateSnapshot(ctx, req)
}

func (s *service) CreateSnapshot(
_ context.Context,
req *csi.CreateSnapshotRequest) (
Expand All @@ -317,6 +408,14 @@ func (s *service) CreateSnapshot(
}, nil
}

func (s *serviceClient) DeleteSnapshot(
ctx context.Context,
req *csi.DeleteSnapshotRequest, _ ...grpc.CallOption) (
*csi.DeleteSnapshotResponse, error,
) {
return s.service.DeleteSnapshot(ctx, req)
}

func (s *service) DeleteSnapshot(
_ context.Context,
req *csi.DeleteSnapshotRequest) (
Expand All @@ -329,6 +428,14 @@ func (s *service) DeleteSnapshot(
return &csi.DeleteSnapshotResponse{}, nil
}

func (s *serviceClient) ListSnapshots(
ctx context.Context,
req *csi.ListSnapshotsRequest, _ ...grpc.CallOption) (
*csi.ListSnapshotsResponse, error,
) {
return s.service.ListSnapshots(ctx, req)
}

func (s *service) ListSnapshots(
_ context.Context,
req *csi.ListSnapshotsRequest) (
Expand Down Expand Up @@ -408,6 +515,14 @@ func (s *service) ListSnapshots(
}, nil
}

func (s *serviceClient) ControllerExpandVolume(
ctx context.Context,
req *csi.ControllerExpandVolumeRequest, _ ...grpc.CallOption) (
*csi.ControllerExpandVolumeResponse, error,
) {
return s.service.ControllerExpandVolume(ctx, req)
}

func (s *service) ControllerExpandVolume(
_ context.Context,
req *csi.ControllerExpandVolumeRequest) (
Expand Down Expand Up @@ -444,6 +559,14 @@ func (s *service) ControllerExpandVolume(
}, nil
}

func (s *serviceClient) ControllerGetVolume(
ctx context.Context,
req *csi.ControllerGetVolumeRequest, _ ...grpc.CallOption) (
*csi.ControllerGetVolumeResponse, error,
) {
return s.service.ControllerGetVolume(ctx, req)
}

func (s *service) ControllerGetVolume(
_ context.Context,
_ *csi.ControllerGetVolumeRequest) (
Expand Down
23 changes: 21 additions & 2 deletions mock/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ var Manifest = map[string]string{
}

// Service is the CSI Mock service provider.
type Service interface {
type MockServer interface {
csi.ControllerServer
csi.IdentityServer
csi.NodeServer
}

type MockClient interface {
csi.ControllerClient
}

type service struct {
sync.Mutex
nodeID string
Expand All @@ -42,17 +46,32 @@ type service struct {
snapsNID uint64
}

type serviceClient struct {
service MockServer
}

// New returns a new Service.
func New() Service {
func NewServer() MockServer {
s := &service{nodeID: Name}

// add some mock volumes to start with
s.vols = []csi.Volume{
s.newVolume("Mock Volume 1", gib100),
s.newVolume("Mock Volume 2", gib100),
s.newVolume("Mock Volume 3", gib100),
}

// add some mock snapshots to start with, too
s.snaps = []csi.Snapshot{}
return s
}

func NewClient() MockClient {
return &serviceClient{
service: NewServer(),
}
}

const (
kib int64 = 1024
mib int64 = kib * 1024
Expand Down
9 changes: 8 additions & 1 deletion testing/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ var _ = Describe("Controller", func() {
Ω(vol).Should(BeNil())
Ω(err).Should(ΣCM(
codes.InvalidArgument,
"exceeds size limit: Parameters[class]=: max=128, size=129"))
"exceeds size limit: Parameters[class]: max=128, size=129"))
})
})
Context("Invalid Params Map", func() {
Expand Down Expand Up @@ -339,6 +339,7 @@ var _ = Describe("Controller", func() {
wg sync.WaitGroup
count int
opPendingErrorOccurs bool
mu sync.Mutex
)

// Verify that the newly created volume increases
Expand All @@ -358,9 +359,11 @@ var _ = Describe("Controller", func() {
defer GinkgoRecover()
if !validateNewVolumeResult(
createNewVolumeWithResult()) {
mu.Lock()
once.Do(func() {
opPendingErrorOccurs = true
})
mu.Unlock()
}
}
)
Expand All @@ -374,11 +377,13 @@ var _ = Describe("Controller", func() {
go func(i int) {
defer GinkgoRecover()
start := i * bucketSize
mu.Lock()
for j := start; j < start+bucketSize && j < count; j++ {
// fmt.Fprintf(
// GinkgoWriter, "bucket=%d, index=%d\n", i, j)
go worker()
}
mu.Unlock()
}(i)
}
}
Expand All @@ -399,8 +404,10 @@ var _ = Describe("Controller", func() {
})

AfterEach(func() {
mu.Lock()
count = 0
opPendingErrorOccurs = false
mu.Unlock()
})

Context("x1", func() {
Expand Down
Loading
Loading