Specify patterns to parse CI results

Change-Id: Ie236772ae10ef6f165fa2a3951fbbcdb99183b29
This commit is contained in:
Ilya Shakhat 2014-05-13 15:31:24 +04:00
parent 889fb8fd7b
commit 0435f06cbb
3 changed files with 97 additions and 12 deletions

View File

@ -87,16 +87,18 @@ def process_reviews(review_iterator, ci_ids_map, project_id):
# try to get result by parsing comment message
success_pattern = one_ci.get('success_pattern')
failure_pattern = one_ci.get('failure_pattern')
result = None
if success_pattern and re.search(success_pattern, message):
result = True
elif failure_pattern and re.search(failure_pattern, message):
result = False
# try to get result from vote
if not result:
if result is None:
result = find_vote(review, ci_id)
if result:
if result is not None:
yield {
(project_id,
one_ci['vendor'].lower(),

View File

@ -541,7 +541,9 @@
],
"wiki": "http://docs.openstack.org/trunk/config-reference/content/networking-plugin-ml2_bigswitch.html",
"ci": {
"id": "bsn"
"id": "bsn",
"success_pattern": "BigSwitch-ML2-Driver \\S+ : SUCCESS",
"failure_pattern": "BigSwitch-ML2-Driver \\S+ : FAILURE"
},
"releases": ["Icehouse"]
},
@ -559,7 +561,9 @@
],
"wiki": "http://www.openflowhub.org/display/floodlightcontroller/OpenStack",
"ci": {
"id": "bsn"
"id": "bsn",
"success_pattern": "BigSwitch-Plugin \\S+ : SUCCESS",
"failure_pattern": "BigSwitch-Plugin \\S+ : FAILURE"
},
"releases": ["Folsom", "Grizzly", "Havana", "Icehouse"]
},
@ -613,7 +617,9 @@
"wiki": "https://wiki.openstack.org/wiki/Neutron/ML2/MechCiscoNexus",
"releases": ["Havana", "Icehouse"],
"ci": {
"id": "cisco_neutron_ci"
"id": "cisco_neutron_ci",
"success_pattern": "neutron_zuul \\S+ : SUCCESS",
"failure_pattern": "neutron_zuul \\S+ : FAILURE"
}
},
{
@ -630,7 +636,9 @@
"wiki": "https://wiki.openstack.org/wiki/Cisco-neutron",
"releases": ["Grizzly", "Havana", "Icehouse"],
"ci": {
"id": "cisco_neutron_ci"
"id": "cisco_neutron_ci",
"success_pattern": "neutron_zuul \\S+ : SUCCESS",
"failure_pattern": "neutron_zuul \\S+ : FAILURE"
}
},
{
@ -652,7 +660,9 @@
],
"wiki": "http://www.cloudbase.it/quantum-hyper-v-plugin/",
"ci": {
"id": "hyper-v-ci"
"id": "hyper-v-ci",
"success_pattern": "Build succeeded",
"failure_pattern": "Build failed"
},
"releases": ["Grizzly", "Havana", "Icehouse"]
},
@ -733,7 +743,9 @@
"wiki": "https://wiki.openstack.org/wiki/Mellanox-Neutron",
"releases": ["Havana", "Icehouse"],
"ci": {
"id": "mellanox"
"id": "mellanox",
"success_pattern": "Check-MLNX-Neutron-plugin \\S+ : SUCCESS",
"failure_pattern": "Check-MLNX-Neutron-plugin \\S+ : FAILURE"
}
},
{
@ -750,7 +762,9 @@
"wiki": "https://wiki.openstack.org/wiki/Mellanox-Neutron-ML2",
"releases": ["Icehouse", "Juno"],
"ci": {
"id": "mellanox"
"id": "mellanox",
"success_pattern": "Check-MLNX-Neutron-ML2-driver \\S+ : SUCCESS",
"failure_pattern": "Check-MLNX-Neutron-ML2-driver \\S+ : FAILURE"
}
},
{
@ -784,7 +798,9 @@
],
"wiki": "https://wiki.openstack.org/wiki/Neutron/NEC_OpenFlow_Plugin",
"ci": {
"id": "nec-openstack-ci"
"id": "nec-openstack-ci",
"success_pattern": "Build succeed",
"failure_pattern": "Build failed"
}
},
{
@ -1144,7 +1160,12 @@
"launchpad_id": "slukjanov"
}
],
"wiki": "http://docs.openstack.org/developer/sahara/userdoc/hdp_plugin.html"
"wiki": "http://docs.openstack.org/developer/sahara/userdoc/hdp_plugin.html",
"ci": {
"id": "savanna-ci",
"success_pattern": "gate-sahara-integration-hdp \\S+ : SUCCESS",
"failure_pattern": "gate-sahara-integration-hdp \\S+ : FAILURE"
}
},
{
"project_id": "openstack/sahara",
@ -1160,7 +1181,9 @@
],
"wiki": "http://docs.openstack.org/developer/sahara/userdoc/vanilla_plugin.html",
"ci": {
"id": "savanna-ci"
"id": "savanna-ci",
"success_pattern": "gate-sahara-integration-vanilla1 \\S+ : SUCCESS",
"failure_pattern": "gate-sahara-integration-vanilla1 \\S+ : FAILURE"
}
}
]

View File

@ -0,0 +1,60 @@
# Copyright (c) 2014 Mirantis Inc.
#
# 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 json
from driverlog.processor import main
import testtools
class TestCIConfigValidity(testtools.TestCase):
"""
This test verifies correctness of CI configuration in default_data.
The test should be updated once driver name changes.
sample_review.json needs update if a new driver is added.
"""
def setUp(self):
super(TestCIConfigValidity, self).setUp()
with open('tests/unit/test_data/sample_review.json') as fd:
self.review = json.load(fd)
with open('etc/default_data.json') as fd:
self.default_data = json.load(fd)
def test_ci_config_matches_sample_review(self):
def verify_single_driver(driver_name):
ci_ids_map = main.build_ci_map(self.default_data['drivers'])
records = list(main.process_reviews(
[self.review], ci_ids_map, 'openstack/neutron'))
records = [r for r in records
if r.keys()[0][2] == driver_name.lower()]
self.assertEqual(1, len(records), '1 record is expected for '
'driver %s' % driver_name)
verify_single_driver('Cisco Nexus Plugin')
verify_single_driver('Neutron ML2 Driver For Cisco Nexus Devices')
verify_single_driver('Mellanox Neutron Plugin')
verify_single_driver('Mellanox Neutron ML2 Driver')
verify_single_driver('Big Switch Controller Plugin')
verify_single_driver('Big Switch Neutron ML2 Driver')
verify_single_driver('VMware NSX Network Virtualization Platform '
'Plugin')
verify_single_driver('Arista Neutron ML2 Driver')
verify_single_driver('Ryu OpenFlow Controller Plugin')
verify_single_driver('PLUMgrid Plugin')
verify_single_driver('NEC OpenFlow Plugin')
verify_single_driver('Cloudbase Hyper-V Plugin')