Skip to content

Commit

Permalink
parametrize test with fs type
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmyagkov committed Sep 19, 2024
1 parent 07495f2 commit d123b13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 6 additions & 3 deletions cloud/blockstore/tests/csi_driver/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def create_volume(self, name: str, size: int):
def delete_volume(self, name: str):
return self._controller_run("deletevolume", "--id", name)

def publish_volume(self, pod_id: str, volume_id: str, pod_name: str):
def publish_volume(self, pod_id: str, volume_id: str, pod_name: str, fs_type: str = ""):
return self._node_run(
"publishvolume",
"--pod-id",
Expand All @@ -188,6 +188,8 @@ def publish_volume(self, pod_id: str, volume_id: str, pod_name: str):
volume_id,
"--pod-name",
pod_name,
"--fs-type",
fs_type,
)

def unpublish_volume(self, pod_id: str, volume_id: str):
Expand Down Expand Up @@ -387,15 +389,16 @@ def test_csi_sanity_nbs_backend(mount_path, volume_access_type):
cleanup_after_test(env)


def test_node_volume_expand():
@pytest.mark.parametrize('fs_type', ["ext4", "xfs"])
def test_node_volume_expand(fs_type):
env, run = init()
try:
volume_name = "example-disk"
volume_size = 1024 ** 3
pod_name = "example-pod"
pod_id = "deadbeef"
env.csi.create_volume(name=volume_name, size=volume_size)
env.csi.publish_volume(pod_id, volume_name, pod_name)
env.csi.publish_volume(pod_id, volume_name, pod_name, fs_type)

new_volume_size = 2 * volume_size
env.csi.expand_volume(pod_id, volume_name, new_volume_size)
Expand Down
10 changes: 9 additions & 1 deletion cloud/blockstore/tools/csi_driver/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func newDeleteVolumeCommand(endpoint *string) *cobra.Command {
}

func newPublishVolumeCommand(endpoint *string) *cobra.Command {
var volumeId, podId, stagingTargetPath, podName string
var volumeId, podId, stagingTargetPath, podName, fsType string
var readOnly bool
cmd := cobra.Command{
Use: "publishvolume",
Expand All @@ -216,6 +216,7 @@ func newPublishVolumeCommand(endpoint *string) *cobra.Command {
"csi.storage.k8s.io/pod.namespace": "default",
"csi.storage.k8s.io/pod.name": podName,
"storage.kubernetes.io/csiProvisionerIdentity": "someIdentity",
"fsType": fsType,
}
writerCap := csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER

Expand Down Expand Up @@ -272,6 +273,13 @@ func newPublishVolumeCommand(endpoint *string) *cobra.Command {
false,
"volume is read only",
)
cmd.Flags().StringVar(
&fsType,
"fs-type",
"",
"filesystem type: ext4, xfs",
)

err := cmd.MarkFlagRequired("volume-id")
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit d123b13

Please sign in to comment.