mirror of
https://github.com/projectatomic/atomic.git
synced 2026-02-05 18:45:01 +01:00
When the repo namespaces are unknown and the registry is docker.io, the default value "library" should be used. This matters when specifying library images in the shortest form, e.g. "busybox:latest"; we would be fetching docker://docker.io/busybox:latest instead of docker://docker.io/library/busybox:latest. skopeo would normalize that when fetching anyway, but this makes the output more regular (which, in particular, matters for looking up registries.d/*.yaml entries) and more consistent with the “fully qualified domain(?) name” terminology. Most importantly, the docker/distribution reference recorded inside the signature should use the fully expanded form for maximum semantic clarity. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #937 Approved by: baude
28 lines
1.2 KiB
Python
28 lines
1.2 KiB
Python
import unittest
|
|
from Atomic import util
|
|
from Atomic import discovery
|
|
|
|
|
|
class TestAtomicUtil(unittest.TestCase):
|
|
IMAGE = 'docker.io/library/busybox:latest'
|
|
I_REGISTRY, I_REPO, I_IMAGE, I_TAG, _ = util.Decompose(IMAGE).all
|
|
|
|
def test_find_image_on_registry(self):
|
|
fq = 'docker.io/library/busybox:latest'
|
|
for img in ['docker.io/library/busybox:latest', 'docker.io/library/busybox', 'docker.io/busybox', 'busybox']:
|
|
registry, repo, image, tag, _ = util.Decompose(img).all
|
|
ri = discovery.RegistryInspect(registry=registry, repo=repo, image=image, tag=tag)
|
|
self.assertEqual(ri.find_image_on_registry(), fq)
|
|
|
|
def test_inspect(self):
|
|
ri = discovery.RegistryInspect(registry=self.I_REGISTRY,
|
|
repo=self.I_REPO,
|
|
image=self.I_IMAGE,
|
|
tag=self.I_TAG)
|
|
inspect_info = ri.inspect()
|
|
self.assertEqual(inspect_info['Name'], "{}/{}/{}".format(self.I_REGISTRY, self.I_REPO, self.I_IMAGE))
|
|
self.assertEqual(inspect_info['Tag'], self.I_TAG)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|