Enable test_one_branch cloner test

This alters test_cloner to test the behavior of the executor, which,
in v3, performs the git repo preparation that is performed by the
cloner in v2.  These tests represent all of the ways we expect zuul
to be used with git repos in different kinds of jobs, so the test
is altered as little as possible.

A future change will rename the test file and class.

Change-Id: I4dc9aeb325e38c54b4150bcc8ac672096e2cadbc
diff --git a/tests/unit/test_cloner.py b/tests/unit/test_cloner.py
index e65904b..430f24e 100644
--- a/tests/unit/test_cloner.py
+++ b/tests/unit/test_cloner.py
@@ -19,44 +19,21 @@
 import os
 import shutil
 import time
+from unittest import skip
 
 import git
 
 import zuul.lib.cloner
 
-from tests.base import ZuulTestCase
+from tests.base import ZuulTestCase, simple_layout
 
 
 class TestCloner(ZuulTestCase):
+    tenant_config_file = 'config/single-tenant/main.yaml'
 
     log = logging.getLogger("zuul.test.cloner")
-    workspace_root = None
 
-    def setUp(self):
-        self.skip("Disabled for early v3 development")
-
-        super(TestCloner, self).setUp()
-        self.workspace_root = os.path.join(self.test_root, 'workspace')
-
-        self.updateConfigLayout(
-            'tests/fixtures/layout-cloner.yaml')
-        self.sched.reconfigure(self.config)
-        self.registerJobs()
-
-    def getWorkspaceRepos(self, projects):
-        repos = {}
-        for project in projects:
-            repos[project] = git.Repo(
-                os.path.join(self.workspace_root, project))
-        return repos
-
-    def getUpstreamRepos(self, projects):
-        repos = {}
-        for project in projects:
-            repos[project] = git.Repo(
-                os.path.join(self.upstream_root, project))
-        return repos
-
+    @skip("Disabled for early v3 development")
     def test_cache_dir(self):
         projects = ['org/project1', 'org/project2']
         cache_root = os.path.join(self.test_root, "cache")
@@ -140,16 +117,19 @@
         self.worker.release()
         self.waitUntilSettled()
 
+    @simple_layout('layouts/repo-checkout-two-project.yaml')
     def test_one_branch(self):
-        self.worker.hold_jobs_in_build = True
+        self.executor_server.hold_jobs_in_build = True
 
-        projects = ['org/project1', 'org/project2']
+        p1 = 'review.example.com/org/project1'
+        p2 = 'review.example.com/org/project2'
+        projects = [p1, p2]
         A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
         B = self.fake_gerrit.addFakeChange('org/project2', 'master', 'B')
-        A.addApproval('CRVW', 2)
-        B.addApproval('CRVW', 2)
-        self.fake_gerrit.addEvent(A.addApproval('APRV', 1))
-        self.fake_gerrit.addEvent(B.addApproval('APRV', 1))
+        A.addApproval('code-review', 2)
+        B.addApproval('code-review', 2)
+        self.fake_gerrit.addEvent(A.addApproval('approved', 1))
+        self.fake_gerrit.addEvent(B.addApproval('approved', 1))
 
         self.waitUntilSettled()
 
@@ -157,27 +137,17 @@
 
         upstream = self.getUpstreamRepos(projects)
         states = [
-            {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': str(upstream['org/project2'].commit('master')),
+            {p1: self.builds[0].parameters['ZUUL_COMMIT'],
+             p2: str(upstream[p2].commit('master')),
              },
-            {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': self.builds[1].parameters['ZUUL_COMMIT'],
+            {p1: self.builds[0].parameters['ZUUL_COMMIT'],
+             p2: self.builds[1].parameters['ZUUL_COMMIT'],
              },
         ]
 
         for number, build in enumerate(self.builds):
             self.log.debug("Build parameters: %s", build.parameters)
-            cloner = zuul.lib.cloner.Cloner(
-                git_base_url=self.upstream_root,
-                projects=projects,
-                workspace=self.workspace_root,
-                zuul_project=build.parameters.get('ZUUL_PROJECT', None),
-                zuul_branch=build.parameters['ZUUL_BRANCH'],
-                zuul_ref=build.parameters['ZUUL_REF'],
-                zuul_url=self.src_root,
-            )
-            cloner.execute()
-            work = self.getWorkspaceRepos(projects)
+            work = build.getWorkspaceRepos(projects)
             state = states[number]
 
             for project in projects:
@@ -186,12 +156,11 @@
                                   'Project %s commit for build %s should '
                                   'be correct' % (project, number))
 
-            shutil.rmtree(self.workspace_root)
-
-        self.worker.hold_jobs_in_build = False
-        self.worker.release()
+        self.executor_server.hold_jobs_in_build = False
+        self.executor_server.release()
         self.waitUntilSettled()
 
+    @skip("Disabled for early v3 development")
     def test_multi_branch(self):
         self.worker.hold_jobs_in_build = True
         projects = ['org/project1', 'org/project2',
@@ -262,6 +231,7 @@
         self.worker.release()
         self.waitUntilSettled()
 
+    @skip("Disabled for early v3 development")
     def test_upgrade(self):
         # Simulates an upgrade test
         self.worker.hold_jobs_in_build = True
@@ -442,6 +412,7 @@
         self.worker.release()
         self.waitUntilSettled()
 
+    @skip("Disabled for early v3 development")
     def test_project_override(self):
         self.worker.hold_jobs_in_build = True
         projects = ['org/project1', 'org/project2', 'org/project3',
@@ -528,6 +499,7 @@
         self.worker.release()
         self.waitUntilSettled()
 
+    @skip("Disabled for early v3 development")
     def test_periodic(self):
         self.worker.hold_jobs_in_build = True
         self.create_branch('org/project', 'stable/havana')
@@ -595,6 +567,7 @@
         self.worker.release()
         self.waitUntilSettled()
 
+    @skip("Disabled for early v3 development")
     def test_periodic_update(self):
         # Test that the merger correctly updates its local repository
         # before running a periodic job.
@@ -676,6 +649,7 @@
         self.worker.release()
         self.waitUntilSettled()
 
+    @skip("Disabled for early v3 development")
     def test_post_checkout(self):
         self.worker.hold_jobs_in_build = True
         project = "org/project1"
@@ -710,6 +684,7 @@
                           'be correct' % (project, 0))
         shutil.rmtree(self.workspace_root)
 
+    @skip("Disabled for early v3 development")
     def test_post_and_master_checkout(self):
         self.worker.hold_jobs_in_build = True
         projects = ["org/project1", "org/project2"]