TT#18821 don't set release_target for non-NGCP projects

Change-Id: Ibfd4b3080a14d7cbe7bf6d4e18110106f1221f91
changes/60/14360/2
Victor Seva 9 years ago committed by Víctor Seva
parent 73835bb12f
commit 6355f31280

@ -0,0 +1,24 @@
# Copyright (C) 2017 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this prograproj. If not, see <http://www.gnu.org/licenses/>.
from django.test import TestCase
from release_dashboard.utils import build
class UtilsBuildTestCase(TestCase):
def test_is_ngcp_project(self):
self.assertFalse(build.is_ngcp_project('fake'))
self.assertTrue(build.is_ngcp_project('kamailio'))

@ -117,3 +117,10 @@ def get_gerrit_tags(project, regex=None):
def get_gerrit_branches(project, regex=None):
url = settings.GERRIT_URL.format("a/projects/%s/branches/" % project)
return get_gerrit_info(url)
def is_ngcp_project(projectname):
ngcp_projects = settings.RELEASE_DASHBOARD_SETTINGS['projects']
if projectname in ngcp_projects:
return True
return False

@ -18,6 +18,7 @@ import re
from django.db import models
from django.conf import settings
from repoapi import utils
from release_dashboard.utils.build import is_ngcp_project
logger = logging.getLogger(__name__)
workfront_re = re.compile(r"TT#(\d+)")
@ -60,6 +61,10 @@ class WorkfrontNoteInfo(models.Model):
def workfront_release_target(instance, wid):
if not is_ngcp_project(instance.projectname):
logger.info("%s not a NGCP project, skip release_target",
instance.projectname)
return
branch = instance.param_branch
if workfront_re_branch.search(branch):
release = branch

@ -272,3 +272,34 @@ class WorkfrontNoteTestCase(BaseTest):
self.assertItemsEqual(wsrt.mock_calls, [])
wsrt.assert_not_called()
wns.assert_called_once_with("0001", msg)
@patch('repoapi.utils.workfront_set_release_target')
@patch('repoapi.utils.get_next_release')
@patch('repoapi.utils.workfront_note_send')
def test_note_commit_non_ngcp(self, wns, gnr, wsrt):
param = self.get_non_gerrit_defaults()
param['projectname'] = 'fake'
param['jobname'] = 'fake-get-code'
param['param_branch'] = 'mr5.5.2'
JenkinsBuildInfo.objects.create(**param)
gri = WorkfrontNoteInfo.objects.filter(
workfront_id="0001",
gerrit_change="7fg4567")
self.assertEquals(gri.count(), 1)
param['jobname'] = "fake-binaries"
param['buildnumber'] = 897
JenkinsBuildInfo.objects.create(**param)
gri = WorkfrontNoteInfo.objects.filter(
workfront_id="0001",
gerrit_change="7fg4567")
self.assertEquals(gri.count(), 1)
msg = "%s.git[%s] commit created %s " % (
param['projectname'],
param['param_branch'],
settings.GITWEB_URL.format("fake", "7fg4567"))
wsrt.assert_not_called()
gnr.assert_not_called()
wns.assert_called_once_with("0001", msg)

Loading…
Cancel
Save