From e3eee98f9e78310ca95dc2be07f835bc1a2c4e08 Mon Sep 17 00:00:00 2001 From: Robert Helmer Date: Wed, 28 Mar 2012 16:18:16 -0700 Subject: [PATCH] bug 729634 - add update_nightly_builds cron --- socorro/cron/dailyMatviews.py | 1 + socorro/unittest/cron/testDailyMatviews.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/socorro/cron/dailyMatviews.py b/socorro/cron/dailyMatviews.py index 2e2c5fb888..153c96e3db 100644 --- a/socorro/cron/dailyMatviews.py +++ b/socorro/cron/dailyMatviews.py @@ -24,6 +24,7 @@ def update(config, targetDate): ['update_product_versions' 'update_signatures']), ('update_hang_report', [targetDate], []), ('update_rank_compare', [targetDate], []), + ('update_nightly_builds', [targetDate], []), ) failed = set() diff --git a/socorro/unittest/cron/testDailyMatviews.py b/socorro/unittest/cron/testDailyMatviews.py index 08f1be0138..b3820f0488 100644 --- a/socorro/unittest/cron/testDailyMatviews.py +++ b/socorro/unittest/cron/testDailyMatviews.py @@ -74,8 +74,8 @@ def test_failing__update_product_versions(self): self.assertEqual(cursor.called, ['update_product_versions', 'update_signatures', 'update_os_versions', 'update_adu', 'update_daily_crashes', 'update_hang_report', - 'update_rank_compare']) - self.assertEqual(mock_logger.info.call_count, 7) + 'update_rank_compare', 'update_nightly_builds']) + self.assertEqual(mock_logger.info.call_count, 8) self.assertEqual(mock_logger.warn.call_count, 2) self.assertEqual(mock_logger.error.call_count, 0) @@ -84,7 +84,7 @@ def test_all_works(self): dailyMatviews.psycopg2 = mock_psycopg2(cursor) with patch('socorro.cron.dailyMatviews.logger') as mock_logger: dailyMatviews.update(self.config, 'some date') - self.assertEqual(mock_logger.info.call_count, 8) + self.assertEqual(mock_logger.info.call_count, 9) self.assertEqual(mock_logger.warn.call_count, 0) self.assertEqual(mock_logger.error.call_count, 0) @@ -95,7 +95,7 @@ def test_mock_internal_error(self): dailyMatviews.psycopg2 = mock_psycopg2(cursor) with patch('socorro.cron.dailyMatviews.logger') as mock_logger: dailyMatviews.update(self.config, 'some date') - self.assertEqual(mock_logger.info.call_count, 7) + self.assertEqual(mock_logger.info.call_count, 8) self.assertEqual(mock_logger.warn.call_count, 1) self.assertEqual(mock_logger.error.call_count, 1) @@ -182,6 +182,12 @@ def setUp(self): BEGIN RETURN true; END; +$$ LANGUAGE plpgsql; + CREATE OR REPLACE FUNCTION update_nightly_builds(timestamp with time zone) +RETURNS boolean AS $$ +BEGIN + RETURN true; +END; $$ LANGUAGE plpgsql; """) @@ -199,6 +205,7 @@ def tearDown(self): DROP FUNCTION update_daily_crashes (timestamp with time zone) ; DROP FUNCTION update_hang_report(timestamp with time zone) ; DROP FUNCTION update_rank_compare(timestamp with time zone) ; + DROP FUNCTION update_nightly_builds(timestamp with time zone) ; """) self.connection.commit()