(t *testing.T)
| 270 | } |
| 271 | |
| 272 | func TestSamplerUnknownLevels(t *testing.T) { |
| 273 | // Prove that out-of-bounds levels don't panic. |
| 274 | unknownLevels := []Level{ |
| 275 | DebugLevel - 1, |
| 276 | FatalLevel + 1, |
| 277 | } |
| 278 | |
| 279 | for _, lvl := range unknownLevels { |
| 280 | t.Run(lvl.String(), func(t *testing.T) { |
| 281 | sampler, logs := fakeSampler(lvl, time.Minute, 2, 3) |
| 282 | for i := 1; i < 10; i++ { |
| 283 | writeSequence(sampler, i, lvl) |
| 284 | } |
| 285 | |
| 286 | // Expect no sampling for unknown levels. |
| 287 | assertSequence(t, logs.TakeAll(), lvl, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
| 288 | }) |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | func TestSamplerWithZeroThereafter(t *testing.T) { |
| 293 | var counter countingCore |
nothing calls this directly
no test coverage detected