Skip to content

Commit

Permalink
Merge pull request #334 from dell/integrationtests-optional-sdc
Browse files Browse the repository at this point in the history
Integration tests for NFS Volume Provisioning without SDC
  • Loading branch information
harshitap26 authored Oct 11, 2024
2 parents 9f7b207 + 2c66609 commit 860bd25
Show file tree
Hide file tree
Showing 7 changed files with 333 additions and 28 deletions.
23 changes: 15 additions & 8 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ export X_CSI_QUOTA_ENABLED="true"
# Variables for using tests
export CSI_ENDPOINT=`pwd`/unix_sock
export STORAGE_POOL=""
export NFS_STORAGE_POOL=""
export SDC_GUID=$(/bin/emc/scaleio/drv_cfg --query_guid)
# Alternate GUID is for another system for testing expose volume to multiple hosts
export ALT_GUID=

# Interface variables
export NODE_INTERFACES="nodeName:interfaceName"

#Debug variables for goscaleio library
export GOSCALEIO_SHOWHTTP="true"

Expand All @@ -32,11 +36,14 @@ export GOSCALEIO_SHOWHTTP="true"
#leave this variable blank.
export ALT_SYSTEM_ID=""

MDM=`grep mdm ../../config.json | awk -F":" '{print $2}'`
for i in $MDM
do
IP=$i
IP=$(echo "$i" | sed "s/\"//g")
echo $IP
/opt/emc/scaleio/sdc/bin/drv_cfg --add_mdm --ip $IP
done
if /sbin/lsmod | grep -q scini; then
echo "scini module is present, Proceeding to add MDM..."
MDM=`grep mdm ../../config.json | awk -F":" '{print $2}'`
for i in $MDM
do
IP=$i
IP=$(echo "$i" | sed "s/\"//g")
echo "Adding MDM wth IP: $IP"
/opt/emc/scaleio/sdc/bin/drv_cfg --add_mdm --ip $IP
done
fi
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module github.com/dell/csi-vxflexos/v2

go 1.22.0

toolchain go1.22.5

