diff --git a/service/features/service.feature b/service/features/service.feature index 35438de4..c83acb83 100644 --- a/service/features/service.feature +++ b/service/features/service.feature @@ -1564,8 +1564,20 @@ Feature: VxFlex OS CSI interface | "volume1" | "multi_az" | "none" | | "volume1" | "invalid_multi_az" | "no zone topology found in accessibility requirements" | + Scenario: Call NodeGetInfo without zone label + Given a VxFlexOS service + And I use config "config" + When I call NodeGetInfo + Then a NodeGetInfo is returned without zone topology + Scenario: Call NodeGetInfo with zone label Given a VxFlexOS service And I use config "multi_az" When I call NodeGetInfo with zone labels - Then a valid NodeGetInfo is returned with node topology + Then a valid NodeGetInfo is returned with node topology + + Scenario: Call NodeGetInfo with zone label with invalid config + Given a VxFlexOS service + And I use config "invalid_multi_az" + When I call NodeGetInfo with zone labels + Then a NodeGetInfo is returned without zone system topology diff --git a/service/step_defs_test.go b/service/step_defs_test.go index fd48055a..c485c60c 100644 --- a/service/step_defs_test.go +++ b/service/step_defs_test.go @@ -1881,6 +1881,7 @@ func (f *feature) iCallNodeGetInfo() error { req := new(csi.NodeGetInfoRequest) f.service.opts.SdcGUID = "9E56672F-2F4B-4A42-BFF4-88B6846FBFDA" GetNodeLabels = mockGetNodeLabels + GetNodeUID = mockGetNodeUID f.nodeGetInfoResponse, f.err = f.service.NodeGetInfo(*ctx, req) return nil } @@ -4724,7 +4725,7 @@ func (f *feature) iCallCreateVolumeWithZones(name string) error { } func mockGetNodeLabelsWithZone(_ context.Context, _ *service) (map[string]string, error) { - labels := map[string]string{"zone.csi-vxflexos.dellemc.com": "zoneA"} + labels := map[string]string{"zone." + Name: "zoneA"} return labels, nil } @@ -4747,6 +4748,27 @@ func (f *feature) aValidNodeGetInfoIsReturnedWithNodeTopology() error { return nil } +func (f *feature) aNodeGetInfoIsReturnedWithoutZoneTopology() error { + accessibility := f.nodeGetInfoResponse.GetAccessibleTopology() + Log.Printf("Node Accessibility %+v", accessibility) + if _, ok := accessibility.Segments["zone."+Name]; ok { + return fmt.Errorf("zone found") + } + return nil +} + +func (f *feature) aNodeGetInfoIsReturnedWithoutZoneSystemTopology() error { + accessibility := f.nodeGetInfoResponse.GetAccessibleTopology() + Log.Printf("Node Accessibility %+v", accessibility) + + for _, array := range f.service.opts.arrays { + if _, ok := accessibility.Segments[Name+"/"+array.SystemID]; ok { + return fmt.Errorf("zone found") + } + } + return nil +} + func FeatureContext(s *godog.ScenarioContext) { f := &feature{} s.Step(`^a VxFlexOS service$`, f.aVxFlexOSService) @@ -4974,6 +4996,8 @@ func FeatureContext(s *godog.ScenarioContext) { s.Step(`^I call CreateVolume "([^"]*)" with zones$`, f.iCallCreateVolumeWithZones) s.Step(`^I call NodeGetInfo with zone labels$`, f.iCallNodeGetInfoWithZoneLabels) s.Step(`^a valid NodeGetInfo is returned with node topology$`, f.aValidNodeGetInfoIsReturnedWithNodeTopology) + s.Step(`^a NodeGetInfo is returned without zone topology$`, f.aNodeGetInfoIsReturnedWithoutZoneTopology) + s.Step(`^a NodeGetInfo is returned without zone system topology$`, f.aNodeGetInfoIsReturnedWithoutZoneSystemTopology) s.After(func(ctx context.Context, _ *godog.Scenario, _ error) (context.Context, error) { if f.server != nil {