Repository: fedora-infra/bodhi

Issue:
Update.greenwave_summary_string seems to be unused
SSIA


Discussion:

Resolving patch:
diff --git a/bodhi/server/migrations/versions/e5b3ddb35df3_remove_the_greenwave_summary_string_.py b/bodhi/server/migrations/versions/e5b3ddb35df3_remove_the_greenwave_summary_string_.py
new file mode 100644
--- /dev/null
+++ b/bodhi/server/migrations/versions/e5b3ddb35df3_remove_the_greenwave_summary_string_.py
@@ -0,0 +1,41 @@
+# Copyright (c) 2019 Sebastian Wojciechowski
+#
+# This file is part of Bodhi.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+"""
+Remove the greenwave_summary_string field from updates.
+
+Revision ID: e5b3ddb35df3
+Revises: 9c0a34961768
+Create Date: 2019-02-16 07:02:20.196160
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'e5b3ddb35df3'
+down_revision = '9c0a34961768'
+
+
+def upgrade():
+    """Drop the greenwave_summary_string column from the updates table."""
+    op.drop_column('updates', 'greenwave_summary_string')
+
+
+def downgrade():
+    """Restore the greenwave_summary_string removed in the upgrade() function."""
+    op.add_column('updates', sa.Column('greenwave_summary_string', sa.Unicode(255)))
diff --git a/bodhi/server/models.py b/bodhi/server/models.py
--- a/bodhi/server/models.py
+++ b/bodhi/server/models.py
@@ -1620,8 +1620,6 @@ class Update(Base):
         test_gating_status (EnumSymbol): The test gating status of the update. This must be one
             of the values defined in :class:`TestGatingStatus` or ``None``. None indicates that
             Greenwave integration was not enabled when the update was created.
