Exemplo n.º 1
0
 def test_get_attached_filtered_bugs(self):
     bv = BugValidator(self.runtime_fixture())
     bv.product = "OpenShift Container Platform"
     bv.target_releases = ['4.5.0', '4.5.z']
     bugs = {bug.id
             for bug in bv._get_attached_filtered_bugs([60089])
             }  # SHIPPED_LIVE RHSA
     self.assertIn(1856529, bugs)  # security tracker
     self.assertNotIn(1858981, bugs)  # flaw bug
     self.assertFalse(bv.problems, "There should be no problems")
Exemplo n.º 2
0
    def test_get_attached_filtered_bugs_problems(self):
        # Create event loop
        loop = asyncio.get_event_loop()

        # Initialize validator
        bv = BugValidator(self.runtime_fixture())
        bv.product = "OpenShift Container Platform"
        bv.target_releases = ['4.5.0', '4.5.z']

        # Login with errata tool
        loop.run_until_complete(bv.errata_api.login())

        # Get attached bugs
        result = loop.run_until_complete(bv.get_attached_bugs([60089]))
        self.assertTrue(result, "Should find attached bugs")
        advisory_bugs = result[60089]

        # Filter bugs by release and product
        bv.filter_bugs_by_release(advisory_bugs, True)
        bv.filter_bugs_by_product(advisory_bugs)

        # Check validation problems
        self.assertTrue(bv.problems, "Should find version mismatch")
        self.assertTrue(any("1858981" in problem for problem in bv.problems),
                        "Should find version mismatch for 1858981")
Exemplo n.º 3
0
    def test_get_attached_bugs(self):
        # Create event loop
        loop = asyncio.get_event_loop()

        # Login with errata tool
        bv = BugValidator(self.runtime_fixture())
        loop.run_until_complete(bv.errata_api.login())

        # Get attached bugs
        result = loop.run_until_complete(bv.get_attached_bugs([60085]))
        bugs = result[60085]

        self.assertEqual(20, len(bugs))
        self.assertIn(1812663, {bug.id for bug in bugs})
 async def test_get_attached_bugs(self):
     runtime = MagicMock()
     bug_map = {
         'bug-1': flexmock(id='bug-1'),
         'bug-2': flexmock(id='bug-2'),
     }
     flexmock(JIRABugTracker).should_receive("get_config").and_return({
         'target_release': ['4.9.z'],
         'product':
         'OpenShift Container Platform'
     })
     flexmock(AsyncErrataAPI).should_receive("__init__").and_return(None)
     flexmock(JIRABugTracker).should_receive("login").and_return(None)
     flexmock(JIRABugTracker).should_receive("get_bugs_map").with_args(
         ['bug-1', 'bug-2']).and_return(bug_map)
     flexmock(errata).should_receive(
         "get_jira_issue_from_advisory").with_args('12345').and_return([{
             'key':
             'bug-1'
         }, {
             'key':
             'bug-2'
         }])
     validator = BugValidator(runtime, True)
     advisory_bugs = await validator.get_attached_bugs(['12345'])
     self.assertEqual(advisory_bugs,
                      {'12345': {bug_map['bug-1'], bug_map['bug-2']}})
Exemplo n.º 5
0
    def test_get_and_verify_blocking_bugs(self):
        bv = BugValidator(self.runtime_fixture())
        bv.product = "OpenShift Container Platform"
        bv.target_releases = ['4.4.0', '4.4.z']
        bugs = bzutil.get_bugs(bv.bzapi,
                               [1875258, 1878798, 1881212, 1869790, 1840719])

        bbf = bv._get_blocking_bugs_for(list(bugs.values()))
        self.assertTrue(bbf[1875258], "CVE tracker with blocking bug")
        self.assertTrue(any(bug.id == 1875259 for bug in bbf[1875258]),
                        "1875259 blocks 1875258")
        self.assertTrue(bbf[1878798], "regular bug with blocking bug")
        self.assertTrue(any(bug.id == 1872337 for bug in bbf[1878798]),
                        "1872337 blocks 1878798")
        self.assertFalse(bbf[1881212], "placeholder bug w/o blocking")
        self.assertTrue(bbf[1869790],
                        "bug with several blocking bugs, one DUPLICATE")
        self.assertTrue(any(bug.id == 1868735 for bug in bbf[1869790]),
                        "DUPLICATE 1868735 blocks 1869790")
        self.assertTrue(all(bug.id != 1868158 for bug in bbf[1869790]),
                        "4.6 1868158 blocks 1869790")
        self.assertFalse(bbf[1840719], "bug with 4.6 blocking bug")

        # having acquired these bugs, might as well use them to test verification
        bv._verify_blocking_bugs(bbf)
        self.assertIn(
            "Regression possible: bug 1869790 is a backport of bug 1868735 which was CLOSED WONTFIX",
            bv.problems)
        for bug in [1875258, 1878798, 1881212, 1840719]:
            self.assertFalse(
                any(str(bug) in problem for problem in bv.problems),
                f"{bug} blocker status {bbf[bug]}")
