osd: support loop devices for test clusters

A new variable is added to rook-ceph-operator-config
ConfigMap to allow using loop devices for osd.

This feature is intended to be used for testing purposes only.

Signed-off-by: Shinya Hayashi <shinya-hayashi@cybozu.co.jp>
(cherry picked from commit 05875a3f4f)
This commit is contained in:
Shinya Hayashi authored and Mergify committed 2022-11-10 18:31:43 +00:00
1 parent 8787dab0a1
commit 13b63c4a08
19 files changed
+294 -6

No files matched your search

@@ -92,6 +92,20 @@ func TestSetCephCommandsTimeout(t *testing.T) {
assert.Equal(t, 1*time.Second, exec.CephCommandsTimeout)
}
func TestSetAllowLoopDevices(t *testing.T) {
SetAllowLoopDevices(map[string]string{})
assert.False(t, LoopDevicesAllowed())
SetAllowLoopDevices(map[string]string{"ROOK_CEPH_ALLOW_LOOP_DEVICES": "foo"})
assert.False(t, LoopDevicesAllowed())
SetAllowLoopDevices(map[string]string{"ROOK_CEPH_ALLOW_LOOP_DEVICES": "false"})
assert.False(t, LoopDevicesAllowed())
SetAllowLoopDevices(map[string]string{"ROOK_CEPH_ALLOW_LOOP_DEVICES": "true"})
assert.True(t, LoopDevicesAllowed())
}
func TestIsReadyToReconcile(t *testing.T) {
scheme := scheme.Scheme
scheme.AddKnownTypes(cephv1.SchemeGroupVersion, &cephv1.CephCluster{}, &cephv1.CephClusterList{})