-        greenwave_summary_string (unicode): A short summary of the outcome from Greenwave
-            (e.g. 2 of 32 required tests failed).
         compose (Compose): The :class:`Compose` that this update is currently being composed in. The
             update is locked if this is defined.
     """
@@ -1696,7 +1694,6 @@ class Update(Base):
 
     # Greenwave
     test_gating_status = Column(TestGatingStatus.db_type(), default=None, nullable=True)
-    greenwave_summary_string = Column(Unicode(255))
 
     @property
     def side_tag_locked(self):
@@ -1942,7 +1939,6 @@ def update_test_gating_status(self):
                 self.test_gating_status = TestGatingStatus.passed
         else:
             self.test_gating_status = TestGatingStatus.failed
-        self.greenwave_summary_string = decision['summary']
 
     @classmethod
     def new(cls, request, data):


Test patch:
diff --git a/bodhi/tests/server/consumers/test_updates.py b/bodhi/tests/server/consumers/test_updates.py
--- a/bodhi/tests/server/consumers/test_updates.py
+++ b/bodhi/tests/server/consumers/test_updates.py
@@ -173,7 +173,6 @@ def test_gating_required_false(self, sleep):
 
         update = models.Update.query.filter_by(title=u'bodhi-2.0-1.fc17').one()
         self.assertIsNone(update.test_gating_status)
-        self.assertIsNone(update.greenwave_summary_string)
         sleep.assert_called_once_with(1)
 
     @mock.patch.dict('bodhi.server.config.config', {'test_gating.required': True})
@@ -213,7 +212,6 @@ def test_gating_required_true(self, sleep):
 
         update = models.Update.query.filter_by(title=u'bodhi-2.0-1.fc17').one()
         self.assertEqual(update.test_gating_status, models.TestGatingStatus.failed)
-        self.assertEqual(update.greenwave_summary_string, u'what have you done‽')
         sleep.assert_called_once_with(1)
 
     # We're going to use side effects to mock but still call work_on_bugs and fetch_test_cases so we
diff --git a/bodhi/tests/server/scripts/test_check_policies.py b/bodhi/tests/server/scripts/test_check_policies.py
--- a/bodhi/tests/server/scripts/test_check_policies.py
+++ b/bodhi/tests/server/scripts/test_check_policies.py
@@ -49,7 +49,6 @@ def test_policies_satisfied(self):
             self.assertEqual(result.exit_code, 0)
             update = self.db.query(models.Update).filter(models.Update.id == update.id).one()
             self.assertEqual(update.test_gating_status, models.TestGatingStatus.passed)
-            self.assertEqual(update.greenwave_summary_string, 'All tests passed')
 
         expected_query = {
             'product_version': 'fedora-17', 'decision_context': 'bodhi_update_push_stable',
@@ -83,7 +82,6 @@ def test_policies_pending_satisfied(self):
             self.assertEqual(result.exit_code, 0)
             update = self.db.query(models.Update).filter(models.Update.id == update.id).one()
             self.assertEqual(update.test_gating_status, models.TestGatingStatus.passed)
-            self.assertEqual(update.greenwave_summary_string, 'All tests passed')
 
         expected_query = {
             'product_version': 'fedora-17', 'decision_context': 'bodhi_update_push_testing',
@@ -124,7 +122,6 @@ def test_policies_unsatisfied(self):
             self.assertEqual(result.exit_code, 0)
             update = self.db.query(models.Update).filter(models.Update.id == update.id).one()
             self.assertEqual(update.test_gating_status, models.TestGatingStatus.failed)
-            self.assertEqual(update.greenwave_summary_string, '1 of 2 tests are failed')
             # Check for the comment
             expected_comment = u"This update test gating status has been changed to 'failed'."
             self.assertEqual(update.comments[-1].text, expected_comment)
@@ -195,7 +192,6 @@ def test_pushed_update(self):
         self.assertEqual(result.exit_code, 0)
         update = self.db.query(models.Update).filter(models.Update.id == update.id).one()
         self.assertEqual(update.test_gating_status, models.TestGatingStatus.failed)
-        self.assertEqual(update.greenwave_summary_string, 'it broke')
         expected_query = {
             'product_version': 'fedora-17', 'decision_context': 'bodhi_update_push_stable',
             'subject': [{'item': u'bodhi-2.0-1.fc17', 'type': 'koji_build'},
@@ -228,7 +224,6 @@ def test_unrestricted_policy(self):
             self.assertEqual(result.exit_code, 0)
             update = self.db.query(models.Update).filter(models.Update.id == update.id).one()
             self.assertEqual(update.test_gating_status, models.TestGatingStatus.ignored)
-            self.assertEqual(update.greenwave_summary_string, 'no tests are required')
             # Check for the comment
             expected_comment = u"This update test gating status has been changed to 'ignored'."
             self.assertEqual(update.comments[-1].text, expected_comment)
diff --git a/bodhi/tests/server/test_models.py b/bodhi/tests/server/test_models.py
--- a/bodhi/tests/server/test_models.py
+++ b/bodhi/tests/server/test_models.py
@@ -1735,11 +1735,6 @@ def test_500_response_from_greenwave(self, sleep, post, error):
         update.update_test_gating_status()
 
         self.assertEqual(update.test_gating_status, model.TestGatingStatus.greenwave_failed)
-        self.assertEqual(
-            update.greenwave_summary_string,
-            ('Bodhi failed to send POST request to Greenwave at the following URL '
-             '"https://greenwave-web-greenwave.app.os.fedoraproject.org/api/v1.0/decision". The '
-             'status code was "500".'))
         self.assertEqual(sleep.mock_calls, [mock.call(1), mock.call(1), mock.call(1)])
         expected_post = mock.call(
             'https://greenwave-web-greenwave.app.os.fedoraproject.org/api/v1.0/decision',
@@ -1784,7 +1779,6 @@ def test_timeout_from_greenwave(self, sleep, post, error):
         update.update_test_gating_status()
 
         self.assertEqual(update.test_gating_status, model.TestGatingStatus.greenwave_failed)
-        self.assertEqual(update.greenwave_summary_string, 'The connection timed out.')
         # The call_url() handler doesn't catch a Timeout so there are no sleeps/retries.
         self.assertEqual(sleep.mock_calls, [])
         expected_post = mock.call(