assertQueryStats asserts the statistics using the provided parameters.
( tb testing.TB, stats *proxy.QueryStatistics, wantMainCount int, wantMainErr assert.BoolAssertionFunc, wantFallbackCount int, wantFallbackErr assert.BoolAssertionFunc, )
| 236 | |
| 237 | // assertQueryStats asserts the statistics using the provided parameters. |
| 238 | func assertQueryStats( |
| 239 | tb testing.TB, |
| 240 | stats *proxy.QueryStatistics, |
| 241 | wantMainCount int, |
| 242 | wantMainErr assert.BoolAssertionFunc, |
| 243 | wantFallbackCount int, |
| 244 | wantFallbackErr assert.BoolAssertionFunc, |
| 245 | ) { |
| 246 | tb.Helper() |
| 247 | |
| 248 | main := stats.Main() |
| 249 | assert.Lenf(tb, main, wantMainCount, "main stats count") |
| 250 | |
| 251 | fallback := stats.Fallback() |
| 252 | assert.Lenf(tb, fallback, wantFallbackCount, "fallback stats count") |
| 253 | |
| 254 | wantMainErr(tb, isErrorInStats(main), "main err") |
| 255 | wantFallbackErr(tb, isErrorInStats(fallback), "fallback err") |
| 256 | } |
| 257 | |
| 258 | // isErrorInStats is a helper function for tests that returns true if the |
| 259 | // upstream statistics contain an DNS lookup error. |
no test coverage detected
searching dependent graphs…