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

Add e2e for mkfs formatting option #318

Merged
merged 1 commit into from
Jul 12, 2024
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
36 changes: 31 additions & 5 deletions test/integration/features/integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: VxFlex OS CSI interface
When I call CreateVolume
And there are no errors
And when I call PublishVolume "SDC_GUID"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "/tmp/podmondev1"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "/tmp/podmondev1" ""
And there are no errors
And I read write data to volume "/tmp/podmondev1"
And when I call Validate Volume Host connectivity
Expand Down Expand Up @@ -332,8 +332,8 @@ Feature: VxFlex OS CSI interface
And when I call UnpublishVolume "SDC_GUID"
And a capability with voltype "mount" access "multi-reader" fstype "xfs"
And when I call PublishVolume "SDC_GUID"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "temp1"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "temp2"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "temp1" ""
And when I call NodePublishVolumeWithPoint "SDC_GUID" "temp2" ""
And when I call NodeUnpublishVolumeWithPoint "SDC_GUID" "temp1"
And when I call NodeUnpublishVolumeWithPoint "SDC_GUID" "temp2"
And when I call UnpublishVolume "SDC_GUID"
Expand All @@ -348,9 +348,9 @@ Feature: VxFlex OS CSI interface
And there are no errors
And when I call PublishVolume "SDC_GUID"
And when I call PublishVolume "ALT_GUID"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "/tmp/tempdev1"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "/tmp/tempdev1" ""
And there are no errors
And when I call NodePublishVolumeWithPoint "SDC_GUID" "/tmp/tempdev2"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "/tmp/tempdev2" ""
And there are no errors
And when I call NodePublishVolume "ALT_GUID"
And there are no errors
Expand Down Expand Up @@ -895,3 +895,29 @@ Scenario: Call NodeGetVolumeStats on unmounted volume
And there are no errors
And when I call DeleteVolume
Then there are no errors

Scenario: Custom file system format options (mkfsFormatOption)
Given a VxFlexOS service
And a capability with voltype <voltype> access <access> fstype <fstype>
And a volume request "mkfs1" "8"
When I call CreateVolume
And there are no errors
And when I call PublishVolume "SDC_GUID"
And when I call NodePublishVolumeWithPoint "SDC_GUID" "/tmp/mkfsdev1" <mkfsFormatOption>
And the error message should contain <errormsg>
And I read write data to volume "/tmp/mkfsdev1"
And when I call Validate Volume Host connectivity
Then there are no errors
And when I call NodeUnpublishVolumeWithPoint "SDC_GUID" "/tmp/mkfsdev1"
And when I call NodeUnpublishVolume "SDC_GUID"
And when I call UnpublishVolume "SDC_GUID"
And there are no errors
And when I call DeleteVolume
Then there are no errors
Examples:
| voltype | mkfsFormatOption | access | fstype | errormsg |
| "mount" | "-L MyVolume" | "single-writer" | "xfs" | "none" |
| "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" |
15 changes: 9 additions & 6 deletions test/integration/step_defs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ func (f *feature) getNodePublishVolumeRequest() *csi.NodePublishVolumeRequest {
}

//nolint:revive
func (f *feature) whenICallNodePublishVolumeWithPoint(arg1 string, arg2 string) error {
func (f *feature) whenICallNodePublishVolumeWithPoint(arg1 string, arg2 string, mkfsFormatOption string) error {
block := f.capability.GetBlock()
if block == nil {
_, err := os.Stat(arg2)
Expand All @@ -766,7 +766,7 @@ func (f *feature) whenICallNodePublishVolumeWithPoint(arg1 string, arg2 string)

}
}
err := f.nodePublishVolume(f.volID, arg2)
err := f.nodePublishVolume(f.volID, arg2, mkfsFormatOption)
if err != nil {
fmt.Printf("NodePublishVolume failed: %s\n", err.Error())
f.addError(err)
Expand All @@ -779,7 +779,7 @@ func (f *feature) whenICallNodePublishVolumeWithPoint(arg1 string, arg2 string)

//nolint:revive
func (f *feature) whenICallNodePublishVolume(arg1 string) error {
err := f.nodePublishVolume(f.volID, "")
err := f.nodePublishVolume(f.volID, "", "")
if err != nil {
fmt.Printf("NodePublishVolume failed: %s\n", err.Error())
f.addError(err)
Expand All @@ -805,7 +805,7 @@ func (f *feature) iCallEthemeralNodePublishVolume(id, size string) error {
return nil
}

func (f *feature) nodePublishVolume(id string, path string) error {
func (f *feature) nodePublishVolume(id string, path string, mkfsFormatOption string) error {
req := f.getNodePublishVolumeRequest()
if path != "" {
block := f.capability.GetBlock()
Expand All @@ -818,6 +818,9 @@ func (f *feature) nodePublishVolume(id string, path string) error {
}
}
req.VolumeId = id
if len(mkfsFormatOption) > 0 {
req.VolumeContext = map[string]string{"mkfsFormatOption": mkfsFormatOption}
}
ctx := context.Background()
client := csi.NewNodeClient(grpcClient)
_, err := client.NodePublishVolume(ctx, req)
Expand Down Expand Up @@ -1327,7 +1330,7 @@ func (f *feature) iNodePublishVolumesInParallel(nVols int) error {
}
dataDirName := fmt.Sprintf("/tmp/datadir%d", i)
go func(id string, dataDirName string, done chan bool, errchan chan error) {
err := f.nodePublishVolume(id, dataDirName)
err := f.nodePublishVolume(id, dataDirName, "")
done <- true
errchan <- err
}(id, dataDirName, done, errchan)
Expand Down Expand Up @@ -2517,7 +2520,7 @@ func FeatureContext(s *godog.ScenarioContext) {
s.Step(`^a capability with voltype "([^"]*)" access "([^"]*)" fstype "([^"]*)"$`, f.aCapabilityWithVoltypeAccessFstype)
s.Step(`^a volume request "([^"]*)" "(\d+)"$`, f.aVolumeRequest)
s.Step(`^when I call NodePublishVolume "([^"]*)"$`, f.whenICallNodePublishVolume)
s.Step(`^when I call NodePublishVolumeWithPoint "([^"]*)" "([^"]*)"$`, f.whenICallNodePublishVolumeWithPoint)
s.Step(`^when I call NodePublishVolumeWithPoint "([^"]*)" "([^"]*)" "([^"]*)"$`, f.whenICallNodePublishVolumeWithPoint)
s.Step(`^when I call NodeUnpublishVolume "([^"]*)"$`, f.whenICallNodeUnpublishVolume)
s.Step(`^when I call NodeUnpublishVolumeWithPoint "([^"]*)" "([^"]*)"$`, f.whenICallNodeUnpublishVolumeWithPoint)
s.Step(`^verify published volume with voltype "([^"]*)" access "([^"]*)" fstype "([^"]*)"$`, f.verifyPublishedVolumeWithVoltypeAccessFstype)
Expand Down
Loading