Add state_reason on GW failure

Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
This commit is contained in:
Valerij Maljulin
2019-05-27 14:09:57 +02:00
parent cde8d8058d
commit f0dc0b851d
5 changed files with 30 additions and 7 deletions

View File

@@ -528,6 +528,7 @@ class TestBuild:
assert module_build.state == models.BUILD_STATES["ready"]
else:
assert module_build.state == models.BUILD_STATES["done"]
assert module_build.state_reason == "Gating failed"
@patch(
"module_build_service.config.Config.check_for_eol",

View File

@@ -18,6 +18,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import re
import pytest
from mock import patch
from module_build_service import models, conf
@@ -666,4 +667,8 @@ class TestPoller:
assert set([m.id for m in module]) == {1, 2}
else:
assert len(module) == 1
assert set([m.id for m in module]) == {1}
assert module[0].id == 1
module = models.ModuleBuild.query.filter_by(state=models.BUILD_STATES["done"]).all()
assert len(module) == 1
assert module[0].id == 2
assert re.match("Gating failed.*", module[0].state_reason)