blob: 0336e2cdc26dc47dbffb1f91e2f9b51fcaa18ce9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import os
from ceph_volume import AllowLoopDevices, allow_loop_devices
from typing import Any
class TestAllowLoopDevsWarning:
def setup_method(self) -> None:
AllowLoopDevices.allow = False
AllowLoopDevices.warned = False
self.teardown_method()
def teardown_method(self) -> None:
AllowLoopDevices.allow = False
AllowLoopDevices.warned = False
if os.environ.get('CEPH_VOLUME_ALLOW_LOOP_DEVICES'):
os.environ.pop('CEPH_VOLUME_ALLOW_LOOP_DEVICES')
def test_loop_dev_warning(self, fake_call: Any, caplog: Any) -> None:
AllowLoopDevices.warned = False
assert allow_loop_devices() is False
assert not caplog.records
os.environ['CEPH_VOLUME_ALLOW_LOOP_DEVICES'] = "y"
assert allow_loop_devices() is True
log = caplog.records[0]
assert log.levelname == "WARNING"
assert "will never be supported in production" in log.message
|