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

fix UT, update to latest goscaleio #332

Merged
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
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module github.com/dell/csi-vxflexos/v2
// In order to run unit tests on Windows, you need a stubbed Windows implementation
// of the gofsutil package. Use the following replace statements if necessary.

go 1.22
go 1.22.0

toolchain go1.22.5

require (
github.com/akutz/memconn v0.1.0
Expand All @@ -16,7 +18,7 @@ require (
github.com/dell/dell-csi-extensions/volumeGroupSnapshot v1.6.0
github.com/dell/gocsi v1.11.0
github.com/dell/gofsutil v1.16.1
github.com/dell/goscaleio v1.16.1-0.20240912175217-52d904077dc7
github.com/dell/goscaleio v1.16.1-0.20240923113203-f072f0cb0a88
github.com/fsnotify/fsnotify v1.5.1
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.0
Expand Down Expand Up @@ -53,7 +55,6 @@ require (
github.com/hashicorp/go-memdb v1.3.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
Expand All @@ -74,7 +75,7 @@ require (
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
Expand Down
5 changes: 4 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ github.com/dell/gofsutil v1.16.1 h1:BzdxMdIDgKzinlYyi5G3pi27Jw0cmtqRHM5UsIkoE+w=
github.com/dell/gofsutil v1.16.1/go.mod h1:bZ43qAOqKzGJxCRvkTVD7GCFMNkK37ur84mmMuxQshE=
github.com/dell/goscaleio v1.16.1-0.20240912175217-52d904077dc7 h1:X3CuTHtIPo8+3JZOl9z+mmoym5TTP2mYAIWKtSX/hoc=
github.com/dell/goscaleio v1.16.1-0.20240912175217-52d904077dc7/go.mod h1:h7SCmReARG/szFWBMQGETGkZObknhS45lQipQbtdmJ8=
github.com/dell/goscaleio v1.16.1-0.20240923113203-f072f0cb0a88 h1:+JewlsDL4XH/lupX7r4Z8M3D19MF9K2U8y33SCs3LGY=
github.com/dell/goscaleio v1.16.1-0.20240923113203-f072f0cb0a88/go.mod h1:b2mbdhG3IHp8YfvDrj7jWHdJNkqyrUhWNDEvo4GVEUc=
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 Expand Up @@ -274,7 +276,6 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
Expand Down Expand Up @@ -607,6 +608,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down
7 changes: 6 additions & 1 deletion service/features/service.feature
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,12 @@ Feature: VxFlex OS CSI interface
Scenario: Call NodeGetInfo and validate Node UID
Given a VxFlexOS service
When I call NodeGetInfo with a valid Node UID
Then a valid NodeGetInfoResponse with node UID is returned
Then a valid NodeGetInfoResponse with node UID is returned

Scenario: Call GetNodeUID
Given a VxFlexOS service
When I call GetNodeUID
Then a valid node uid is returned

Scenario: Call ParseInt64FromContext to validate EnvMaxVolumesPerNode
Given a VxFlexOS service
Expand Down
27 changes: 25 additions & 2 deletions service/step_defs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ type feature struct {
nodeLabels map[string]string
maxVolSize int64
nfsExport types.NFSExport
//nodeUID string
//nas types.NAS
nodeUID string
}

func (f *feature) checkGoRoutines(tag string) {
Expand Down Expand Up @@ -1915,6 +1914,28 @@ func (f *feature) iCallNodeGetInfoWithValidNodeUID() error {
return nil
}

func (f *feature) iCallGetNodeUID() error {
f.setFakeNode()
ctx := new(context.Context)
nodeUID := ""
nodeUID, err := f.service.GetNodeUID(*ctx)

fmt.Printf("Node UID: %v", nodeUID)
if err != nil {
return err
}
f.nodeUID = nodeUID
return nil
}

func (f *feature) aValidNodeUIDIsReturned() error {
if f.nodeUID == "" {
return errors.New("Unable to fetch the node UID")
}
fmt.Printf("Node UID: %v", f.nodeUID)
return nil
}

//nolint:revive
func mockGetNodeLabels(ctx context.Context, s *service) (map[string]string, error) {
labels := map[string]string{"csi-vxflexos.dellemc.com/05d539c3cdc5280f-nfs": "true", "csi-vxflexos.dellemc.com/0e7a082862fedf0f": "csi-vxflexos.dellemc.com"}
Expand Down Expand Up @@ -4858,6 +4879,8 @@ func FeatureContext(s *godog.ScenarioContext) {
s.Step(`^I specify External Access "([^"]*)"`, f.iSpecifyExternalAccess)
s.Step(`^I call Get NAS server from name "([^"]*)" "([^"]*)"$`, f.iCallGetNASServerIDFromName)
s.Step(`^I call ping NAS server "([^"]*)" "([^"]*)"$`, f.iCallPingNASServer)
s.Step(`^I call GetNodeUID$`, f.iCallGetNodeUID)
s.Step(`^a valid node uid is returned$`, f.aValidNodeUIDIsReturned)

s.After(func(ctx context.Context, _ *godog.Scenario, _ error) (context.Context, error) {
if f.server != nil {
Expand Down
8 changes: 7 additions & 1 deletion service/step_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,13 @@ func handleNasInstances(w http.ResponseWriter, _ *http.Request) {

// handleSystemInstances implements POST /rest/v1/nas-servers/{id}/ping
func handleNasServerPing(w http.ResponseWriter, _ *http.Request) {
if stepHandlersErrors.NasServerNotFoundError {

if inducedError.Error() == "FileInterfaceNotFoundError" {
writeError(w, "file interface not found", http.StatusNotFound, codes.NotFound)
return
}

if inducedError.Error() == "NasNotFoundError" {
writeError(w, "nas server not found", http.StatusNotFound, codes.NotFound)
return
}
Expand Down
Loading