#1401 frontend: build.source_status for old builds
Merged 3 years ago by praiskup. Opened 3 years ago by praiskup.

@@ -1091,6 +1091,8 @@

          """

          Return text representation of status of this build

          """

+         if self.source_status is None:

+             return "unknown"

          return StatusEnum(self.source_status)

  

      @property

@@ -182,3 +182,11 @@

              build.status = StatusEnum(state)

              assert build.rpm_live_log_url is None

              assert build.rpm_backend_log_url is None

+ 

+     @pytest.mark.usefixtures("f_users", "f_coprs", "f_mock_chroots", "f_builds")

+     def test_source_state_translation(self):

+         """ test the very old builds that don't have the source_status set """

+         self.b1.source_status = None

+         assert self.b1.source_state == "unknown"

+         self.b1.source_status = 0

+         assert self.b1.source_state == "failed"

.. from times we had no source_status. Such builds don't have
build.source_status set. We can not do anything reasonable than just
translate that to "unknown".

Fixes: #1395

+1,
I am surprised that we still had such bug.

It's a bit of a shame that we need to have this condition for all state methods in models. Maybe we could fix it in StatusEnum but I am not sure if I want to add an extra complexity there. Let's stick with this PR.

I am surprised that we still had such bug.

The patched code is quite new ....

Thank you for the review!

rebased onto a1232bc

3 years ago

Pull-Request has been merged by praiskup

3 years ago