diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-09-14 09:49:05 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-09-14 09:49:05 +0000 |
| commit | afe4209bb23dc3e5dbe0b2a1e8057ef8e9fb58ac (patch) | |
| tree | b751badb81caf1ef85e638b913abf9448e9c12a3 | |
| parent | 72b36949c749f397b174470159c0b1bf5387d030 (diff) | |
| parent | dd57e1df5ad3b55a942dd314e1b9e6efc905db1b (diff) | |
| download | kolla-afe4209bb23dc3e5dbe0b2a1e8057ef8e9fb58ac.tar.gz kolla-afe4209bb23dc3e5dbe0b2a1e8057ef8e9fb58ac.zip | |
Merge "Add iter function to change list into iterator"
| -rw-r--r-- | kolla/image/build.py | 2 | ||||
| -rw-r--r-- | kolla/tests/etc/default.conf | 1 | ||||
| -rw-r--r-- | kolla/tests/test_build.py | 26 |
3 files changed, 23 insertions, 6 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py index b400dbf9a..4f10a75d7 100644 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -868,7 +868,7 @@ class KollaWorker(object): return def list_children(images, ancestry): - children = six.next(ancestry.values()) + children = six.next(iter(ancestry.values())) for image in images: if image.status not in [STATUS_MATCHED]: continue diff --git a/kolla/tests/etc/default.conf b/kolla/tests/etc/default.conf index 933e1f8c4..214ca8841 100644 --- a/kolla/tests/etc/default.conf +++ b/kolla/tests/etc/default.conf @@ -8,3 +8,4 @@ type = git [profiles] default = image-base +all = image-base,image-child diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py index e76925960..515aa1ddd 100644 --- a/kolla/tests/test_build.py +++ b/kolla/tests/test_build.py @@ -21,9 +21,14 @@ from kolla.image import build from kolla.tests import base -FAKE_IMAGE = build.Image('image-base', 'image-base:latest', - '/fake/path', parent_name=None, - parent=None, status=build.STATUS_MATCHED) +FAKE_IMAGE = build.Image( + 'image-base', 'image-base:latest', + '/fake/path', parent_name=None, + parent=None, status=build.STATUS_MATCHED) +FAKE_IMAGE_CHILD = build.Image( + 'image-child', 'image-child:latest', + '/fake/path2', parent_name='image-base', + parent=FAKE_IMAGE, status=build.STATUS_MATCHED) class TasksTest(base.TestCase): @@ -142,7 +147,9 @@ class KollaWorkerTest(base.TestCase): super(KollaWorkerTest, self).setUp() image = FAKE_IMAGE.copy() image.status = None - self.images = [image] + image_child = FAKE_IMAGE_CHILD.copy() + image_child.status = None + self.images = [image, image_child] def test_supported_base_type(self): rh_base = ['fedora', 'centos', 'oraclelinux', 'rhel'] @@ -197,7 +204,7 @@ class KollaWorkerTest(base.TestCase): kolla.images = self.images kolla.filter_images() - self.assertEqual(1, len(self._get_matched_images(kolla.images))) + self.assertEqual(2, len(self._get_matched_images(kolla.images))) def test_pre_defined_exist_profile(self): # default profile include the fake image: image-base @@ -225,6 +232,15 @@ class KollaWorkerTest(base.TestCase): self.assertRaises(ValueError, kolla.filter_images) + @mock.patch('pprint.pprint') + def test_list_dependencies(self, pprint_mock): + self.conf.set_override('profile', ['all']) + kolla = build.KollaWorker(self.conf) + kolla.images = self.images + kolla.filter_images() + kolla.list_dependencies() + pprint_mock.assert_called_once_with(mock.ANY) + @mock.patch.object(build, 'run_build') class MainTest(base.TestCase): |
