| |
@@ -153,7 +153,7 @@
|
| |
self.patcher = helpers.Patcher(
|
| |
'freshmaker.lightblue.')
|
| |
|
| |
- self.dummy_image = ContainerImage.create({
|
| |
+ self.dummy_image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'completion_date': u'20170421T04:27:51.000-0400',
|
| |
@@ -180,7 +180,7 @@
|
| |
self.koji_read_config_patcher.stop()
|
| |
|
| |
def test_create(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'completion_date': '20151210T10:09:35.000-0500',
|
| |
@@ -194,7 +194,7 @@
|
| |
|
| |
def test_update_multi_arch(self):
|
| |
rpm_manifest_x86_64 = [{'rpms': [{'name': 'spam'}]}]
|
| |
- image_x86_64 = ContainerImage.create({
|
| |
+ image_x86_64 = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'architecture': 'amd64',
|
| |
'brew': {
|
| |
@@ -206,7 +206,7 @@
|
| |
})
|
| |
|
| |
rpm_manifest_s390x = [{'rpms': [{'name': 'maps'}]}]
|
| |
- image_s390x = ContainerImage.create({
|
| |
+ image_s390x = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'architecture': 's390x',
|
| |
'brew': {
|
| |
@@ -244,7 +244,7 @@
|
| |
})
|
| |
|
| |
def test_log_error(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
},
|
| |
@@ -366,7 +366,7 @@
|
| |
"Cannot resolve the container image: Expected exception.")
|
| |
|
| |
def test_resolve_content_sets_already_included_in_lb_response(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
@@ -384,7 +384,7 @@
|
| |
"lightblue_container_image")
|
| |
|
| |
def test_resolve_content_sets_no_repositories(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
@@ -403,7 +403,7 @@
|
| |
@patch('freshmaker.kojiservice.KojiService.get_task_request')
|
| |
def test_resolve_content_sets_no_repositories_children_set(
|
| |
self, get_task_request, get_build):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
@@ -414,14 +414,14 @@
|
| |
})
|
| |
self.assertTrue("content_sets" not in image)
|
| |
|
| |
- child1 = ContainerImage.create({
|
| |
+ child1 = ContainerImage({
|
| |
'_id': '1233828',
|
| |
'brew': {
|
| |
'build': 'child1-name-1-4-12.10',
|
| |
},
|
| |
})
|
| |
|
| |
- child2 = ContainerImage.create({
|
| |
+ child2 = ContainerImage({
|
| |
'_id': '1233828',
|
| |
'brew': {
|
| |
'build': 'child2-name-1-4-12.10',
|
| |
@@ -434,7 +434,7 @@
|
| |
self.assertEqual(image["content_sets"], ["foo", "bar"])
|
| |
|
| |
def test_resolve_content_sets_empty_repositories(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
@@ -451,7 +451,7 @@
|
| |
self.assertEqual(image["content_sets"], [])
|
| |
|
| |
def test_resolve_published(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
@@ -467,7 +467,7 @@
|
| |
include_rpm_manifest=False)
|
| |
|
| |
def test_resolve_published_unpublished(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
@@ -485,7 +485,7 @@
|
| |
self.assertEqual(image["rpm_manifest"], "x")
|
| |
|
| |
def test_resolve_published_not_image_in_lb(self):
|
| |
- image = ContainerImage.create({
|
| |
+ image = ContainerImage({
|
| |
'_id': '1233829',
|
| |
'brew': {
|
| |
'build': 'package-name-1-4-12.10',
|
| |
@@ -735,19 +735,19 @@
|
| |
]
|
| |
|
| |
self.fake_container_images = [
|
| |
- ContainerImage.create(data)
|
| |
+ ContainerImage(data)
|
| |
for data in self.fake_images_with_parsed_data]
|
| |
|
| |
self.fake_container_images_floating_tag = [
|
| |
- ContainerImage.create(data)
|
| |
+ ContainerImage(data)
|
| |
for data in self.fake_images_with_parsed_data_floating_tag]
|
| |
|
| |
self.fake_images_with_modules = [
|
| |
- ContainerImage.create(data)
|
| |
+ ContainerImage(data)
|
| |
for data in self.fake_images_with_modules]
|
| |
|
| |
self.fake_container_images_with_parent_brew_build = [
|
| |
- ContainerImage.create(data)
|
| |
+ ContainerImage(data)
|
| |
for data in self.fake_images_with_parent_brew_build]
|
| |
|
| |
self.fake_koji_builds = [{"task_id": 654321}, {"task_id": 123456}]
|
| |
@@ -1230,7 +1230,7 @@
|
| |
cont_repos.return_value = self.fake_repositories_with_content_sets
|
| |
# "filtered_x-1-23" image will be filtered by filter_fnc.
|
| |
cont_images.return_value = self.fake_container_images + [
|
| |
- ContainerImage.create(
|
| |
+ ContainerImage(
|
| |
{"content_sets": ["dummy-content-set-1"],
|
| |
"brew": {"build": "filtered_x-1-23"},
|
| |
"repositories": [
|
| |
@@ -1323,7 +1323,7 @@
|
| |
|
| |
# "filtered_x-1-23" image will be filtered by filter_fnc.
|
| |
cont_images.return_value = self.fake_container_images + [
|
| |
- ContainerImage.create(
|
| |
+ ContainerImage(
|
| |
{
|
| |
"content_sets": ["dummy-content-set-1"],
|
| |
"brew": {"build": "filtered_x-1-23"},
|
| |
@@ -1460,7 +1460,7 @@
|
| |
# set, it will take the content_sets from the child image.
|
| |
images_without_repositories = []
|
| |
for data in self.fake_images_with_parsed_data:
|
| |
- img = ContainerImage.create(data)
|
| |
+ img = ContainerImage(data)
|
| |
del img["repositories"]
|
| |
images_without_repositories.append(img)
|
| |
|
| |
@@ -1495,7 +1495,7 @@
|
| |
# set, it will take the content_sets from the child image.
|
| |
images_without_repositories = []
|
| |
for data in self.fake_images_with_parsed_data:
|
| |
- img = ContainerImage.create(data)
|
| |
+ img = ContainerImage(data)
|
| |
del img["repositories"]
|
| |
images_without_repositories.append(img)
|
| |
|
| |
@@ -1528,62 +1528,62 @@
|
| |
find_images_with_packages_from_content_set):
|
| |
exists.return_value = True
|
| |
|
| |
- image_a = ContainerImage.create({
|
| |
+ image_a = ContainerImage({
|
| |
'brew': {'package': 'image-a', 'build': 'image-a-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-a-commit'
|
| |
})
|
| |
- image_b = ContainerImage.create({
|
| |
+ image_b = ContainerImage({
|
| |
'brew': {'package': 'image-b', 'build': 'image-b-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-b-commit',
|
| |
'parent': image_a,
|
| |
})
|
| |
- image_c = ContainerImage.create({
|
| |
+ image_c = ContainerImage({
|
| |
'brew': {'package': 'image-c', 'build': 'image-c-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-c-commit',
|
| |
'parent': image_b,
|
| |
})
|
| |
- image_e = ContainerImage.create({
|
| |
+ image_e = ContainerImage({
|
| |
'brew': {'package': 'image-e', 'build': 'image-e-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-e-commit',
|
| |
'parent': image_a,
|
| |
})
|
| |
- image_d = ContainerImage.create({
|
| |
+ image_d = ContainerImage({
|
| |
'brew': {'package': 'image-d', 'build': 'image-d-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-d-commit',
|
| |
'parent': image_e,
|
| |
})
|
| |
- image_j = ContainerImage.create({
|
| |
+ image_j = ContainerImage({
|
| |
'brew': {'package': 'image-j', 'build': 'image-j-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-j-commit',
|
| |
'parent': image_e,
|
| |
})
|
| |
- image_k = ContainerImage.create({
|
| |
+ image_k = ContainerImage({
|
| |
'brew': {'package': 'image-k', 'build': 'image-k-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-k-commit',
|
| |
'parent': image_j,
|
| |
})
|
| |
- image_g = ContainerImage.create({
|
| |
+ image_g = ContainerImage({
|
| |
'brew': {'package': 'image-g', 'build': 'image-g-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'image-g-commit',
|
| |
'parent': None,
|
| |
})
|
| |
- image_f = ContainerImage.create({
|
| |
+ image_f = ContainerImage({
|
| |
'brew': {'package': 'image-f', 'build': 'image-f-v-r1'},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
@@ -1591,49 +1591,49 @@
|
| |
'parent': image_g,
|
| |
})
|
| |
|
| |
- leaf_image1 = ContainerImage.create({
|
| |
+ leaf_image1 = ContainerImage({
|
| |
'brew': {'build': 'leaf-image-1-1'},
|
| |
'parsed_data': {'layers': ['fake layer']},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'leaf-image1-commit',
|
| |
})
|
| |
- leaf_image2 = ContainerImage.create({
|
| |
+ leaf_image2 = ContainerImage({
|
| |
'brew': {'build': 'leaf-image-2-1'},
|
| |
'parsed_data': {'layers': ['fake layer']},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'leaf-image2-commit',
|
| |
})
|
| |
- leaf_image3 = ContainerImage.create({
|
| |
+ leaf_image3 = ContainerImage({
|
| |
'brew': {'build': 'leaf-image-3-1'},
|
| |
'parsed_data': {'layers': ['fake layer']},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'leaf-image3-commit',
|
| |
})
|
| |
- leaf_image4 = ContainerImage.create({
|
| |
+ leaf_image4 = ContainerImage({
|
| |
'brew': {'build': 'leaf-image-4-1'},
|
| |
'parsed_data': {'layers': ['fake layer']},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'leaf-image4-commit',
|
| |
})
|
| |
- leaf_image5 = ContainerImage.create({
|
| |
+ leaf_image5 = ContainerImage({
|
| |
'brew': {'build': 'leaf-image-5-1'},
|
| |
'parsed_data': {'layers': ['fake layer']},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'leaf-image5-commit',
|
| |
})
|
| |
- leaf_image6 = ContainerImage.create({
|
| |
+ leaf_image6 = ContainerImage({
|
| |
'brew': {'build': 'leaf-image-6-1'},
|
| |
'parsed_data': {'layers': ['fake layer']},
|
| |
'repositories': [{"repository": "foo/bar"}],
|
| |
'repository': 'repo-1',
|
| |
'commit': 'leaf-image6-commit',
|
| |
})
|
| |
- leaf_image7 = ContainerImage.create({
|
| |
+ leaf_image7 = ContainerImage({
|
| |
'brew': {'build': 'leaf-image-7-1'},
|
| |
'parsed_data': {'layers': ['fake layer']},
|
| |
'repositories': [{'repository': 'foo/bar'}],
|
| |
@@ -1656,7 +1656,7 @@
|
| |
find_images_with_packages_from_content_set.return_value = images
|
| |
|
| |
leaf_image6_as_parent = copy.deepcopy(leaf_image6)
|
| |
- leaf_image6_as_parent['parent'] = image_f
|
| |
+ leaf_image6_as_parent.parent = image_f
|
| |
# When the image is a parent, directly_affected is not set
|
| |
del leaf_image6_as_parent["directly_affected"]
|
| |
find_parent_images_with_package.side_effect = [
|
| |
@@ -1739,7 +1739,7 @@
|
| |
find_images_with_packages_from_content_set, cont_images):
|
| |
exists.return_value = True
|
| |
|
| |
- image_a = ContainerImage.create({
|
| |
+ image_a = ContainerImage({
|
| |
"brew": {"package": "image-a", "build": "image-a-v-r1"},
|
| |
"parent_brew_build": "some-original-nvr-7.6-252.1561619826",
|
| |
"repository": "repo-1",
|
| |
@@ -1789,16 +1789,16 @@
|
| |
}]
|
| |
}
|
| |
|
| |
- directly_affected_ubi_image = ContainerImage.create(copy.deepcopy(ubi_image_template))
|
| |
+ directly_affected_ubi_image = ContainerImage(copy.deepcopy(ubi_image_template))
|
| |
|
| |
dependency_ubi_image_data = copy.deepcopy(ubi_image_template)
|
| |
dependency_ubi_image_nvr = directly_affected_ubi_image.nvr + ".12345678"
|
| |
dependency_ubi_image_data["brew"]["build"] = dependency_ubi_image_nvr
|
| |
# A dependecy image is not directly published
|
| |
dependency_ubi_image_data["repositories"] = []
|
| |
- dependency_ubi_image = ContainerImage.create(dependency_ubi_image_data)
|
| |
+ dependency_ubi_image = ContainerImage(dependency_ubi_image_data)
|
| |
|
| |
- python_image = ContainerImage.create({
|
| |
+ python_image = ContainerImage({
|
| |
"brew": {"package": "python-36-container", "build": "python-36-container-1-10"},
|
| |
"parent_brew_build": directly_affected_ubi_image.nvr,
|
| |
"parent_image_builds": {},
|
| |
@@ -1812,7 +1812,7 @@
|
| |
}]
|
| |
})
|
| |
|
| |
- nodejs_image = ContainerImage.create({
|
| |
+ nodejs_image = ContainerImage({
|
| |
"brew": {"package": "nodejs-12-container", "build": "nodejs-12-container-1-20.45678"},
|
| |
"parent_brew_build": dependency_ubi_image.nvr,
|
| |
"repository": "containers/nodejs-12",
|
| |
@@ -2029,7 +2029,7 @@
|
| |
'architecture': 's390x'
|
| |
}
|
| |
]
|
| |
- new_images = [ContainerImage.create(i) for i in new_images]
|
| |
+ new_images = [ContainerImage(i) for i in new_images]
|
| |
find_repos.return_value = self.fake_repositories_with_content_sets
|
| |
find_images.return_value = self.fake_container_images + new_images
|
| |
right_content_sets = [["dummy-content-set-1"],
|
| |
@@ -2088,13 +2088,13 @@
|
| |
repositories = {
|
| |
repo["repository"]: repo for repo in
|
| |
self.fake_repositories_with_content_sets}
|
| |
- parent = ContainerImage.create({
|
| |
+ parent = ContainerImage({
|
| |
"brew": {"build": "parent-1-2"}, "repositories": repos,
|
| |
"content_sets": ["dummy-content-set-1"]})
|
| |
- latest_parent = ContainerImage.create({
|
| |
+ latest_parent = ContainerImage({
|
| |
"brew": {"build": "parent-1-3"}, "repositories": repos,
|
| |
"content_sets": ["dummy-content-set-1"]})
|
| |
- older_parent = ContainerImage.create({
|
| |
+ older_parent = ContainerImage({
|
| |
"brew": {"build": "parent-1-1"}, "repositories": repos,
|
| |
"content_sets": ["dummy-content-set-2"]})
|
| |
cont_images.return_value = [parent, latest_parent, older_parent]
|
| |
@@ -2181,7 +2181,7 @@
|
| |
self.os_path_exists_patcher.stop()
|
| |
|
| |
def _create_img(self, nvr):
|
| |
- return ContainerImage.create({
|
| |
+ return ContainerImage({
|
| |
'brew': {'build': nvr},
|
| |
'content_sets': [],
|
| |
'content_sets_source': 'distgit',
|
| |
@@ -2198,7 +2198,7 @@
|
| |
else:
|
| |
image = self._create_img(data)
|
| |
if images:
|
| |
- images[len(images) - 1]['parent'] = image
|
| |
+ images[len(images) - 1].parent = image
|
| |
images.append(image)
|
| |
return images
|
| |
|
| |
Can you update this? because
dict
expect at most one argument, and it can accept either one argument or name=value pairs, but not both.