2014-07-08 15:02:12 +02:00
|
|
|
import unittest
|
2019-04-21 12:00:26 +02:00
|
|
|
import json
|
2014-07-08 15:02:12 +02:00
|
|
|
|
2015-02-19 10:57:55 +01:00
|
|
|
from osclib.conf import Config
|
2014-07-08 15:02:12 +02:00
|
|
|
from osclib.check_command import CheckCommand
|
|
|
|
from osclib.stagingapi import StagingAPI
|
|
|
|
|
2019-04-21 12:00:26 +02:00
|
|
|
from mock import MagicMock
|
2019-05-04 16:11:51 +02:00
|
|
|
from . import OBSLocal
|
2019-04-21 12:00:26 +02:00
|
|
|
|
2014-07-08 15:02:12 +02:00
|
|
|
FULL_REPORT = """
|
2018-11-06 11:27:48 +01:00
|
|
|
-- BUILDING Project openSUSE:Factory:Staging:A still needs attention
|
|
|
|
- pcre: Missing reviews: repo-checker
|
|
|
|
- At least following repositories are still building:
|
|
|
|
standard/i586: building
|
|
|
|
- Following packages are broken:
|
|
|
|
installation-images:Kubic (standard): failed
|
2014-07-08 15:02:12 +02:00
|
|
|
|
2018-11-06 11:27:48 +01:00
|
|
|
-- TESTING Project openSUSE:Factory:Staging:B still needs attention
|
|
|
|
- perl-File-Copy-Recursive: Missing reviews: repo-checker
|
|
|
|
- Missing check: openqa:cryptlvm
|
2014-07-08 15:02:12 +02:00
|
|
|
|
2018-11-06 11:27:48 +01:00
|
|
|
-- BUILDING Project openSUSE:Factory:Staging:C still needs attention
|
|
|
|
- perl: Missing reviews: repo-checker
|
2014-07-08 15:02:12 +02:00
|
|
|
- At least following repositories are still building:
|
2014-07-08 17:06:31 +02:00
|
|
|
standard/i586: building
|
2018-11-06 11:27:48 +01:00
|
|
|
- Missing check: openqa:cryptlvm
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:D still needs attention
|
|
|
|
- failure check: openqa:textmode https://openqa.opensuse.org/tests/790715#step/partitioning/2
|
|
|
|
|
|
|
|
++ Acceptable staging project openSUSE:Factory:Staging:E
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:F still needs attention
|
|
|
|
- python-ceilometerclient: Missing reviews: repo-checker
|
|
|
|
- Following packages are broken:
|
|
|
|
dleyna-server (standard): unresolvable
|
|
|
|
- pending check: openqa:textmode https://openqa.opensuse.org/tests/790912
|
|
|
|
|
|
|
|
-- UNACCEPTABLE Project openSUSE:Factory:Staging:adi:16 still needs attention
|
|
|
|
- postfixadmin: declined
|
|
|
|
- postfixadmin: Missing reviews: repo-checker
|
|
|
|
|
|
|
|
-- UNACCEPTABLE Project openSUSE:Factory:Staging:adi:17 still needs attention
|
|
|
|
- cf-cli: declined
|
|
|
|
- Following packages are broken:
|
|
|
|
cf-cli:test (standard): failed
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:35 still needs attention
|
|
|
|
- checkpolicy: Missing reviews: repo-checker
|
|
|
|
- Following packages are broken:
|
|
|
|
checkpolicy (standard): unresolvable
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:36 still needs attention
|
|
|
|
- python-QtPy: Missing reviews: opensuse-review-team
|
|
|
|
- Following packages are broken:
|
|
|
|
python-QtPy (standard): failed
|
2014-07-08 15:02:12 +02:00
|
|
|
|
2018-11-06 11:27:48 +01:00
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:38 still needs attention
|
|
|
|
- lmms: Missing reviews: repo-checker
|
|
|
|
- Following packages are broken:
|
|
|
|
lmms (standard): unresolvable
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:39 still needs attention
|
|
|
|
- Following packages are broken:
|
|
|
|
ocaml-extlib (standard): unresolvable
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:40 still needs attention
|
|
|
|
- apache2-mod_auth_openidc: Missing reviews: repo-checker
|
|
|
|
- Following packages are broken:
|
|
|
|
apache2-mod_auth_openidc (standard): unresolvable
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:44 still needs attention
|
|
|
|
- Following packages are broken:
|
|
|
|
nut (standard): failed
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:5 still needs attention
|
|
|
|
- verilator: Missing reviews: opensuse-review-team
|
|
|
|
- Following packages are broken:
|
|
|
|
verilator (standard): unresolvable
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:56 still needs attention
|
|
|
|
- Following packages are broken:
|
|
|
|
firehol (standard): unresolvable
|
|
|
|
|
|
|
|
-- UNACCEPTABLE Project openSUSE:Factory:Staging:adi:62 still needs attention
|
|
|
|
- rubygem-passenger: declined
|
|
|
|
- rubygem-passenger: Missing reviews: opensuse-review-team
|
|
|
|
- Following packages are broken:
|
|
|
|
rubygem-passenger (standard): failed
|
|
|
|
|
|
|
|
-- UNACCEPTABLE Project openSUSE:Factory:Staging:adi:65 still needs attention
|
|
|
|
- python-easypysmb: declined
|
|
|
|
- python-easypysmb: Missing reviews: opensuse-review-team
|
|
|
|
|
|
|
|
-- FAILED Project openSUSE:Factory:Staging:adi:67 still needs attention
|
|
|
|
- cargo-vendor: Missing reviews: repo-checker
|
|
|
|
- Following packages are broken:
|
|
|
|
cargo-vendor (standard): unresolvable
|
|
|
|
|
|
|
|
-- UNACCEPTABLE Project openSUSE:Factory:Staging:adi:7 still needs attention
|
|
|
|
- osslsigncode: declined
|
|
|
|
- x86info: Missing reviews: opensuse-review-team
|
2014-07-08 15:02:12 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
H_REPORT = """
|
2018-11-06 11:27:48 +01:00
|
|
|
-- FAILED Project openSUSE:Factory:Staging:H still needs attention
|
|
|
|
- failure check: openqa:textmode https://openqa.opensuse.org/tests/790715#step/partitioning/2
|
2014-07-08 15:02:12 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class TestCheckCommand(unittest.TestCase):
|
|
|
|
"""Tests CheckCommand."""
|
|
|
|
|
2019-04-21 12:00:26 +02:00
|
|
|
def setup_vcr(self):
|
2019-05-04 16:11:51 +02:00
|
|
|
wf = OBSLocal.StagingWorkflow()
|
2019-04-21 12:00:26 +02:00
|
|
|
wf.create_staging('H')
|
|
|
|
self.checkcommand = CheckCommand(wf.api)
|
|
|
|
return wf
|
2014-07-08 15:02:12 +02:00
|
|
|
|
|
|
|
def test_check_command_all(self):
|
|
|
|
"""Validate json conversion for all projects."""
|
2019-04-21 12:00:26 +02:00
|
|
|
wf = self.setup_vcr()
|
2019-05-02 20:34:21 +02:00
|
|
|
with open('tests/fixtures/project/staging_projects/openSUSE:Factory.json', encoding='utf-8') as f:
|
2019-04-21 12:00:26 +02:00
|
|
|
wf.api.project_status = MagicMock(return_value=json.load(f))
|
2014-07-08 15:02:12 +02:00
|
|
|
report = self.checkcommand._check_project()
|
2018-11-06 11:27:48 +01:00
|
|
|
self.maxDiff = 20000
|
|
|
|
self.assertMultiLineEqual('\n'.join(report).strip(), FULL_REPORT.strip())
|
2014-07-08 15:02:12 +02:00
|
|
|
|
|
|
|
def test_check_command_single(self):
|
|
|
|
"""Validate json conversion for a single project."""
|
2019-04-21 12:00:26 +02:00
|
|
|
wf = self.setup_vcr()
|
2019-05-02 20:34:21 +02:00
|
|
|
with open('tests/fixtures/project/staging_projects/openSUSE:Factory/H.json', encoding='utf-8') as f:
|
2019-04-21 12:00:26 +02:00
|
|
|
wf.api.project_status = MagicMock(return_value=json.load(f))
|
2014-07-08 15:02:12 +02:00
|
|
|
report = self.checkcommand._check_project('H')
|
2018-11-06 11:27:48 +01:00
|
|
|
self.assertMultiLineEqual('\n'.join(report).strip(), H_REPORT.strip())
|