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