pyr/check-graphite — pull request #9 by dcarley (2013-11-21 12:30:44+00:00)
Title: Fix return UNKNOWN for all NULL values

##### Spec test for "no valid datapoints"

An `UNKNOWN` response should be returned when the dataset only contains
`NULL` values. Otherwise `sum / datapoints.size` of `0.0 / [].size` will
return `NaN` and result in either a false-negative `CRITICAL` or
false-positive `OK`.

This will fail because I broke it during a refactor in d9c2f90. The `res`
hash no longer contains a key called `:count`, so Ruby returns `nil`.

##### Fix return UNKNOWN for all NULL values

Per the test in the previous commit. Check the size of the list after
removing `NULL`/`nil` values. Do this before calculating the sum.

--

Sorry!