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