1
1
import pytest
2
2
3
3
from leapp .libraries .common import config
4
- from leapp .models import FstabEntry , MountEntry , StorageInfo , SystemdMountEntry
4
+ from leapp .models import FstabEntry , MountEntry , StorageInfo
5
5
from leapp .reporting import Report
6
6
from leapp .snactor .fixture import current_actor_context
7
7
from leapp .utils .report import is_inhibitor
8
8
9
9
10
- @pytest .mark .parametrize ('nfs_fstype' , ('nfs' , 'nfs4' ))
11
- def test_actor_with_systemdmount_entry (current_actor_context , nfs_fstype , monkeypatch ):
12
- monkeypatch .setattr (config , 'get_env' , lambda x , y : y )
13
- with_systemdmount_entry = [SystemdMountEntry (node = "nfs" , path = "n/a" , model = "n/a" ,
14
- wwn = "n/a" , fs_type = nfs_fstype , label = "n/a" ,
15
- uuid = "n/a" )]
16
- current_actor_context .feed (StorageInfo (systemdmount = with_systemdmount_entry ))
17
- current_actor_context .run ()
18
- report_fields = current_actor_context .consume (Report )[0 ].report
19
- assert is_inhibitor (report_fields )
20
-
21
-
22
- def test_actor_without_systemdmount_entry (current_actor_context , monkeypatch ):
23
- monkeypatch .setattr (config , 'get_env' , lambda x , y : y )
24
- without_systemdmount_entry = [SystemdMountEntry (node = "/dev/sda1" ,
25
- path = "pci-0000:00:17.0-ata-2" ,
26
- model = "TOSHIBA_THNSNJ512GDNU_A" ,
27
- wwn = "0x500080d9108e8753" ,
28
- fs_type = "ext4" , label = "n/a" ,
29
- uuid = "5675d309-eff7-4eb1-9c27-58bc5880ec72" )]
30
- current_actor_context .feed (StorageInfo (systemdmount = without_systemdmount_entry ))
31
- current_actor_context .run ()
32
- assert not current_actor_context .consume (Report )
33
-
34
-
35
10
@pytest .mark .parametrize ('nfs_fstype' , ('nfs' , 'nfs4' ))
36
11
def test_actor_with_fstab_entry (current_actor_context , nfs_fstype , monkeypatch ):
37
12
monkeypatch .setattr (config , 'get_env' , lambda x , y : y )
@@ -89,15 +64,12 @@ def test_actor_skipped_if_initram_network_enabled(current_actor_context, monkeyp
89
64
monkeypatch .setattr (config , 'get_env' , lambda x , y : 'network-manager' if x == 'LEAPP_DEVEL_INITRAM_NETWORK' else y )
90
65
with_mount_share = [MountEntry (name = "nfs" , mount = "/mnt/data" , tp = 'nfs' ,
91
66
options = "rw,nosuid,nodev,relatime,user_id=1000,group_id=1000" )]
92
- with_systemdmount_entry = [SystemdMountEntry (node = "nfs" , path = "n/a" , model = "n/a" ,
93
- wwn = "n/a" , fs_type = 'nfs' , label = "n/a" ,
94
- uuid = "n/a" )]
95
67
with_fstab_entry = [FstabEntry (fs_spec = "lithium:/mnt/data" , fs_file = "/mnt/data" ,
96
68
fs_vfstype = 'nfs' ,
97
69
fs_mntops = "noauto,noatime,rsize=32768,wsize=32768" ,
98
70
fs_freq = "0" , fs_passno = "0" )]
99
71
current_actor_context .feed (StorageInfo (mount = with_mount_share ,
100
- systemdmount = with_systemdmount_entry ,
72
+ systemdmount = [] ,
101
73
fstab = with_fstab_entry ))
102
74
current_actor_context .run ()
103
75
assert not current_actor_context .consume (Report )
@@ -108,15 +80,12 @@ def test_actor_not_skipped_if_initram_network_empty(current_actor_context, monke
108
80
monkeypatch .setattr (config , 'get_env' , lambda x , y : '' if x == 'LEAPP_DEVEL_INITRAM_NETWORK' else y )
109
81
with_mount_share = [MountEntry (name = "nfs" , mount = "/mnt/data" , tp = 'nfs' ,
110
82
options = "rw,nosuid,nodev,relatime,user_id=1000,group_id=1000" )]
111
- with_systemdmount_entry = [SystemdMountEntry (node = "nfs" , path = "n/a" , model = "n/a" ,
112
- wwn = "n/a" , fs_type = 'nfs' , label = "n/a" ,
113
- uuid = "n/a" )]
114
83
with_fstab_entry = [FstabEntry (fs_spec = "lithium:/mnt/data" , fs_file = "/mnt/data" ,
115
84
fs_vfstype = 'nfs' ,
116
85
fs_mntops = "noauto,noatime,rsize=32768,wsize=32768" ,
117
86
fs_freq = "0" , fs_passno = "0" )]
118
87
current_actor_context .feed (StorageInfo (mount = with_mount_share ,
119
- systemdmount = with_systemdmount_entry ,
88
+ systemdmount = [] ,
120
89
fstab = with_fstab_entry ))
121
90
current_actor_context .run ()
122
91
report_fields = current_actor_context .consume (Report )[0 ].report
0 commit comments