-
Notifications
You must be signed in to change notification settings - Fork 271
/
lvm_spec.rb
55 lines (51 loc) · 2.43 KB
/
lvm_spec.rb
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require 'spec_helper'
provider_class = Puppet::Type.type(:filesystem).provider(:lvm)
describe provider_class do
before do
@resource = stub("resource")
@provider = provider_class.new(@resource)
end
describe 'when creating' do
it "should execute the correct filesystem command" do
@resource.expects(:[]).with(:name).returns('/dev/myvg/mylv')
@resource.expects(:[]).with(:fs_type).returns('ext4')
@resource.expects(:[]).with(:options)
@provider.expects(:execute).with(['mkfs.ext4', '/dev/myvg/mylv'])
@resource.expects(:[]).with(:mkfs_cmd)
@provider.create
end
it "should include the supplied filesystem options" do
@resource.expects(:[]).with(:name).returns('/dev/myvg/mylv')
@resource.expects(:[]).with(:fs_type).returns('ext4')
@resource.expects(:[]).with(:options).returns('-b 4096 -E stride=32,stripe-width=64').twice
@provider.expects(:execute).with(['mkfs.ext4', '/dev/myvg/mylv', ['-b', '4096', '-E', 'stride=32,stripe-width=64']])
@resource.expects(:[]).with(:mkfs_cmd)
@provider.create
end
it "should include -q for reiserfs" do
@resource.expects(:[]).with(:name).returns('/dev/myvg/mylv')
@resource.expects(:[]).with(:fs_type).returns('reiserfs')
@resource.expects(:[]).with(:options).returns('-b 4096 -E stride=32,stripe-width=64').twice
@provider.expects(:execute).with(['mkfs.reiserfs', '/dev/myvg/mylv', '-q', ['-b', '4096', '-E', 'stride=32,stripe-width=64']])
@resource.expects(:[]).with(:mkfs_cmd)
@provider.create
end
it "should call mkswap for filesystem type swap" do
@resource.expects(:[]).with(:name).returns('/dev/myvg/mylv')
@resource.expects(:[]).with(:fs_type).returns('swap')
@resource.expects(:[]).with(:options)
@provider.expects(:execute).with(['mkswap', '/dev/myvg/mylv'])
@resource.expects(:[]).with(:mkfs_cmd)
@provider.expects(:execute).with(['swapon', '/dev/myvg/mylv'])
@provider.create
end
it "should create an ext4 journal correctly" do
@resource.expects(:[]).with(:name).returns('/dev/myvg/mylv')
@resource.expects(:[]).with(:fs_type).returns('jbd')
@resource.expects(:[]).with(:options).returns('-O journal_dev').twice
@provider.expects(:execute).with(['mkfs.ext4', '/dev/myvg/mylv', ['-O', 'journal_dev']])
@resource.expects(:[]).with(:mkfs_cmd).returns('mkfs.ext4').twice
@provider.create
end
end
end