|
140 | 140 | end |
141 | 141 |
|
142 | 142 | describe 'mtu' do |
143 | | - it 'validates a tiny mtu size' do |
144 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '42') |
145 | | - end |
146 | | - |
147 | 143 | it 'validates a tiny mtu size as a number' do |
148 | 144 | Puppet::Type.type(:network_config).new(name: 'yay', mtu: 42) |
149 | 145 | end |
150 | 146 |
|
151 | | - it 'validates a normal mtu size' do |
152 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '1500') |
153 | | - end |
154 | | - |
155 | 147 | it 'validates a normal mtu size as a number' do |
156 | 148 | Puppet::Type.type(:network_config).new(name: 'yay', mtu: 1500) |
157 | 149 | end |
158 | 150 |
|
159 | | - it 'validates a large mtu size' do |
160 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '16384') |
161 | | - end |
162 | | - |
163 | 151 | it 'validates a large mtu size as a number' do |
164 | 152 | Puppet::Type.type(:network_config).new(name: 'yay', mtu: 16_384) |
165 | 153 | end |
|
170 | 158 | end.to raise_error(%r{must be a positive integer}) |
171 | 159 | end |
172 | 160 |
|
173 | | - it 'fails on values < 42' do |
174 | | - expect do |
175 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '41') |
176 | | - end.to raise_error(%r{is not in the valid mtu range}) |
177 | | - end |
178 | | - |
179 | 161 | it 'fails on numeric values < 42' do |
180 | 162 | expect do |
181 | 163 | Puppet::Type.type(:network_config).new(name: 'yay', mtu: 41) |
182 | 164 | end.to raise_error(%r{is not in the valid mtu range}) |
183 | 165 | end |
184 | 166 |
|
185 | | - it 'fails on zero' do |
186 | | - expect do |
187 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '0') |
188 | | - end.to raise_error(%r{is not in the valid mtu range}) |
189 | | - end |
190 | | - |
191 | 167 | it 'fails on numeric zero' do |
192 | 168 | expect do |
193 | 169 | Puppet::Type.type(:network_config).new(name: 'yay', mtu: 0) |
194 | 170 | end.to raise_error(%r{is not in the valid mtu range}) |
195 | 171 | end |
196 | 172 |
|
197 | | - it 'fails on values > 65536' do |
198 | | - expect do |
199 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '65537') |
200 | | - end.to raise_error(%r{is not in the valid mtu range}) |
201 | | - end |
202 | | - |
203 | 173 | it 'fails on numeric values > 65536' do |
204 | 174 | expect do |
205 | 175 | Puppet::Type.type(:network_config).new(name: 'yay', mtu: 65_537) |
206 | 176 | end.to raise_error(%r{is not in the valid mtu range}) |
207 | 177 | end |
208 | 178 |
|
209 | | - it 'fails on negative values' do |
210 | | - expect do |
211 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '-1500') |
212 | | - end.to raise_error(%r{is not a valid mtu}) |
213 | | - end |
214 | | - |
215 | 179 | it 'fails on negative numbers' do |
216 | 180 | expect do |
217 | 181 | Puppet::Type.type(:network_config).new(name: 'yay', mtu: -1500) |
218 | 182 | end.to raise_error(%r{is not in the valid mtu range}) |
219 | 183 | end |
220 | 184 |
|
221 | | - it 'fails on non-integer values' do |
| 185 | + it 'fails on numeric non-integer values' do |
222 | 186 | expect do |
223 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: '1500.1') |
| 187 | + Puppet::Type.type(:network_config).new(name: 'yay', mtu: 1500.1) |
224 | 188 | end.to raise_error(%r{must be a positive integer}) |
225 | 189 | end |
226 | 190 |
|
227 | | - it 'fails on numeric non-integer values' do |
| 191 | + it 'fails on integers passed as strings' do |
228 | 192 | expect do |
229 | | - Puppet::Type.type(:network_config).new(name: 'yay', mtu: 1500.1) |
| 193 | + Puppet::Type.type(:network_config).new(name: 'yay', mtu: '1500.1') |
230 | 194 | end.to raise_error(%r{must be a positive integer}) |
231 | 195 | end |
232 | 196 | end |
|
0 commit comments