Exemplo n.º 6
0
    def test_get_attached_filtered_bugs(self):
        # Create event loop
        loop = asyncio.get_event_loop()

        # Initialize validator
        bv = BugValidator(self.runtime_fixture())
        bv.product = "OpenShift Container Platform"
        bv.target_releases = ['4.5.0', '4.5.z']

        # Login with errata tool
        loop.run_until_complete(bv.errata_api.login())

        # Get attached bugs
        result = loop.run_until_complete(bv.get_attached_bugs([60089]))
        self.assertTrue(result, "Should find attached bugs")
        advisory_bugs = result[60089]

        # Filter bugs by release and product
        bugs = bv.filter_bugs_by_release(advisory_bugs)
        bugs = bv.filter_bugs_by_product(bugs)
        bug_ids = {bug.id for bug in bugs}

        # Check filtered bug IDs
        self.assertIn(1856529, bug_ids)  # security tracker
        self.assertNotIn(1858981, bug_ids)  # flaw bug
Exemplo n.º 7
0
    def test_get_and_verify_blocking_bugs(self):
        bv = BugValidator(self.runtime_fixture())
        bv.product = "OpenShift Container Platform"
        bv.target_releases = ['4.4.0', '4.4.z']
        bugs = bv.bug_tracker.get_bugs(
            [1875258, 1878798, 1881212, 1869790, 1840719])
        bug_blocking_map = bv._get_blocking_bugs_for(bugs)
        id_bug_map = {b.id: b for b in bug_blocking_map}
        bbf = lambda bugid: bug_blocking_map[id_bug_map[bugid]]

        self.assertTrue(bbf(1875258), "CVE tracker with blocking bug")
        self.assertTrue(any(bug.id == 1875259 for bug in bbf(1875258)),
                        "1875259 blocks 1875258")
        self.assertTrue(bbf(1878798), "regular bug with blocking bug")
        self.assertTrue(any(bug.id == 1872337 for bug in bbf(1878798)),
                        "1872337 blocks 1878798")
        self.assertFalse(bbf(1881212), "placeholder bug w/o blocking")
        self.assertTrue(bbf(1869790),
                        "bug with several blocking bugs, one DUPLICATE")
        self.assertTrue(any(bug.id == 1868735 for bug in bbf(1869790)),
                        "DUPLICATE 1868735 blocks 1869790")
        self.assertTrue(all(bug.id != 1868158 for bug in bbf(1869790)),
                        "4.6 1868158 blocks 1869790")
        self.assertFalse(bbf(1840719), "bug with 4.6 blocking bug")

        # having acquired these bugs, might as well use them to test verification
        bv._verify_blocking_bugs(bug_blocking_map)
        self.assertIn(
            "Regression possible: CLOSED bug 1869790 is a backport of bug 1881143 which was CLOSED WONTFIX",
            bv.problems)
        for bugid in [1875258, 1878798, 1881212, 1840719]:
            self.assertFalse(
                any(str(bugid) in problem for problem in bv.problems),
                f"{bugid} blocker status {bbf(bugid)}")
 def test_validator_target_release(self):
     runtime = MagicMock()
     flexmock(JIRABugTracker).should_receive("get_config").and_return({
         'target_release': ['4.9.z'],
         'product':
         'OpenShift Container Platform'
     })
     flexmock(AsyncErrataAPI).should_receive("__init__").and_return(None)
     flexmock(JIRABugTracker).should_receive("login").and_return(None)
     validator = BugValidator(runtime, True)
     self.assertEqual(validator.target_releases, ['4.9.z'])
Exemplo n.º 9
0
 def test_get_attached_filtered_bugs_problems(self):
     bv = BugValidator(self.runtime_fixture())
     bv.product = "OpenShift Container Platform"
     bv.target_releases = ['4.6.0', '4.6.z']
     bv._get_attached_filtered_bugs([60089])  # SHIPPED_LIVE RHSA
     self.assertTrue(bv.problems, "Should find version mismatch")
     self.assertTrue(any("1856529" in problem for problem in bv.problems),
                     "Should find version mismatch for 1856529")
Exemplo n.º 10
0
 def _test_get_attached_bugs(self):
     bugs = BugValidator(self.runtime_fixture())._get_attached_bugs([60085])
     self.assertEqual(20, len(bugs))
     self.assertIn(1812663, {bug.id for bug in bugs})
     print(f"{list(bugs)[0].product}")