Merge "Re-enable test_success_pattern as test_success_url" into feature/zuulv3
diff --git a/tests/base.py b/tests/base.py
index 9c76d43..02953f5 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -477,6 +477,9 @@
     def getGitUrl(self, project):
         return os.path.join(self.upstream_root, project.name)
 
+    def _getGitwebUrl(self, project, sha=None):
+        return self.getGitwebUrl(project, sha)
+
 
 class BuildHistory(object):
     def __init__(self, **kw):
diff --git a/tests/fixtures/config/single-tenant/git/layout-dont-ignore-ref-deletes/zuul.yaml b/tests/fixtures/config/single-tenant/git/layout-dont-ignore-ref-deletes/zuul.yaml
new file mode 100644
index 0000000..30e574a
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-dont-ignore-ref-deletes/zuul.yaml
@@ -0,0 +1,23 @@
+- pipeline:
+    name: post
+    manager: independent
+    source:
+      gerrit
+    trigger:
+      gerrit:
+        - event: ref-updated
+          ref: ^(?!refs/).*$
+          ignore-deletes: False
+
+- job:
+    name: project-post
+    nodes:
+      - name: static
+        image: ubuntu-xenial
+
+- project:
+    name: org/project
+    post:
+      jobs:
+        - project-post
+
diff --git a/tests/fixtures/layout-dont-ignore-deletes.yaml b/tests/fixtures/layout-dont-ignore-deletes.yaml
deleted file mode 100644
index 1cf3c71..0000000
--- a/tests/fixtures/layout-dont-ignore-deletes.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-includes:
-  - python-file: custom_functions.py
-
-pipelines:
-  - name: post
-    manager: IndependentPipelineManager
-    trigger:
-      gerrit:
-        - event: ref-updated
-          ref: ^(?!refs/).*$
-          ignore-deletes: False
-
-projects:
-  - name: org/project
-    post:
-      - project-post
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index 3104bf1..1ca0539 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -1004,7 +1004,6 @@
         self.assertEqual(C.reported, 2)
         self.assertEqual(len(self.history), 6)
 
-    @skip("Disabled for early v3 development")
     def test_post(self):
         "Test that post jobs run"
 
@@ -1027,7 +1026,6 @@
         self.assertEqual(len(self.history), 1)
         self.assertIn('project-post', job_names)
 
-    @skip("Disabled for early v3 development")
     def test_post_ignore_deletes(self):
         "Test that deleting refs does not trigger post jobs"
 
@@ -1050,12 +1048,10 @@
         self.assertEqual(len(self.history), 0)
         self.assertNotIn('project-post', job_names)
 
-    @skip("Disabled for early v3 development")
     def test_post_ignore_deletes_negative(self):
         "Test that deleting refs does trigger post jobs"
 
-        self.updateConfigLayout(
-            'tests/fixtures/layout-dont-ignore-deletes.yaml')
+        self.updateConfigLayout('layout-dont-ignore-ref-deletes')
         self.sched.reconfigure(self.config)
 
         e = {
diff --git a/zuul/launcher/client.py b/zuul/launcher/client.py
index 3776b7c..f789e85 100644
--- a/zuul/launcher/client.py
+++ b/zuul/launcher/client.py
@@ -32,20 +32,24 @@
     patchset = None
     oldrev = None
     newrev = None
+    refspec = None
     if hasattr(item.change, 'number'):
         number = item.change.number
         patchset = item.change.patchset
+        refspec = item.change.refspec
+        branch = item.change.branch
     elif hasattr(item.change, 'newrev'):
         oldrev = item.change.oldrev
         newrev = item.change.newrev
+        branch = item.change.ref
     connection_name = item.pipeline.source.connection.connection_name
     return dict(project=item.change.project.name,
                 url=item.pipeline.source.getGitUrl(
                     item.change.project),
                 connection_name=connection_name,
                 merge_mode=item.change.project.merge_mode,
-                refspec=item.change.refspec,
-                branch=item.change.branch,
+                refspec=refspec,
+                branch=branch,
                 ref=item.current_build_set.ref,
                 number=number,
                 patchset=patchset,
diff --git a/zuul/launcher/server.py b/zuul/launcher/server.py
index 2705f27..489869f 100644
--- a/zuul/launcher/server.py
+++ b/zuul/launcher/server.py
@@ -351,7 +351,11 @@
                 task.wait()
             self.log.debug("Job %s: git updates complete" % (job.unique,))
             merger = self._getMerger(jobdir.git_root)
-            commit = merger.mergeChanges(args['items'])  # noqa
+            merge_items = [i for i in args['items'] if i.get('refspec')]
+            if merge_items:
+                commit = merger.mergeChanges(merge_items)  # noqa
+            else:
+                commit = args['items'][-1]['newrev']  # noqa
 
             # TODOv3: Ansible the ansible thing here.
             self.prepareAnsibleFiles(jobdir, args)
diff --git a/zuul/model.py b/zuul/model.py
index 1408cf2..06639f1 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -1707,7 +1707,7 @@
         # elements are aspects of that job with different matchers
         # that override some attribute of the job.  These aspects all
         # inherit from the reference definition.
-        self.jobs = {}
+        self.jobs = {'noop': [Job('noop')]}
         self.nodesets = {}
 
     def getJob(self, name):