Autotest: Always email all the long failing tests.

We probably will not need to send emails that only show differences between
failures we already know and ones we just found out about. This change will
also make it a bit easier to separate out the storage logic from the reporting
logic.

BUG=chromium:255681
DEPLOY=none
TEST=Unittests

Change-Id: I72cb92496382e2949c964f79263e2b3025b8f697
Reviewed-on: https://gerrit.chromium.org/gerrit/60540
Reviewed-by: Dennis Jeffrey <dennisjeffrey@chromium.org>
Tested-by: Keyar Hood <keyar@chromium.org>
Commit-Queue: Keyar Hood <keyar@chromium.org>
diff --git a/frontend/health/complete_failures_unittest.py b/frontend/health/complete_failures_unittest.py
index bce06e7..1c28a9b 100755
--- a/frontend/health/complete_failures_unittest.py
+++ b/frontend/health/complete_failures_unittest.py
@@ -52,11 +52,11 @@
         super(EmailAboutTestFailureTests, self).tearDown()
 
 
-    def test_deal_with_new_failing_test(self):
+    def test_deal_with_failing_test(self):
         """
         Test adding a failing test to the storage.
 
-        We expect the email sending code to be called if it is added.
+        We expect the email sending code to be called.
 
         """
         # We will want to keep all the datetime logic intact and so we need to
@@ -118,13 +118,22 @@
         self.assertTrue('test' not in storage)
 
 
-    def test_do_not_send_email_if_test_already_in_storage(self):
+    def test_send_email_if_test_already_in_storage(self):
         """Test only send emails on newly problematic tests."""
         storage = {'test': datetime.datetime(2012, 1, 1)}
         self.datetime = datetime.datetime
         self.mox.StubOutWithMock(datetime, 'datetime')
         datetime.datetime.today().AndReturn(self.datetime(2012, 1, 1))
 
+        mail.send(
+                'chromeos-test-health@google.com',
+                ['chromeos-lab-infrastructure@google.com'],
+                [],
+                'Long Failing Tests',
+                'The following tests have been failing for at '
+                'least %i days:\n\ntest'
+                    % complete_failures._DAYS_TO_BE_FAILING_TOO_LONG)
+
         self.mox.ReplayAll()
         complete_failures.email_about_test_failure(
                 {'test': datetime.datetime.min}, storage)
@@ -141,6 +150,15 @@
 
         storage = {'test': datetime.datetime.min}
 
+        mail.send(
+                'chromeos-test-health@google.com',
+                ['chromeos-lab-infrastructure@google.com'],
+                [],
+                'Long Failing Tests',
+                'The following tests have been failing for at '
+                'least %i days:\n\ntest'
+                    % complete_failures._DAYS_TO_BE_FAILING_TOO_LONG)
+
         # The ReplayAll is required or else a mox object sneaks its way into
         # the storage object somehow.
         self.mox.ReplayAll()