summaryrefslogtreecommitdiffstats
path: root/qa/tasks/tests/test_cephadm.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /qa/tasks/tests/test_cephadm.py
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qa/tasks/tests/test_cephadm.py')
-rw-r--r--qa/tasks/tests/test_cephadm.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/qa/tasks/tests/test_cephadm.py b/qa/tasks/tests/test_cephadm.py
new file mode 100644
index 000000000..403d1915e
--- /dev/null
+++ b/qa/tasks/tests/test_cephadm.py
@@ -0,0 +1,70 @@
+from tasks import cephadm
+
+v1 = """
+[registries.search]
+registries = ['registry.access.redhat.com', 'registry.redhat.io', 'docker.io', 'quay.io']
+
+[registries.insecure]
+registries = []
+"""
+
+v2 = """
+unqualified-search-registries = ["registry.access.redhat.com", "registry.redhat.io", "docker.io", 'quay.io']
+
+[[registry]]
+prefix = "registry.access.redhat.com"
+location = "registry.access.redhat.com"
+insecure = false
+blocked = false
+
+[[registry]]
+prefix = "registry.redhat.io"
+location = "registry.redhat.io"
+insecure = false
+blocked = false
+
+[[registry]]
+prefix = "docker.io"
+location = "docker.io"
+insecure = false
+blocked = false
+
+[[registry.mirror]]
+location = "vossi04.front.sepia.ceph.com:5000"
+insecure = true
+
+[[registry]]
+prefix = "quay.io"
+location = "quay.io"
+insecure = false
+blocked = false
+"""
+
+expected = {
+ 'unqualified-search-registries': ['registry.access.redhat.com', 'registry.redhat.io',
+ 'docker.io', 'quay.io'],
+ 'registry': [
+ {'prefix': 'registry.access.redhat.com',
+ 'location': 'registry.access.redhat.com',
+ 'insecure': False,
+ 'blocked': False},
+ {'prefix': 'registry.redhat.io',
+ 'location': 'registry.redhat.io',
+ 'insecure': False,
+ 'blocked': False},
+ {'prefix': 'docker.io',
+ 'location': 'docker.io',
+ 'insecure': False,
+ 'blocked': False,
+ 'mirror': [{'location': 'vossi04.front.sepia.ceph.com:5000',
+ 'insecure': True}]},
+ {'prefix': 'quay.io',
+ 'location': 'quay.io',
+ 'insecure': False,
+ 'blocked': False}
+ ]
+}
+
+def test_add_mirror():
+ assert cephadm.registries_add_mirror_to_docker_io(v1, 'vossi04.front.sepia.ceph.com:5000') == expected
+ assert cephadm.registries_add_mirror_to_docker_io(v2, 'vossi04.front.sepia.ceph.com:5000') == expected