|
54 | 54 | context 'when there is lvm support' do |
55 | 55 | context 'when there are no vgs' do |
56 | 56 | it 'is set to 0' do |
57 | | - allow(Facter::Core::Execution).to receive(:execute) # All other calls |
| 57 | + Facter::Core::Execution.stubs(:execute) # All other calls |
58 | 58 | Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o name --noheadings 2>/dev/null', timeout: 30).returns(nil) |
59 | 59 | Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true) |
60 | 60 | Facter.value(:lvm_vgs).should == 0 |
|
64 | 64 | context 'when there are vgs' do |
65 | 65 | it 'lists vgs' do |
66 | 66 | Facter::Core::Execution.stubs(:execute) # All other calls |
67 | | - Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o name --noheadings 2>/dev/null', timeout: 30).returns("vg0\nvg1") |
| 67 | + Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o name --noheadings 2>/dev/null', timeout: 30).returns(" vg0\n vg1") |
68 | 68 | Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o pv_name vg0 2>/dev/null', timeout: 30).returns(" PV\n /dev/pv3\n /dev/pv2") |
69 | 69 | Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o pv_name vg1 2>/dev/null', timeout: 30).returns(" PV\n /dev/pv0") |
70 | 70 | Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true) |
|
86 | 86 |
|
87 | 87 | context 'when there is no lvm support' do |
88 | 88 | it 'does not exist' do |
89 | | - Facter.fact(:lvm_support).expects(:value).at_least(1).returns(nil) |
90 | 89 | Facter.value(:lvm_pvs).should be_nil |
91 | 90 | end |
92 | 91 | end |
|
104 | 103 | context 'when there are pvs' do |
105 | 104 | it 'lists pvs' do |
106 | 105 | Facter::Core::Execution.stubs('execute') # All other calls |
107 | | - Facter::Core::Execution.expects('execute').at_least(1).with('pvs -o name --noheadings 2>/dev/null', timeout: 30).returns("pv0\npv1") |
| 106 | + Facter::Core::Execution.expects('execute').at_least(1).with('pvs -o name --noheadings 2>/dev/null', timeout: 30).returns(" pv0\n pv1") |
108 | 107 | Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true) |
109 | 108 | Facter.value(:lvm_pvs).should == 2 |
110 | 109 | Facter.value(:lvm_pv_0).should == 'pv0' |
|
0 commit comments