summaryrefslogtreecommitdiff
path: root/tests/unit/test_openstack.py
diff options
context:
space:
mode:
authorK Jonathan Harker <Jonathan.Harker@ibm.com>2017-02-21 14:34:08 -0800
committerK Jonathan Harker <Jonathan.Harker@ibm.com>2017-02-23 17:27:24 -0800
commit2c1a62378af07dac675431388ba991e35438cb6d (patch)
treeda3c88c82a85d97ebcf292bf4ebe1e23a2663445 /tests/unit/test_openstack.py
parent447ecdb687c153d2b9ceafe534d78bae65acc1bc (diff)
downloadzuul-2c1a62378af07dac675431388ba991e35438cb6d.tar.gz
Add support for 'repos' job configuration
If a job configuration gives a list of repos, add them to the list of projects to update on the slave. Test using a mock openstack dsvm job which should clone both nova and keystone. Put this new mock job in the check pipeline rather than the gate pipeline to keep the build history small, and assert that both the launcher and the worker have cloned the project that did not trigger the job. Change-Id: I3ccf8713906d65cbd27929548499e81f798cea82
Diffstat (limited to 'tests/unit/test_openstack.py')
-rw-r--r--tests/unit/test_openstack.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/unit/test_openstack.py b/tests/unit/test_openstack.py
index d0c7ab216..670e578c7 100644
--- a/tests/unit/test_openstack.py
+++ b/tests/unit/test_openstack.py
@@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import os
+
from tests.base import AnsibleZuulTestCase
@@ -54,3 +56,45 @@ class TestOpenStack(AnsibleZuulTestCase):
"A should report start and success")
self.assertEqual(self.getJobFromHistory('python27').node,
'ubuntu-trusty')
+
+ def test_dsvm_keystone_repo(self):
+ self.launch_server.keep_jobdir = True
+ A = self.fake_gerrit.addFakeChange('openstack/nova', 'master', 'A')
+ self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
+ self.waitUntilSettled()
+
+ self.assertHistory([
+ dict(name='dsvm', result='SUCCESS', changes='1,1')])
+ build = self.getJobFromHistory('dsvm')
+
+ # Check that a change to nova triggered a keystone clone
+ launcher_git_dir = os.path.join(self.launcher_src_root,
+ 'openstack', 'keystone', '.git')
+ self.assertTrue(os.path.exists(launcher_git_dir),
+ msg='openstack/keystone should be cloned.')
+
+ jobdir_git_dir = os.path.join(build.jobdir.src_root,
+ 'openstack', 'keystone', '.git')
+ self.assertTrue(os.path.exists(jobdir_git_dir),
+ msg='openstack/keystone should be cloned.')
+
+ def test_dsvm_nova_repo(self):
+ self.launch_server.keep_jobdir = True
+ A = self.fake_gerrit.addFakeChange('openstack/keystone', 'master', 'A')
+ self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
+ self.waitUntilSettled()
+
+ self.assertHistory([
+ dict(name='dsvm', result='SUCCESS', changes='1,1')])
+ build = self.getJobFromHistory('dsvm')
+
+ # Check that a change to keystone triggered a nova clone
+ launcher_git_dir = os.path.join(self.launcher_src_root,
+ 'openstack', 'nova', '.git')
+ self.assertTrue(os.path.exists(launcher_git_dir),
+ msg='openstack/nova should be cloned.')
+
+ jobdir_git_dir = os.path.join(build.jobdir.src_root,
+ 'openstack', 'nova', '.git')
+ self.assertTrue(os.path.exists(jobdir_git_dir),
+ msg='openstack/nova should be cloned.')