Skip to content

Commit ca6da83

Browse files
committed
Update spec files
1 parent 6ceb243 commit ca6da83

14 files changed

+1481
-165
lines changed

spec/defines/network_alias_spec.rb

+34-34
Original file line numberDiff line numberDiff line change
@@ -68,40 +68,6 @@
6868
it { should contain_service('network') }
6969
end
7070

71-
context 'required parameters: restart => false' do
72-
let(:title) { 'bond2:1' }
73-
let :params do {
74-
:ensure => 'up',
75-
:ipaddress => '1.2.3.6',
76-
:netmask => '255.255.255.0',
77-
:restart => false,
78-
:sched => nil,
79-
}
80-
end
81-
let(:facts) {{ :osfamily => 'RedHat' }}
82-
it { should contain_file('ifcfg-bond2:1').with(
83-
:ensure => 'present',
84-
:mode => '0644',
85-
:owner => 'root',
86-
:group => 'root',
87-
:path => '/etc/sysconfig/network-scripts/ifcfg-bond2:1',
88-
)}
89-
it 'should contain File[ifcfg-bond2:1] with required contents' do
90-
verify_contents(catalogue, 'ifcfg-bond2:1', [
91-
'DEVICE=bond2:1',
92-
'BOOTPROTO=none',
93-
'ONPARENT=yes',
94-
'TYPE=Ethernet',
95-
'IPADDR=1.2.3.6',
96-
'NETMASK=255.255.255.0',
97-
'NO_ALIASROUTING=no',
98-
'NM_CONTROLLED=no',
99-
])
100-
end
101-
it { should contain_service('network') }
102-
it { is_expected.to_not contain_file('ifcfg-bond2:1').that_notifies('Service[network]') }
103-
end
104-
10571
context 'optional parameters' do
10672
let(:title) { 'bond3:2' }
10773
let :params do {
@@ -145,4 +111,38 @@
145111
it { should contain_service('network') }
146112
end
147113

114+
context 'optional parameters: restart => false' do
115+
let(:title) { 'bond2:1' }
116+
let :params do {
117+
:ensure => 'up',
118+
:ipaddress => '1.2.3.6',
119+
:netmask => '255.255.255.0',
120+
:restart => false,
121+
:sched => nil,
122+
}
123+
end
124+
let(:facts) {{ :osfamily => 'RedHat' }}
125+
it { should contain_file('ifcfg-bond2:1').with(
126+
:ensure => 'present',
127+
:mode => '0644',
128+
:owner => 'root',
129+
:group => 'root',
130+
:path => '/etc/sysconfig/network-scripts/ifcfg-bond2:1',
131+
)}
132+
it 'should contain File[ifcfg-bond2:1] with required contents' do
133+
verify_contents(catalogue, 'ifcfg-bond2:1', [
134+
'DEVICE=bond2:1',
135+
'BOOTPROTO=none',
136+
'ONPARENT=yes',
137+
'TYPE=Ethernet',
138+
'IPADDR=1.2.3.6',
139+
'NETMASK=255.255.255.0',
140+
'NO_ALIASROUTING=no',
141+
'NM_CONTROLLED=no',
142+
])
143+
end
144+
it { should contain_service('network') }
145+
it { is_expected.to_not contain_file('ifcfg-bond2:1').that_notifies('Service[network]') }
146+
end
147+
148148
end

spec/defines/network_bond_bridge_spec.rb

+31-31
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,22 @@
101101
end
102102
end
103103

104-
context 'required parameters: restart => false' do
104+
context 'optional parameters' do
105105
let(:title) { 'bond0' }
106106
let :params do {
107-
:ensure => 'up',
108-
:bridge => 'br0',
109-
:restart => false,
110-
:sched => nil,
107+
:ensure => 'down',
108+
:bridge => 'br6',
109+
:mtu => '9000',
110+
:ethtool_opts => 'speed 1000 duplex full autoneg off',
111+
:bonding_opts => 'mode=active-backup miimon=100',
112+
:restart => true,
113+
:sched => nil,
111114
}
112115
end
113116
let :facts do {
114-
:osfamily => 'RedHat',
117+
:osfamily => 'RedHat',
115118
:operatingsystem => 'RedHat',
116-
:operatingsystemrelease => '6.0',
117-
:macaddress_bond0 => 'fe:fe:fe:aa:aa:aa',
119+
:operatingsystemrelease => '6.0'
118120
}
119121
end
120122
it { should contain_file('ifcfg-bond0').with(
@@ -123,41 +125,40 @@
123125
:owner => 'root',
124126
:group => 'root',
125127
:path => '/etc/sysconfig/network-scripts/ifcfg-bond0',
128+
:notify => 'Service[network]'
126129
)}
127130
it 'should contain File[ifcfg-bond0] with required contents' do
128131
verify_contents(catalogue, 'ifcfg-bond0', [
129132
'DEVICE=bond0',
130133
'BOOTPROTO=none',
131-
'ONBOOT=yes',
132-
'HOTPLUG=yes',
134+
'ONBOOT=no',
135+
'HOTPLUG=no',
133136
'TYPE=Ethernet',
134-
'BONDING_OPTS="miimon=100"',
135-
'PEERDNS=no',
136-
'BRIDGE=br0',
137+
'MTU=9000',
138+
'BONDING_OPTS="mode=active-backup miimon=100"',
139+
'ETHTOOL_OPTS="speed 1000 duplex full autoneg off"',
140+
'BRIDGE=br6',
137141
'NM_CONTROLLED=no',
138142
])
139143
end
140144
it { should contain_service('network') }
141145
it { should_not contain_augeas('modprobe.conf_bond0') }
142-
it { is_expected.to_not contain_file('ifcfg-bond0').that_notifies('Service[network]') }
143146
end
144147

145-
context 'optional parameters' do
148+
context 'optional parameters: restart => false' do
146149
let(:title) { 'bond0' }
147150
let :params do {
148-
:ensure => 'down',
149-
:bridge => 'br6',
150-
:mtu => '9000',
151-
:ethtool_opts => 'speed 1000 duplex full autoneg off',
152-
:bonding_opts => 'mode=active-backup miimon=100',
153-
:restart => true,
154-
:sched => nil,
151+
:ensure => 'up',
152+
:bridge => 'br0',
153+
:restart => false,
154+
:sched => nil,
155155
}
156156
end
157157
let :facts do {
158-
:osfamily => 'RedHat',
158+
:osfamily => 'RedHat',
159159
:operatingsystem => 'RedHat',
160-
:operatingsystemrelease => '6.0'
160+
:operatingsystemrelease => '6.0',
161+
:macaddress_bond0 => 'fe:fe:fe:aa:aa:aa',
161162
}
162163
end
163164
it { should contain_file('ifcfg-bond0').with(
@@ -166,24 +167,23 @@
166167
:owner => 'root',
167168
:group => 'root',
168169
:path => '/etc/sysconfig/network-scripts/ifcfg-bond0',
169-
:notify => 'Service[network]'
170170
)}
171171
it 'should contain File[ifcfg-bond0] with required contents' do
172172
verify_contents(catalogue, 'ifcfg-bond0', [
173173
'DEVICE=bond0',
174174
'BOOTPROTO=none',
175-
'ONBOOT=no',
176-
'HOTPLUG=no',
175+
'ONBOOT=yes',
176+
'HOTPLUG=yes',
177177
'TYPE=Ethernet',
178-
'MTU=9000',
179-
'BONDING_OPTS="mode=active-backup miimon=100"',
180-
'ETHTOOL_OPTS="speed 1000 duplex full autoneg off"',
181-
'BRIDGE=br6',
178+
'BONDING_OPTS="miimon=100"',
179+
'PEERDNS=no',
180+
'BRIDGE=br0',
182181
'NM_CONTROLLED=no',
183182
])
184183
end
185184
it { should contain_service('network') }
186185
it { should_not contain_augeas('modprobe.conf_bond0') }
186+
it { is_expected.to_not contain_file('ifcfg-bond0').that_notifies('Service[network]') }
187187
end
188188

189189
end

spec/defines/network_bond_slave_spec.rb

+36-36
Original file line numberDiff line numberDiff line change
@@ -55,42 +55,6 @@
5555
it { is_expected.to contain_file('ifcfg-eth1').that_notifies('Service[network]') }
5656
end
5757

58-
context 'required parameters, restart => false' do
59-
let(:pre_condition) { "file { 'ifcfg-bond0': }" }
60-
let(:title) { 'eth1' }
61-
let :params do {
62-
:macaddress => 'fe:fe:fe:aa:aa:a1',
63-
:master => 'bond0',
64-
:restart => false,
65-
:sched => nil,
66-
}
67-
end
68-
let :facts do {
69-
:osfamily => 'RedHat',
70-
:macaddress_eth1 => 'fe:fe:fe:aa:aa:aa',
71-
}
72-
end
73-
it { should contain_file('ifcfg-eth1').with(
74-
:ensure => 'present',
75-
:mode => '0644',
76-
:owner => 'root',
77-
:group => 'root',
78-
:path => '/etc/sysconfig/network-scripts/ifcfg-eth1'
79-
)}
80-
it 'should contain File[ifcfg-eth1] with required contents' do
81-
verify_contents(catalogue, 'ifcfg-eth1', [
82-
'DEVICE=eth1',
83-
'HWADDR=fe:fe:fe:aa:aa:a1',
84-
'MASTER=bond0',
85-
'SLAVE=yes',
86-
'TYPE=Ethernet',
87-
'NM_CONTROLLED=no',
88-
])
89-
end
90-
it { should contain_service('network') }
91-
it { is_expected.to_not contain_file('ifcfg-eth1').that_notifies('Service[network]') }
92-
end
93-
9458
context 'optional parameters' do
9559
let(:pre_condition) { "file { 'ifcfg-bond0': }" }
9660
let(:title) { 'eth3' }
@@ -138,4 +102,40 @@
138102
it { should contain_service('network') }
139103
end
140104

105+
context 'optional parameters, restart => false' do
106+
let(:pre_condition) { "file { 'ifcfg-bond0': }" }
107+
let(:title) { 'eth1' }
108+
let :params do {
109+
:macaddress => 'fe:fe:fe:aa:aa:a1',
110+
:master => 'bond0',
111+
:restart => false,
112+
:sched => nil,
113+
}
114+
end
115+
let :facts do {
116+
:osfamily => 'RedHat',
117+
:macaddress_eth1 => 'fe:fe:fe:aa:aa:aa',
118+
}
119+
end
120+
it { should contain_file('ifcfg-eth1').with(
121+
:ensure => 'present',
122+
:mode => '0644',
123+
:owner => 'root',
124+
:group => 'root',
125+
:path => '/etc/sysconfig/network-scripts/ifcfg-eth1'
126+
)}
127+
it 'should contain File[ifcfg-eth1] with required contents' do
128+
verify_contents(catalogue, 'ifcfg-eth1', [
129+
'DEVICE=eth1',
130+
'HWADDR=fe:fe:fe:aa:aa:a1',
131+
'MASTER=bond0',
132+
'SLAVE=yes',
133+
'TYPE=Ethernet',
134+
'NM_CONTROLLED=no',
135+
])
136+
end
137+
it { should contain_service('network') }
138+
it { is_expected.to_not contain_file('ifcfg-eth1').that_notifies('Service[network]') }
139+
end
140+
141141
end

0 commit comments

Comments
 (0)