Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdutka-dell committed Oct 27, 2023
1 parent 30eb7f1 commit 4783033
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/dell/gocsi v1.8.0
github.com/dell/gofsutil v1.13.1
github.com/dell/goiscsi v1.8.0
github.com/dell/gounity v1.15.0
github.com/dell/gounity v1.15.1-0.20231027105111-fc1c259b8753
github.com/fsnotify/fsnotify v1.4.9
github.com/golang/protobuf v1.5.3
github.com/kubernetes-csi/csi-lib-utils v0.7.0
Expand All @@ -20,6 +20,7 @@ require (
go.uber.org/atomic v1.7.0
golang.org/x/net v0.14.0
google.golang.org/grpc v1.57.0
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.22.2
Expand Down Expand Up @@ -74,7 +75,6 @@ require (
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
k8s.io/api v0.22.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/container-storage-interface/spec v1.1.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4=
github.com/container-storage-interface/spec v1.5.0 h1:lvKxe3uLgqQeVQcrnL2CPQKISoKjTJxojEs9cBk+HXo=
github.com/container-storage-interface/spec v1.5.0/go.mod h1:8K96oQNkJ7pFcC2R9Z1ynGGBB1I93kcS6PGg3SsOk8s=
github.com/container-storage-interface/spec v1.6.0 h1:vwN9uCciKygX/a0toYryoYD5+qI9ZFeAMuhEEKO+JBA=
github.com/container-storage-interface/spec v1.6.0/go.mod h1:8K96oQNkJ7pFcC2R9Z1ynGGBB1I93kcS6PGg3SsOk8s=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
Expand Down Expand Up @@ -101,8 +101,8 @@ github.com/dell/goiscsi v1.8.0 h1:kocGVOdgnufc6eGpfmwP66hyhY7OVgIafaS/+uM6ogU=
github.com/dell/goiscsi v1.8.0/go.mod h1:PTlQGJaGKYgia95mGwwHSBgvfOr3BfLIjGNh1HT6p+s=
github.com/dell/gonvme v1.4.0 h1:SK94ETt0pYZbaKkRJOcq81TbrzC38ufBX+w4uKwJnks=
github.com/dell/gonvme v1.4.0/go.mod h1:fIu54BDTyIu8JOTXo6Q0BqMF1tOjpO+wKXVXjLReR2o=
github.com/dell/gounity v1.15.0 h1:dGi0E3uZ6EQisBDD6idbKDE/RsMDCiuSLNyVLckfz9w=
github.com/dell/gounity v1.15.0/go.mod h1:w634+uuEp6QkkP/j2TFymCPb8gQQg9d4ZZiVrRreuLQ=
github.com/dell/gounity v1.15.1-0.20231027105111-fc1c259b8753 h1:Tm5AfD5a6L/jEeNg97/SSBpxQtpf49AE4drlHrvRdhI=
github.com/dell/gounity v1.15.1-0.20231027105111-fc1c259b8753/go.mod h1:w634+uuEp6QkkP/j2TFymCPb8gQQg9d4ZZiVrRreuLQ=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
Expand Down
2 changes: 1 addition & 1 deletion service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ func (s *service) getMaximumVolumeSize(ctx context.Context, arrayID string) (int
log.Debugf("GetMaxVolumeSize returning: %v for Array having GlobalId %s", err, arrayID)
return 0, err
}
return maxVolumeSize.MaxVolumSizeContent.Limit, nil
return int64(maxVolumeSize.MaxVolumSizeContent.Limit), nil
}

func (s *service) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
Expand Down
20 changes: 15 additions & 5 deletions test/unit-test/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1244,10 +1244,19 @@ func (f *feature) nodeExpandVolume(volID, volPath string) error {
return err
}

func (f *feature) whenICallGetCapacity() {
func (f *feature) whenICallGetCapacity() error {
ctx := context.Background()
client := csi.NewControllerClient(grpcClient)

params := make(map[string]string)
params["storagePool"] = os.Getenv("STORAGE_POOL")
params["thinProvisioned"] = "true"
params["isDataReductionEnabled"] = "false"
params["tieringPolicy"] = "0"
params["description"] = "CSI Volume Unit Test"
params["arrayId"] = os.Getenv("arrayId")
params["nasServer"] = os.Getenv("NAS_SERVER")

capability := new(csi.VolumeCapability)
mount := new(csi.VolumeCapability_MountVolume)
mountType := new(csi.VolumeCapability_Mount)
Expand All @@ -1260,17 +1269,18 @@ func (f *feature) whenICallGetCapacity() {
capabilities := make([]*csi.VolumeCapability, 0)
capabilities = append(capabilities, capability)

f.getCapacityRequest = &csi.GetCapacityRequest{VolumeCapabilities: capabilities}
f.getCapacityRequest = &csi.GetCapacityRequest{VolumeCapabilities: capabilities, Parameters: params}
response, err := client.GetCapacity(ctx, f.getCapacityRequest)
if err != nil {
fmt.Printf("GetCapacity %s:\n", err.Error())
f.addError(err)
return err
}
if err == nil {
fmt.Printf("Snapshot ID: %d \n", response.MaximumVolumeSize)
fmt.Printf("Maximum Volume Size: %v \n", response.MaximumVolumeSize)
}

f.getCapacityResponse = response
return nil
}

func FeatureContext(s *godog.Suite) {
Expand Down Expand Up @@ -1321,6 +1331,6 @@ func FeatureContext(s *godog.Suite) {
s.Step(`^When I call GetPluginCapabilities$`, f.whenICallGetPluginCapabilities)
s.Step(`^When I call GetPluginInfo$`, f.whenICallGetPluginInfo)
s.Step(`^when I call Node Expand Volume$`, f.whenICallNodeExpandVolume)
s.Step(`^When I Call GetCapacity$`, f.whenICallGetCapacity)
s.Step(`^I Call GetCapacity$`, f.whenICallGetCapacity)

}

0 comments on commit 4783033

Please sign in to comment.