e2e: add -clusterid=... for selecting a Ceph cluster

The Ceph cluster-id is usually detected with `ceph fsid`. This is not
always correct, as the the Ceph cluster can also be configured by name.
If the -clusterid=... is passed, it will be used instead of trying to
detect it with `ceph fsid`.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2022-04-08 13:14:15 +02:00 committed by mergify[bot]
parent e30364cb4d
commit b82af7559b
3 changed files with 23 additions and 16 deletions

View File

@ -88,7 +88,7 @@ In addition to standard go tests parameters, the following custom parameters
are available while running tests:
| flag | description |
| ----------------- | ----------------------------------------------------------------------------- |
| ----------------- | ------------------------------------------------------------------------------------------------- |
| deploy-timeout | Timeout to wait for created kubernetes resources (default: 10 minutes) |
| deploy-cephfs | Deploy cephFS CSI driver as part of E2E (default: true) |
| deploy-rbd | Deploy rbd CSI driver as part of E2E (default: true) |
@ -103,6 +103,7 @@ are available while running tests:
| v | Verbose: print additional output |
| is-openshift | Run in OpenShift compatibility mode, skips certain new feature tests |
| filesystem | Name of the CephFS filesystem (default: "myfs") |
| clusterid | Use the Ceph cluster id in the StorageClasses and SnapshotClasses (default: `ceph fsid` detected) |
## E2E for snapshot

View File

@ -45,6 +45,7 @@ func init() {
flag.StringVar(&rookNamespace, "rook-namespace", "rook-ceph", "namespace in which rook is deployed")
flag.BoolVar(&isOpenShift, "is-openshift", false, "disables certain checks on OpenShift")
flag.StringVar(&fileSystemName, "filesystem", "myfs", "CephFS filesystem to use")
flag.StringVar(&clusterID, "clusterid", "", "Ceph cluster ID to use (defaults to `ceph fsid` detection)")
setDefaultKubeconfig()
// Register framework flags, then handle flags

View File

@ -79,6 +79,7 @@ var (
radosNamespace string
poll = 2 * time.Second
isOpenShift bool
clusterID string
)
func getMons(ns string, c kubernetes.Interface) ([]string, error) {
@ -122,6 +123,10 @@ func getMonsHash(mons string) string {
}
func getClusterID(f *framework.Framework) (string, error) {
if clusterID != "" {
return clusterID, nil
}
fsID, stdErr, err := execCommandInToolBoxPod(f, "ceph fsid", rookNamespace)
if err != nil {
return "", fmt.Errorf("failed getting clusterID through toolbox: %w", err)