aboutsummaryrefslogtreecommitdiff
path: root/kolla/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2025-08-06 15:13:35 +0000
committerGerrit Code Review <review@openstack.org>2025-08-06 15:13:35 +0000
commit5563c32e652153e9e7856b2c01075c3cdf45403d (patch)
tree22772ccc1d3716d200495f8b79adb4f1380cd9f5 /kolla/tests
parentf25cf12455e3180dd422581c96e2a73df5d1d666 (diff)
parentddac7ca1ed393609b7bda8753db3598f1ae02648 (diff)
downloadkolla-5563c32e652153e9e7856b2c01075c3cdf45403d.tar.gz
kolla-5563c32e652153e9e7856b2c01075c3cdf45403d.zip
Merge "send empty X-Registry-Auth for anonymous pushes"
Diffstat (limited to 'kolla/tests')
-rw-r--r--kolla/tests/test_build.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py
index ca2faa056..deb2dfa10 100644
--- a/kolla/tests/test_build.py
+++ b/kolla/tests/test_build.py
@@ -81,10 +81,12 @@ class TasksTest(base.TestCase):
@mock.patch(engine_client)
def test_push_image(self, mock_client):
self.engine_client = mock_client
+ mock_client().api._auth_configs = {}
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
- self.image.canonical_name, decode=True, stream=True)
+ self.image.canonical_name,
+ decode=True, stream=True, auth_config={})
self.assertTrue(pusher.success)
@mock.patch.dict(os.environ, clear=True)
@@ -92,11 +94,13 @@ class TasksTest(base.TestCase):
def test_push_image_failure(self, mock_client):
"""failure on connecting Docker API"""
self.engine_client = mock_client
+ mock_client().api._auth_configs = {}
mock_client().images.push.side_effect = Exception
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
- self.image.canonical_name, decode=True, stream=True)
+ self.image.canonical_name,
+ decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)
@@ -105,11 +109,13 @@ class TasksTest(base.TestCase):
def test_push_image_failure_retry(self, mock_client):
"""failure on connecting Docker API, success on retry"""
self.engine_client = mock_client
+ mock_client().api._auth_configs = {}
mock_client().images.push.side_effect = [Exception, []]
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
- self.image.canonical_name, decode=True, stream=True)
+ self.image.canonical_name,
+ decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)
@@ -125,12 +131,14 @@ class TasksTest(base.TestCase):
def test_push_image_failure_error(self, mock_client):
"""Docker connected, failure to push"""
self.engine_client = mock_client
+ mock_client().api._auth_configs = {}
mock_client().images.push.return_value = [{'errorDetail': {'message':
'mock push fail'}}]
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
- self.image.canonical_name, decode=True, stream=True)
+ self.image.canonical_name,
+ decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)
@@ -139,12 +147,14 @@ class TasksTest(base.TestCase):
def test_push_image_failure_error_retry(self, mock_client):
"""Docker connected, failure to push, success on retry"""
self.engine_client = mock_client
+ mock_client().api._auth_configs = {}
mock_client().images.push.return_value = [{'errorDetail': {'message':
'mock push fail'}}]
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
- self.image.canonical_name, decode=True, stream=True)
+ self.image.canonical_name,
+ decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)