diff --git a/README.rst b/README.rst index d599048d..8f148e01 100644 --- a/README.rst +++ b/README.rst @@ -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. diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index 975da237..dd5271c5 100644 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -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']) diff --git a/elastic_recheck/tests/unit/suppressed_queries/1410969.yaml b/elastic_recheck/tests/unit/suppressed_queries/1410969.yaml new file mode 100644 index 00000000..079ab853 --- /dev/null +++ b/elastic_recheck/tests/unit/suppressed_queries/1410969.yaml @@ -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 diff --git a/elastic_recheck/tests/unit/test_suppress_notifications.py b/elastic_recheck/tests/unit/test_suppress_notifications.py new file mode 100644 index 00000000..22e03917 --- /dev/null +++ b/elastic_recheck/tests/unit/test_suppress_notifications.py @@ -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)