|
52 | 52 | context 'when there is lvm support' do |
53 | 53 | context 'when there are no vgs' do |
54 | 54 | it 'should be set to 0' do |
55 | | - Facter::Util::Resolution.stubs('exec') # All other calls |
56 | | - Facter::Util::Resolution.expects('exec').at_least(1).with('vgs -o name --noheadings 2>/dev/null').returns(nil) |
| 55 | + Facter::Core::Execution.stubs(:execute) # All other calls |
| 56 | + Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o name --noheadings 2>/dev/null', timeout: 30).returns(nil) |
57 | 57 | Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true) |
58 | 58 | Facter.value(:lvm_vgs).should == 0 |
59 | 59 | end |
60 | 60 | end |
61 | 61 |
|
62 | 62 | context 'when there are vgs' do |
63 | 63 | it 'should list vgs' do |
64 | | - Facter::Util::Resolution.stubs('exec') # All other calls |
65 | | - Facter::Util::Resolution.expects('exec').at_least(1).with('vgs -o name --noheadings 2>/dev/null').returns("vg0\nvg1") |
66 | | - Facter::Util::Resolution.expects('exec').at_least(1).with('vgs -o pv_name vg0 2>/dev/null').returns(" PV\n /dev/pv3\n /dev/pv2") |
67 | | - Facter::Util::Resolution.expects('exec').at_least(1).with('vgs -o pv_name vg1 2>/dev/null').returns(" PV\n /dev/pv0") |
| 64 | + Facter::Core::Execution.stubs(:execute) # All other calls |
| 65 | + Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o name --noheadings 2>/dev/null', timeout: 30).returns("vg0\nvg1") |
| 66 | + 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") |
| 67 | + Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o pv_name vg1 2>/dev/null', timeout: 30).returns(" PV\n /dev/pv0") |
68 | 68 | Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true) |
69 | 69 | Facter.value(:lvm_vgs).should == 2 |
70 | 70 | Facter.value(:lvm_vg_0).should == 'vg0' |
|
92 | 92 | context 'when there is lvm support' do |
93 | 93 | context 'when there are no pvs' do |
94 | 94 | it 'should be set to 0' do |
95 | | - Facter::Util::Resolution.stubs('exec') # All other calls |
96 | | - Facter::Util::Resolution.expects('exec').at_least(1).with('pvs -o name --noheadings 2>/dev/null').returns(nil) |
| 95 | + Facter::Core::Execution.stubs('execute') # All other calls |
| 96 | + Facter::Core::Execution.expects('execute').at_least(1).with('pvs -o name --noheadings 2>/dev/null', timeout: 30).returns(nil) |
97 | 97 | Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true) |
98 | 98 | Facter.value(:lvm_pvs).should == 0 |
99 | 99 | end |
100 | 100 | end |
101 | 101 |
|
102 | 102 | context 'when there are pvs' do |
103 | 103 | it 'should list pvs' do |
104 | | - Facter::Util::Resolution.stubs('exec') # All other calls |
105 | | - Facter::Util::Resolution.expects('exec').at_least(1).with('pvs -o name --noheadings 2>/dev/null').returns("pv0\npv1") |
| 104 | + Facter::Core::Execution.stubs('execute') # All other calls |
| 105 | + Facter::Core::Execution.expects('execute').at_least(1).with('pvs -o name --noheadings 2>/dev/null', timeout: 30).returns("pv0\npv1") |
106 | 106 | Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true) |
107 | 107 | Facter.value(:lvm_pvs).should == 2 |
108 | 108 | Facter.value(:lvm_pv_0).should == 'pv0' |
|
0 commit comments