Add the project under test to LIBS_FROM_GIT
This automatically always adds the project under test to LIBS_FROM_GIT which effectively makes the normal "tempest full" job the same as the "forward testing" job when it is applied to a library repo. Change-Id: Ibbdd8a86e0ff55f67bef73e08e693b34a61b24df
This commit is contained in:
parent
9fd9799805
commit
8e5f8c29b2
@ -22,11 +22,12 @@ Write the local.conf file for use by devstack
|
||||
|
||||
As a special case, the variable ``LIBS_FROM_GIT`` will be
|
||||
constructed automatically from the projects which appear in the
|
||||
``required-projects`` list defined by the job. To instruct
|
||||
devstack to install a library from source rather than pypi, simply
|
||||
add that library to the job's ``required-projects`` list. To
|
||||
override the automatically-generated value, set ``LIBS_FROM_GIT``
|
||||
in ``devstack_localrc`` to the desired value.
|
||||
``required-projects`` list defined by the job plus the project of
|
||||
the change under test. To instruct devstack to install a library
|
||||
from source rather than pypi, simply add that library to the job's
|
||||
``required-projects`` list. To override the
|
||||
automatically-generated value, set ``LIBS_FROM_GIT`` in
|
||||
``devstack_localrc`` to the desired value.
|
||||
|
||||
.. zuul:rolevar:: devstack_local_conf
|
||||
:type: dict
|
||||
|
@ -207,12 +207,13 @@ class PluginGraph(DependencyGraph):
|
||||
class LocalConf(object):
|
||||
|
||||
def __init__(self, localrc, localconf, base_services, services, plugins,
|
||||
base_dir, projects):
|
||||
base_dir, projects, project):
|
||||
self.localrc = []
|
||||
self.meta_sections = {}
|
||||
self.plugin_deps = {}
|
||||
self.base_dir = base_dir
|
||||
self.projects = projects
|
||||
self.project = project
|
||||
if plugins:
|
||||
self.handle_plugins(plugins)
|
||||
if services or base_services:
|
||||
@ -249,11 +250,15 @@ class LocalConf(object):
|
||||
if k == 'LIBS_FROM_GIT':
|
||||
lfg = True
|
||||
|
||||
if not lfg and self.projects:
|
||||
if not lfg and (self.projects or self.project):
|
||||
required_projects = []
|
||||
for project_name, project_info in self.projects.items():
|
||||
if project_info.get('required'):
|
||||
required_projects.append(project_info['short_name'])
|
||||
if self.projects:
|
||||
for project_name, project_info in self.projects.items():
|
||||
if project_info.get('required'):
|
||||
required_projects.append(project_info['short_name'])
|
||||
if self.project:
|
||||
if self.project['short_name'] not in required_projects:
|
||||
required_projects.append(self.project['short_name'])
|
||||
if required_projects:
|
||||
self.localrc.append('LIBS_FROM_GIT={}'.format(
|
||||
','.join(required_projects)))
|
||||
@ -291,6 +296,7 @@ def main():
|
||||
base_dir=dict(type='path'),
|
||||
path=dict(type='str'),
|
||||
projects=dict(type='dict'),
|
||||
project=dict(type='dict'),
|
||||
)
|
||||
)
|
||||
|
||||
@ -301,7 +307,8 @@ def main():
|
||||
p.get('services'),
|
||||
p.get('plugins'),
|
||||
p.get('base_dir'),
|
||||
p.get('projects'))
|
||||
p.get('projects'),
|
||||
p.get('project'))
|
||||
lc.write(p['path'])
|
||||
|
||||
module.exit_json()
|
||||
|
@ -57,7 +57,8 @@ class TestDevstackLocalConf(unittest.TestCase):
|
||||
p.get('services'),
|
||||
p.get('plugins'),
|
||||
p.get('base_dir'),
|
||||
p.get('projects'))
|
||||
p.get('projects'),
|
||||
p.get('project'))
|
||||
lc.write(p['path'])
|
||||
|
||||
plugins = []
|
||||
@ -120,17 +121,22 @@ class TestDevstackLocalConf(unittest.TestCase):
|
||||
'short_name': 'devstack-plugin',
|
||||
},
|
||||
}
|
||||
project = {
|
||||
'short_name': 'glance',
|
||||
}
|
||||
p = dict(base_services=[],
|
||||
base_dir='./test',
|
||||
path=os.path.join(self.tmpdir, 'test.local.conf'),
|
||||
projects=projects)
|
||||
projects=projects,
|
||||
project=project)
|
||||
lc = LocalConf(p.get('localrc'),
|
||||
p.get('local_conf'),
|
||||
p.get('base_services'),
|
||||
p.get('services'),
|
||||
p.get('plugins'),
|
||||
p.get('base_dir'),
|
||||
p.get('projects'))
|
||||
p.get('projects'),
|
||||
p.get('project'))
|
||||
lc.write(p['path'])
|
||||
|
||||
lfg = None
|
||||
@ -138,7 +144,7 @@ class TestDevstackLocalConf(unittest.TestCase):
|
||||
for line in f:
|
||||
if line.startswith('LIBS_FROM_GIT'):
|
||||
lfg = line.strip().split('=')[1]
|
||||
self.assertEqual('nova,oslo.messaging', lfg)
|
||||
self.assertEqual('nova,oslo.messaging,glance', lfg)
|
||||
|
||||
def test_overridelibs_from_git(self):
|
||||
"Test that LIBS_FROM_GIT can be overridden"
|
||||
@ -168,7 +174,8 @@ class TestDevstackLocalConf(unittest.TestCase):
|
||||
p.get('services'),
|
||||
p.get('plugins'),
|
||||
p.get('base_dir'),
|
||||
p.get('projects'))
|
||||
p.get('projects'),
|
||||
p.get('project'))
|
||||
lc.write(p['path'])
|
||||
|
||||
lfg = None
|
||||
|
@ -10,3 +10,4 @@
|
||||
local_conf: "{{ devstack_local_conf|default(omit) }}"
|
||||
base_dir: "{{ devstack_base_dir|default(omit) }}"
|
||||
projects: "{{ zuul.projects }}"
|
||||
project: "{{ zuul.project }}"
|
Loading…
Reference in New Issue
Block a user