require (
github.com/akutz/memconn v0.1.0
github.com/apparentlymart/go-cidr v1.1.0
Expand Down Expand Up @@ -55,6 +53,7 @@ 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 Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ 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
4 changes: 3 additions & 1 deletion service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,9 @@ func (s *service) ControllerPublishVolume(
var ipAddresses []string

ipAddresses, err = s.findNetworkInterfaceIPs()
Log.Printf("ControllerPublish - No network interfaces found, trying to get SDC IPs")
if err != nil || len(ipAddresses) == 0 {

Log.Printf("ControllerPublish - No network interfaces found, trying to get SDC IPs")
// get SDC IPs if Network Interface IPs not found
ipAddresses, err = s.getSDCIPs(nodeID, systemID)
if err != nil {
Expand Down Expand Up @@ -1624,13 +1624,15 @@ func (s *service) ControllerUnpublishVolume(
ipAddresses, err = s.findNetworkInterfaceIPs()
if err != nil || len(ipAddresses) == 0 {

Log.Printf("ControllerUnPublish - No network interfaces found, trying to get SDC IPs")
ipAddresses, err = s.getSDCIPs(nodeID, systemID)
if err != nil {
return nil, status.Errorf(codes.NotFound, "%s", err.Error())
} else if len(ipAddresses) == 0 {
return nil, status.Errorf(codes.NotFound, "%s", "received empty sdcIPs")
}
}
Log.Printf("ControllerUnPublish - ipAddresses %v", ipAddresses)

// unexport for NFS
err = s.unexportFilesystem(ctx, req, adminClient, fs, req.GetVolumeId(), ipAddresses, nodeID)
Expand Down
64 changes: 62 additions & 2 deletions test/integration/features/integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,25 @@ Feature: VxFlex OS CSI interface
Then there are no errors
Examples:
| voltype | access | fstype | errormsg |
| "mount" | "single-writer" | "nfs" | "none" |
| "mount" | "single-writer" | "nfs" | "none" |

Scenario Outline: Create publish, node-publish, node-unpublish, unpublish, and delete nfs volume without SDC dependency
Given a VxFlexOS service
And a nfs capability with voltype <voltype> access <access> fstype <fstype>
And a nfs volume request "nfsinttestvol" "8"
When I call CreateVolume
And there are no errors
And when I call PublishVolume for nfs
And when I call NodePublishVolume for nfs
And there are no errors
And when I call NodeUnpublishVolume for nfs
And when I call UnpublishVolume for nfs
And there are no errors
And when I call DeleteVolume
Then there are no errors
Examples:
| voltype | access | fstype |
| "mount" | "single-writer" | "nfs" |

Scenario: Expand Nfs Volume
Given a VxFlexOS service
Expand All @@ -588,6 +606,27 @@ Feature: VxFlex OS CSI interface
And when I call DeleteVolume
Then there are no errors

Scenario: Expand Nfs Volume without SDC dependency
Given a VxFlexOS service
And a nfs capability with voltype "mount" access "single-writer" fstype "nfs"
And a nfs volume request "nfsinttestvol2" "16"
When I call CreateVolume
And there are no errors
And when I call PublishVolume for nfs
And there are no errors
And when I call NodePublishVolume for nfs
And there are no errors
And when I call NfsExpandVolume to "20"
And there are no errors
And I call ListVolume
And a valid ListVolumeResponse is returned
And when I call NodeUnpublishVolume for nfs
And there are no errors
And when I call UnpublishVolume for nfs
And there are no errors
And when I call DeleteVolume
Then there are no errors

Scenario: NFS Create volume, create snapshot, delete volume
Given a VxFlexOS service
And a basic nfs volume request "nfsvolume1" "8"
Expand Down Expand Up @@ -695,6 +734,27 @@ Feature: VxFlex OS CSI interface
And when I call DeleteVolume
Then there are no errors

Scenario: Expand Nfs Volume without SDC dependency with tree quota enabled
Given a VxFlexOS service
And a nfs capability with voltype "mount" access "single-writer" fstype "nfs"
And a basic nfs volume request with quota enabled volname "vol-quota" volsize "10" path "/nfs-quotakk" softlimit "80" graceperiod "86400"
When I call CreateVolume
And there are no errors
And when I call PublishVolume for nfs
And there are no errors
And when I call NodePublishVolume for nfs
And there are no errors
And when I call NfsExpandVolume to "15"
And there are no errors
And I call ListVolume
And a valid ListVolumeResponse is returned
And when I call NodeUnpublishVolume for nfs
And there are no errors
And when I call UnpublishVolume for nfs
And there are no errors
And when I call DeleteVolume
Then there are no errors


Scenario: Expand Nfs Volume with tree quota enabled given invalid volume size for exapnd volume
Given a VxFlexOS service
Expand Down Expand Up @@ -920,4 +980,4 @@ Scenario: Custom file system format options (mkfsFormatOption)
| "mount" | "-L MyVolume -m 1" | "single-node-single-writer" | "ext4" | "none" |
| "mount" | "-T largefile4" |"single-node-multi-writer" | "ext4" | "none" |
| "mount" | ":-L MyVolume" | "single-writer" | "xfs" | "error performing private mount" |
| "mount" | "abc" | "single-node-single-writer" | "ext4" | "error performing private mount" |
| "mount" | "abc" | "single-node-single-writer" | "ext4" | "error performing private mount" |
4 changes: 2 additions & 2 deletions test/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ sh validate_http_unauthorized.sh
rc=$?
if [ $rc -ne 0 ]; then echo "failed http unauthorized test"; exit $rc; fi

rm -f unix.sock
source ../../env.sh
rm -f unix_sock
. ../../env.sh
echo $SDC_GUID
GOOS=linux CGO_ENABLED=0 GO111MODULE=on go test -v -coverprofile=c.linux.out -timeout 60m -coverpkg=github.com/dell/csi-vxflexos/service *test.go &
if [ -f ./csi-sanity ] ; then
Expand Down
Loading

0 comments on commit 860bd25

Please sign in to comment.