Add support to suppress bot notifications

* Similar to suppress-graph

There are some gate failures that are expected and are real errors (such
as global-requirements mismatches in requirements jobs).
suppress-notifications allows us to classify these failures and remove
them from the unclassified page while not telling developers to recheck.

This can be used along with suppress-graph.

Change-Id: I6d905ba65e66e799a65598f8a5d5c3dd684feb8c
This commit is contained in:
Joe Gordon 2015-01-15 09:34:32 +13:00
parent a2e0edbcfc
commit 612d43f971
4 changed files with 46 additions and 0 deletions

View File

@ -60,6 +60,11 @@ Guidelines for good queries:
(build_name:"gate-nova-python26" OR build_name:"gate-nova-python27")
When adding queries you can optionally suppress the creation of graphs
and notifications by adding ``suppress-graph: true`` or
``suppress-notifcation: true`` to the yaml file. These can be used to make
sure expected failures don't show up on the unclassified page.
In order to support rapidly added queries, it's considered socially acceptable
to approve changes that only add 1 new bug query, and to even self approve
those changes by core reviewers.

View File

@ -385,6 +385,8 @@ class Classifier():
self.queries = loader.load(self.queries_dir)
bug_matches = []
for x in self.queries:
if x.get('suppress-notification'):
continue
self.log.debug(
"Looking for bug: https://bugs.launchpad.net/bugs/%s"
% x['bug'])

View File

@ -0,0 +1,8 @@
# this is a placeholder bug and should not be removed if there are no hits
query: >
message:"Requirement"
AND message:"does not match openstack/requirements value"
AND tags:"console"
AND build_queue:"gate"
suppress-graph: true
suppress-notification: true

View File

@ -0,0 +1,31 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from elastic_recheck import elasticRecheck
from elastic_recheck import tests
class TestSuppressNotifcation(tests.TestCase):
def setUp(self):
super(TestSuppressNotifcation, self).setUp()
self.classifier = elasticRecheck.Classifier(
"./elastic_recheck/tests/unit/suppressed_queries")
@mock.patch('elastic_recheck.query_builder.single_patch')
@mock.patch('elastic_recheck.results.SearchEngine.search')
def test_basic_parse(self, mock1, mock2):
self.classifier.classify(None, None, None)
self.assertFalse(mock1.called)
self.assertFalse(mock2.called)