Merge "add board working group data handling"

This commit is contained in:
Zuul 2018-12-03 14:40:19 +00:00 committed by Gerrit Code Review
commit 34cc424278
2 changed files with 34 additions and 6 deletions

View File

@ -97,11 +97,13 @@ class Governance(object):
_projects_filename = 'reference/projects.yaml'
_tc_repos_filename = 'reference/technical-committee-repos.yaml'
_sigs_repos_filename = 'reference/sigs-repos.yaml'
_wgs_repos_filename = 'reference/foundation-board-repos.yaml'
def __init__(self, team_data, tc_data, sigs_data):
def __init__(self, team_data, tc_data, sigs_data, wgs_data):
self._team_data = team_data
self._tc_data = tc_data
self._sigs_data = sigs_data
self._wgs_data = wgs_data
team_data['Technical Committee'] = {
'deliverables': {
@ -116,6 +118,13 @@ class Governance(object):
for repo in sig_info
}
}
for wg_name, wg_info in wgs_data.items():
team_data[wg_name] = {
'deliverables': {
repo['repo'].partition('/')[-1]: {'repos': [repo['repo']]}
for repo in wg_info
}
}
self._teams = [Team(n, i) for n, i in self._team_data.items()]
@ -130,7 +139,10 @@ class Governance(object):
sigs_filename = os.path.join(repo_dir, cls._sigs_repos_filename)
sigs_data = _yamlutils.load_from_file(sigs_filename)
return cls(team_data, tc_data, sigs_data)
wgs_filename = os.path.join(repo_dir, cls._wgs_repos_filename)
wgs_data = _yamlutils.load_from_file(wgs_filename)
return cls(team_data, tc_data, sigs_data, wgs_data)
@classmethod
def from_remote_repo(cls, repo_url_base=REPO_URL_BASE):
@ -149,7 +161,12 @@ class Governance(object):
r = requests.get(sigs_url)
sigs_data = _yamlutils.loads(r.text)
return cls(team_data, tc_data, sigs_data)
wgs_url = REPO_URL_BASE + '/reference/foundation-board-repos.yaml'
LOG.debug('fetching WGs data from %s', wgs_url)
r = requests.get(wgs_url)
wgs_data = _yamlutils.loads(r.text)
return cls(team_data, tc_data, sigs_data, wgs_data)
def get_team(self, name):
for team in self._teams:

View File

@ -73,16 +73,27 @@ api:
- repo: openstack/api-sig
"""
_wgs_data_yaml = """
---
# List of repositories owned by Foundation board and subcommittes
Interop Working Group:
- repo: openstack/interop
- repo: openstack/refstack-client
- repo: openstack/refstack
- repo: openstack/python-tempestconf
"""
TEAM_DATA = _yamlutils.loads(_team_data_yaml)
TC_DATA = _yamlutils.loads(_tc_data_yaml)
SIGS_DATA = _yamlutils.loads(_sigs_data_yaml)
WGS_DATA = _yamlutils.loads(_wgs_data_yaml)
class TestGetRepoOwner(base.BaseTestCase):
def setUp(self):
super().setUp()
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA)
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA, WGS_DATA)
def test_repo_exists(self):
owner = self.gov.get_repo_owner(
@ -119,7 +130,7 @@ class TestGetRepositories(base.BaseTestCase):
def setUp(self):
super().setUp()
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA)
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA, WGS_DATA)
def test_by_team(self):
repos = self.gov.get_repositories(
@ -188,7 +199,7 @@ class TestGetTeam(base.BaseTestCase):
def setUp(self):
super().setUp()
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA)
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA, WGS_DATA)
def test_found(self):
team = self.gov.get_team('meta SIG')