From a04553ee89363a6ee0960a94f0c11961a0284fc9 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 12 Mar 2014 16:04:05 -0400 Subject: [PATCH] only care about unclassifieds in gate queue we really don't care about check failures for classification, because those might just be terrible code, which we get a lot of. So only report unclassified tests to the user on gate failures. Now with extra tests for this behavior! Change-Id: I52044afb4f3a1bf3f22ba4c0e8d38d76271ffc00 --- elastic_recheck/elasticRecheck.py | 8 ++- elastic_recheck/tests/unit/gerrit/events.json | 40 +++++++++++++++ elastic_recheck/tests/unit/test_stream.py | 49 +++++++++++++++++-- 3 files changed, 93 insertions(+), 4 deletions(-) diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index 160ec291..f13efe97 100644 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -134,7 +134,9 @@ class FailEvent(object): bug_map = {} for job in self.failed_jobs: if len(job.bugs) is 0: - bug_map[job.name] = None + # we only care about fails with missing bugs in the gate + if self.queue() == "gate": + bug_map[job.name] = None else: bug_map[job.name] = ', '.join(self.bug_urls(job.bugs)) bug_list = [] @@ -148,6 +150,10 @@ class FailEvent(object): def is_fully_classified(self): if self.get_all_bugs() is None: return True + # we consider anything that's not in the gate queue + # fully classified, because errors are expected + if self.queue() != "gate": + return True for job in self.failed_jobs: if len(job.bugs) is 0: return False diff --git a/elastic_recheck/tests/unit/gerrit/events.json b/elastic_recheck/tests/unit/gerrit/events.json index 7b086156..5cdb7b61 100644 --- a/elastic_recheck/tests/unit/gerrit/events.json +++ b/elastic_recheck/tests/unit/gerrit/events.json @@ -239,6 +239,46 @@ "subject": "Enhance auth tests for non-default default_domain_id" } }, + { + "comment": "Build failed. For information on how to proceed, see https:\/\/wiki.openstack.org\/wiki\/GerritJenkinsGit#Test_Failures\n\n- gate-keystone-pep8 http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-keystone-pep8\/16e0b97 : SUCCESS in 2m 25s\n- gate-keystone-docs http:\/\/docs-draft.openstack.org\/49\/64750\/6\/gate\/gate-keystone-docs\/77c8f7a\/doc\/build\/html\/ : SUCCESS in 5m 25s\n- gate-keystone-python26 http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-keystone-python26\/d3fd328 : FAILURE in 18m 04s\n- gate-keystone-python27 http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-keystone-python27\/5dd41fe : FAILURE in 10m 01s\n- gate-tempest-dsvm-full http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-tempest-dsvm-full\/fce905d : SUCCESS in 46m 00s\n- gate-tempest-dsvm-postgres-full http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-tempest-dsvm-postgres-full\/e5cd968 : SUCCESS in 53m 30s\n- gate-tempest-dsvm-neutron http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-tempest-dsvm-neutron\/0673b30 : SUCCESS in 37m 25s\n- gate-tempest-dsvm-large-ops http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-tempest-dsvm-large-ops\/bdc661a : SUCCESS in 13m 21s\n- gate-tempest-dsvm-neutron-large-ops http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-tempest-dsvm-neutron-large-ops\/991887c : SUCCESS in 12m 28s\n- gate-grenade-dsvm http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-grenade-dsvm\/d098069 : SUCCESS in 31m 05s\n- gate-swift-dsvm-functional http:\/\/logs.openstack.org\/49\/64750\/6\/gate\/gate-swift-dsvm-functional\/2f9377b : SUCCESS in 11m 56s\n", + "author": { + "username": "jenkins", + "name": "Jenkins" + }, + "approvals": [ + { + "type": "VRIF", + "description": "Verified", + "value": "-1" + } + ], + "patchSet": { + "createdOn": 1389378289, + "ref": "refs\/changes\/49\/64750\/6", + "number": "6", + "uploader": { + "username": "blk-u", + "name": "Brant Knudson", + "email": "bknudson@us.ibm.com" + }, + "revision": "06b14616cb2a11514b0c151cc213c1ab5cea324b" + }, + "type": "comment-added", + "change": { + "topic": "bug\/1265108", + "url": "https:\/\/review.openstack.org\/64750", + "number": "64750", + "project": "openstack\/keystone", + "branch": "master", + "owner": { + "username": "blk-u", + "name": "Brant Knudson", + "email": "bknudson@us.ibm.com" + }, + "id": "I890a1c798d7f4a8a345404cd7754708ab0d36651", + "subject": "Enhance auth tests for non-default default_domain_id" + } + }, { "comment": "Build succeeded.\n\n- gate-neutron-pep8 http:\/\/logs.openstack.org\/02\/65902\/3\/check\/gate-neutron-pep8\/0ef123c : SUCCESS in 2m 13s\n- gate-neutron-docs http:\/\/docs-draft.openstack.org\/02\/65902\/3\/check\/gate-neutron-docs\/4a7a2ce\/doc\/build\/html\/ : SUCCESS in 1m 43s\n- gate-neutron-python26 http:\/\/logs.openstack.org\/02\/65902\/3\/check\/gate-neutron-python26\/d3e596e : SUCCESS in 43m 38s\n- gate-neutron-python27 http:\/\/logs.openstack.org\/02\/65902\/3\/check\/gate-neutron-python27\/525acec : SUCCESS in 27m 10s\n- check-tempest-dsvm-neutron http:\/\/logs.openstack.org\/02\/65902\/3\/check\/check-tempest-dsvm-neutron\/469682a : SUCCESS in 35m 59s\n- check-tempest-dsvm-neutron-pg http:\/\/logs.openstack.org\/02\/65902\/3\/check\/check-tempest-dsvm-neutron-pg\/91e8f4f : SUCCESS in 37m 11s\n- check-tempest-dsvm-neutron-isolated http:\/\/logs.openstack.org\/02\/65902\/3\/check\/check-tempest-dsvm-neutron-isolated\/90021b9 : SUCCESS in 41m 27s\n- check-tempest-dsvm-neutron-pg-isolated http:\/\/logs.openstack.org\/02\/65902\/3\/check\/check-tempest-dsvm-neutron-pg-isolated\/7bc809a : SUCCESS in 45m 35s\n- gate-tempest-dsvm-neutron-large-ops http:\/\/logs.openstack.org\/02\/65902\/3\/check\/gate-tempest-dsvm-neutron-large-ops\/aea24f9 : SUCCESS in 15m 01s\n- check-grenade-dsvm-neutron http:\/\/logs.openstack.org\/02\/65902\/3\/check\/check-grenade-dsvm-neutron\/59354b6 : FAILURE in 20m 16s (non-voting)\n- check-devstack-dsvm-neutron http:\/\/logs.openstack.org\/02\/65902\/3\/check\/check-devstack-dsvm-neutron\/d347313 : FAILURE in 17m 10s (non-voting)\n", "author": { diff --git a/elastic_recheck/tests/unit/test_stream.py b/elastic_recheck/tests/unit/test_stream.py index 607921ee..2684d2c5 100644 --- a/elastic_recheck/tests/unit/test_stream.py +++ b/elastic_recheck/tests/unit/test_stream.py @@ -39,6 +39,24 @@ class TestStream(tests.TestCase): # there are currently 10 events in the stream, 3 are # failures + event = stream.get_failed_tempest() + self.assertEqual(event.change, 64750) + self.assertEqual(event.rev, 6) + self.assertEqual(event.project, "openstack/keystone") + self.assertEqual(event.name(), "64750,6") + self.assertEqual(event.url, "https://review.openstack.org/64750") + self.assertEqual(sorted(event.short_build_uuids()), + ["5dd41fe", "d3fd328"]) + self.assertTrue(event.is_openstack_project()) + self.assertEqual(event.queue(), "gate") + self.assertEqual(event.bug_urls(), None) + self.assertEqual(event.bug_urls_map(), None) + self.assertEqual(sorted(event.failed_job_names()), + ['gate-keystone-python26', + 'gate-keystone-python27']) + self.assertEqual(event.get_all_bugs(), None) + self.assertTrue(event.is_fully_classified()) + event = stream.get_failed_tempest() self.assertEqual(event.change, 64749) self.assertEqual(event.rev, 6) @@ -117,6 +135,32 @@ class TestStream(tests.TestCase): mock_data.return_value = True stream = elasticRecheck.Stream("", "", "") + event = stream.get_failed_tempest() + # Add bugs + for job in event.failed_jobs: + if job.name == 'gate-keystone-python26': + job.bugs = ['123456'] + self.assertEqual(event.change, 64750) + self.assertEqual(event.rev, 6) + self.assertEqual(event.project, "openstack/keystone") + self.assertEqual(event.name(), "64750,6") + self.assertEqual(event.url, "https://review.openstack.org/64750") + self.assertEqual(sorted(event.short_build_uuids()), + ["5dd41fe", "d3fd328"]) + self.assertTrue(event.is_openstack_project()) + self.assertEqual(event.queue(), "gate") + self.assertEqual(event.bug_urls(), + ['https://bugs.launchpad.net/bugs/123456']) + self.assertEqual(event.bug_urls_map(), + ['gate-keystone-python27: unrecognized error', + 'gate-keystone-python26: ' + 'https://bugs.launchpad.net/bugs/123456']) + self.assertEqual(sorted(event.failed_job_names()), + ['gate-keystone-python26', + 'gate-keystone-python27']) + self.assertEqual(event.get_all_bugs(), ['123456']) + self.assertFalse(event.is_fully_classified()) + event = stream.get_failed_tempest() # Add bugs for job in event.failed_jobs: @@ -134,11 +178,10 @@ class TestStream(tests.TestCase): self.assertEqual(event.bug_urls(), ['https://bugs.launchpad.net/bugs/123456']) self.assertEqual(event.bug_urls_map(), - ['gate-keystone-python27: unrecognized error', - 'gate-keystone-python26: ' + ['gate-keystone-python26: ' 'https://bugs.launchpad.net/bugs/123456']) self.assertEqual(sorted(event.failed_job_names()), ['gate-keystone-python26', 'gate-keystone-python27']) self.assertEqual(event.get_all_bugs(), ['123456']) - self.assertFalse(event.is_fully_classified()) + self.assertTrue(event.is_fully_classified())