I tried to comment this one heavily, so will skip the initial comment. Just read the code :).
For this test, I think build of each leaf_image* should be adjusted instead of changing this expected result, because those existing NVRs are not actual NVRs. For example, leaf-image-4 could be changed to leaf-image-4-1.0-1 and etc.
leaf_image*
leaf-image-4
leaf-image-4-1.0-1
Another blank line is required.
Would it be easy to understand with just x and y?
x
y
Through this method, name image_id and parent_id are only used to locate an image in the batch to_rebuild. Maybe simple name x and y would be more straightforward to represent the intention. Especially for the line nvr_to_coordinates[nvr] = [image_id, parent_id].
image_id
parent_id
to_rebuild
nvr_to_coordinates[nvr] = [image_id, parent_id]
There is no problem with using image_id and parent_id. I just would like to share my thought on the naming. :)
Remove this continue?
continue
Why there could be a s2i-base-1-1 in LightBlue which is built based on different NVRs s2i-core-1-1 and s2i-core-1-2?
s2i-base-1-1
s2i-core-1-1
s2i-core-1-2
How about move this outside top-level for-loop? To make call to sort len(nv_to_nvrs) times.
sort
len(nv_to_nvrs)
Yeah, it should be different s2i-base version. I will fix it, but it does not make the test work differently.
I have tried to use x and y now, but I find the image_id/parent_id more descriptive when it comes to this line:
# And in case this image is not the the leaf image, also replace # the ["parent"] record for the child image to point to the image # with highest NVR. if parent_id != 0: to_rebuild[image_id][parent_id - 1]["parent"] = nvr_to_image[latest_nvr]
Although I agree x and y are more consistent with the "coordinates" name I chose...
rebased onto 351d8139e2f595285a8586d952c3cbe3aa207666
+1
Commit d4bca471 fixes this pull-request
Pull-Request has been merged by jkaluza
I tried to comment this one heavily, so will skip the initial comment. Just read the code :).