e2e: add validation for subvolumePath

as we are adding the subvolumepath to the
PV spec. this commits adds an E2E testing
to verify it.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2021-02-09 16:02:40 +05:30
committed by mergify[bot]
parent 8cd901d2dd
commit 1aaccd0e5a
2 changed files with 52 additions and 1 deletions

View File

@ -138,3 +138,16 @@ func listCephFSSubVolumes(f *framework.Framework, filesystem, groupname string)
}
return subVols, nil
}
// getSubvolumepath validates whether subvolumegroup is present.
func getSubvolumePath(f *framework.Framework, filesystem, subvolgrp, subvolume string) (string, error) {
cmd := fmt.Sprintf("ceph fs subvolume getpath %s %s --group_name=%s", filesystem, subvolume, subvolgrp)
stdOut, stdErr, err := execCommandInToolBoxPod(f, cmd, rookNamespace)
if err != nil {
return "", err
}
if stdErr != "" {
return "", fmt.Errorf("failed to getpath for subvolume %s with error %s", subvolume, stdErr)
}
return strings.TrimSpace(stdOut), nil
}