Merge "Remove org_unknown git repo from single-client test config" into feature/zuulv3
diff --git a/tests/base.py b/tests/base.py
index 9c53846..d6c36a8 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -97,10 +97,11 @@
raise Exception("Timeout waiting for %s" % purpose)
-def simple_layout(path):
+def simple_layout(path, driver='gerrit'):
"""Specify a layout file for use by a test method.
:arg str path: The path to the layout file.
+ :arg str driver: The source driver to use, defaults to gerrit.
Some tests require only a very simple configuration. For those,
establishing a complete config directory hierachy is too much
@@ -116,7 +117,7 @@
"""
def decorator(test):
- test.__simple_layout__ = path
+ test.__simple_layout__ = (path, driver)
return test
return decorator
@@ -1485,7 +1486,7 @@
test_name = self.id().split('.')[-1]
test = getattr(self, test_name)
if hasattr(test, '__simple_layout__'):
- path = getattr(test, '__simple_layout__')
+ path, driver = getattr(test, '__simple_layout__')
else:
return False
@@ -1514,7 +1515,7 @@
f = tempfile.NamedTemporaryFile(dir=root, delete=False)
config = [{'tenant':
{'name': 'tenant-one',
- 'source': {'gerrit':
+ 'source': {driver:
{'config-projects': ['common-config'],
'untrusted-projects': untrusted_projects}}}}]
f.write(yaml.dump(config))
diff --git a/zuul/configloader.py b/zuul/configloader.py
index d8bd247..9ef33ea 100644
--- a/zuul/configloader.py
+++ b/zuul/configloader.py
@@ -238,7 +238,7 @@
'tags': to_list(str),
'branches': to_list(str),
'files': to_list(str),
- 'auth': to_list(auth),
+ 'auth': auth,
'irrelevant-files': to_list(str),
'nodes': vs.Any([node], str),
'timeout': int,
diff --git a/zuul/driver/gerrit/gerritconnection.py b/zuul/driver/gerrit/gerritconnection.py
index f266f2a..73979be 100644
--- a/zuul/driver/gerrit/gerritconnection.py
+++ b/zuul/driver/gerrit/gerritconnection.py
@@ -526,16 +526,16 @@
# Wait for the ref to show up in the repo
start = time.time()
while time.time() - start < self.replication_timeout:
- sha = self.getRefSha(project.name, ref)
+ sha = self.getRefSha(project, ref)
if old_sha != sha:
return True
time.sleep(self.replication_retry_interval)
return False
- def getRefSha(self, project_name, ref):
+ def getRefSha(self, project, ref):
refs = {}
try:
- refs = self.getInfoRefs(project_name)
+ refs = self.getInfoRefs(project)
except:
self.log.exception("Exception looking for ref %s" %
ref)
@@ -597,7 +597,7 @@
return changes
def getProjectBranches(self, project):
- refs = self.getInfoRefs(project.name)
+ refs = self.getInfoRefs(project)
heads = [str(k[len('refs/heads/'):]) for k in refs.keys()
if k.startswith('refs/heads/')]
return heads
@@ -731,9 +731,9 @@
raise Exception("Gerrit error executing %s" % command)
return (out, err)
- def getInfoRefs(self, project_name):
+ def getInfoRefs(self, project):
url = "%s/p/%s/info/refs?service=git-upload-pack" % (
- self.baseurl, project_name)
+ self.baseurl, project.name)
try:
data = urllib.request.urlopen(url).read()
except:
diff --git a/zuul/driver/gerrit/gerritreporter.py b/zuul/driver/gerrit/gerritreporter.py
index 0ade355..a855db3 100644
--- a/zuul/driver/gerrit/gerritreporter.py
+++ b/zuul/driver/gerrit/gerritreporter.py
@@ -33,7 +33,7 @@
(item.change, self.config, message))
changeid = '%s,%s' % (item.change.number, item.change.patchset)
item.change._ref_sha = source.getRefSha(
- item.change.project.name, 'refs/heads/' + item.change.branch)
+ item.change.project, 'refs/heads/' + item.change.branch)
return self.connection.review(item.change.project.name, changeid,
message, self.config)
diff --git a/zuul/lib/connections.py b/zuul/lib/connections.py
index ad9ef2c..262c7cb 100644
--- a/zuul/lib/connections.py
+++ b/zuul/lib/connections.py
@@ -70,7 +70,6 @@
def configure(self, config):
# Register connections from the config
- # TODO(jhesketh): import connection modules dynamically
connections = {}
sources = {}