James E. Blair | 6ac4c13 | 2016-08-24 10:42:29 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | # Copyright 2012 Hewlett-Packard Development Company, L.P. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | # not use this file except in compliance with the License. You may obtain |
| 7 | # a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | # License for the specific language governing permissions and limitations |
| 15 | # under the License. |
| 16 | |
| 17 | import logging |
| 18 | |
| 19 | from tests.base import AnsibleZuulTestCase |
| 20 | |
| 21 | logging.basicConfig(level=logging.DEBUG, |
| 22 | format='%(asctime)s %(name)-32s ' |
| 23 | '%(levelname)-8s %(message)s') |
| 24 | |
| 25 | |
| 26 | class TestOpenStack(AnsibleZuulTestCase): |
| 27 | # A temporary class to experiment with how openstack can use |
| 28 | # Zuulv3 |
| 29 | |
| 30 | tenant_config_file = 'config/openstack/main.yaml' |
| 31 | |
James E. Blair | 70911a7 | 2016-08-25 13:56:46 -0700 | [diff] [blame^] | 32 | def test_nova_master(self): |
James E. Blair | 6ac4c13 | 2016-08-24 10:42:29 -0700 | [diff] [blame] | 33 | A = self.fake_gerrit.addFakeChange('openstack/nova', 'master', 'A') |
| 34 | A.addApproval('code-review', 2) |
| 35 | self.fake_gerrit.addEvent(A.addApproval('approved', 1)) |
| 36 | self.waitUntilSettled() |
| 37 | self.assertEqual(self.getJobFromHistory('python27').result, |
| 38 | 'SUCCESS') |
| 39 | self.assertEqual(self.getJobFromHistory('python35').result, |
| 40 | 'SUCCESS') |
| 41 | self.assertEqual(A.data['status'], 'MERGED') |
| 42 | self.assertEqual(A.reported, 2, |
| 43 | "A should report start and success") |
James E. Blair | 70911a7 | 2016-08-25 13:56:46 -0700 | [diff] [blame^] | 44 | self.assertEqual(self.getJobFromHistory('python27').node, |
| 45 | 'ubuntu-xenial') |
| 46 | |
| 47 | def test_nova_mitaka(self): |
| 48 | self.create_branch('openstack/nova', 'stable/mitaka') |
| 49 | A = self.fake_gerrit.addFakeChange('openstack/nova', |
| 50 | 'stable/mitaka', 'A') |
| 51 | A.addApproval('code-review', 2) |
| 52 | self.fake_gerrit.addEvent(A.addApproval('approved', 1)) |
| 53 | self.waitUntilSettled() |
| 54 | self.assertEqual(self.getJobFromHistory('python27').result, |
| 55 | 'SUCCESS') |
| 56 | self.assertEqual(self.getJobFromHistory('python35').result, |
| 57 | 'SUCCESS') |
| 58 | self.assertEqual(A.data['status'], 'MERGED') |
| 59 | self.assertEqual(A.reported, 2, |
| 60 | "A should report start and success") |
| 61 | self.assertEqual(self.getJobFromHistory('python27').node, |
| 62 | 'ubuntu-trusty') |