From 2dfa56b76c2cada7d9a30255856d745ac40710e2 Mon Sep 17 00:00:00 2001 From: Randeep Sharma <92301596+randeepsharma@users.noreply.github.com> Date: Mon, 10 Jan 2022 15:39:08 +0530 Subject: [PATCH] Remove reverseDNS lookup mandate for nodeID (#41) * Remove-reverseDNS-lookup-for-nodeID & update UT and integration test --- service/features/service.feature | 5 +++++ service/node.go | 3 ++- service/step_defs_test.go | 13 +++++++++++++ test/integration/features/main_integration.feature | 14 ++++++++++++++ test/integration/integration_test.go | 5 ++++- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/service/features/service.feature b/service/features/service.feature index 98b1a40a..7d8d6962 100644 --- a/service/features/service.feature +++ b/service/features/service.feature @@ -132,6 +132,11 @@ Feature: Isilon CSI interface Then a valid NodeGetInfoResponse is returned with volume limit "2" And I call remove node labels + Scenario: Call NodeGetInfo When reverse DNS is absent + Given a Isilon service + When I call iCallNodeGetInfoWithNoFQDN + Then a valid NodeGetInfoResponse is returned + Scenario: Call NodeGetCapabilities with health monitor feature enabled Given a Isilon service When I call NodeGetCapabilities "true" diff --git a/service/node.go b/service/node.go index f317b708..400e52d8 100644 --- a/service/node.go +++ b/service/node.go @@ -725,7 +725,8 @@ func (s *service) getPowerScaleNodeID(ctx context.Context) (string, error) { nodeFQDN, err := utils.GetFQDNByIP(ctx, nodeIP) if (err) != nil { - return "", err + nodeFQDN = nodeIP + log.Warnf("Setting nodeFQDN to %s as failed to resolve IP to FQDN due to %v", nodeIP, err) } nodeID, err := s.GetCSINodeID(ctx) diff --git a/service/step_defs_test.go b/service/step_defs_test.go index 6134b34b..e65a1acb 100644 --- a/service/step_defs_test.go +++ b/service/step_defs_test.go @@ -337,6 +337,8 @@ func FeatureContext(s *godog.Suite) { s.Step(`^I call ControllerGetVolume with name "([^"]*)"$`, f.iCallControllerGetVolume) s.Step(`^a valid ControllerGetVolumeResponse is returned$`, f.aValidControllerGetVolumeResponseIsReturned) s.Step(`^I call NodeGetVolumeStats with name "([^"]*)" and path "([^"]*)"$`, f.iCallNodeGetVolumeStats) + s.Step(`^I call iCallNodeGetInfoWithNoFQDN`, f.iCallNodeGetInfoWithNoFQDN) + s.Step(`^a valid NodeGetInfoResponse is returned$`, f.aValidNodeGetInfoResponseIsReturned) } // GetPluginInfo @@ -2323,3 +2325,14 @@ func (f *feature) iSetRootClientEnabledTo(val string) error { f.rootClientEnabled = val return nil } + +func (f *feature) iCallNodeGetInfoWithNoFQDN() error { + req := new(csi.NodeGetInfoRequest) + f.service.nodeIP = "192.0.2.0" + f.nodeGetInfoResponse, f.err = f.service.NodeGetInfo(context.Background(), req) + if f.err != nil { + log.Printf("NodeGetInfo call failed: %s\n", f.err.Error()) + return f.err + } + return nil +} diff --git a/test/integration/features/main_integration.feature b/test/integration/features/main_integration.feature index db8612aa..459da4f1 100644 --- a/test/integration/features/main_integration.feature +++ b/test/integration/features/main_integration.feature @@ -557,6 +557,20 @@ Feature: Isilon CSI interface | 2 | | 4 | + @v1.0 + Scenario: Create, ControllerPublish, ControllerUnpublish, delete basic volume , run with nodeID which has IP isntead of FQDN + Given a Isilon service + And a basic volume request "integration0" "8" + When I call CreateVolume + When I call ControllerPublishVolume "X_CSI_NODE_NAME_NO_FQDN" + Then there are no errors + When I call ControllerUnpublishVolume "X_CSI_NODE_NAME_NO_FQDN" + Then there are no errors + When I call DeleteVolume + Then there is not a directory "integration0" + Then there is not an export "integration0" + + @v1.0 Scenario: Cleanup all the files created Given a Isilon service diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index 0f84dd91..63091bf0 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -55,10 +55,13 @@ func TestMain(m *testing.M) { if hostFQDN == "unknown" { fmt.Printf("cannot get FQDN") } + nodeIP := os.Getenv("X_CSI_NODE_IP") if os.Getenv("X_CSI_CUSTOM_TOPOLOGY_ENABLED") == "true" { - nodeName := host + nodeIDSeparator + hostFQDN + nodeIDSeparator + os.Getenv("X_CSI_NODE_IP") + nodeName := host + nodeIDSeparator + hostFQDN + nodeIDSeparator + nodeIP os.Setenv("X_CSI_NODE_NAME", nodeName) } + nodeNameWithoutFQDN := host + nodeIDSeparator + nodeIP + nodeIDSeparator + nodeIP + os.Setenv("X_CSI_NODE_NAME_NO_FQDN", nodeNameWithoutFQDN) // Make the file needed for NodeStage: // /tmp/datadir -- for file system mounts