mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
e2e: introduce getClusterID() helper
There are many locations where the cluster-id (`ceph fsid`) is obtained from the Rook Toolbox. Instead of duplicating the code everywhere, use a new helper function getClusterID(). Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
b20e3fa784
commit
e30364cb4d
12
e2e/utils.go
12
e2e/utils.go
@ -121,6 +121,18 @@ func getMonsHash(mons string) string {
|
||||
return fmt.Sprintf("%x", md5.Sum([]byte(mons))) //nolint:gosec // hash generation
|
||||
}
|
||||
|
||||
func getClusterID(f *framework.Framework) (string, error) {
|
||||
fsID, stdErr, err := execCommandInToolBoxPod(f, "ceph fsid", rookNamespace)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed getting clusterID through toolbox: %w", err)
|
||||
}
|
||||
if stdErr != "" {
|
||||
return "", fmt.Errorf("error getting fsid: %s", stdErr)
|
||||
}
|
||||
// remove new line present in fsID
|
||||
return strings.Trim(fsID, "\n"), nil
|
||||
}
|
||||
|
||||
func getStorageClass(path string) (scv1.StorageClass, error) {
|
||||
sc := scv1.StorageClass{}
|
||||
err := unmarshal(path, &sc)
|
||||
|
Reference in New Issue
Block a user