Only evaluate the next state if there's a value (#7222)

I've experience this on my Redash in production. I'm not sure what can cause the value to exist, but be None. I guess it depends on the SQL query.

I followed the same idea of returning a self.UNKNOWN_STATE for cases that we can't know what's happening.
This commit is contained in:
thiagogds
2024-11-26 18:57:34 +01:00
committed by GitHub
parent baa9bbd505
commit c12e68f5d1
2 changed files with 7 additions and 3 deletions

View File

@@ -118,6 +118,10 @@ class TestAlertEvaluate(BaseTestCase):
)
self.assertEqual(alert.evaluate(), Alert.UNKNOWN_STATE)
def test_evaluate_return_unknown_when_value_is_none(self):
alert = self.create_alert(get_results(None))
self.assertEqual(alert.evaluate(), Alert.UNKNOWN_STATE)
class TestNextState(TestCase):
def test_numeric_value(self):