Skip to content
Snippets Groups Projects
Commit a833e4ce authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Ignore missing docker client in Docker system check

parent 6ccd90f4
No related branches found
No related tags found
No related merge requests found
0.9.1
0.9.2-dev
......@@ -137,6 +137,9 @@ def docker_images_check(*args, **kwargs):
hint='settings.{} = "{}"'.format(setting_name, image_tag),
id='arkindex.E006',
))
except FileNotFoundError:
# Docker is not available, ignore check
pass
return errors
......
# flake8: noqa
import os.path
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
GITLAB_APP_ID = '7a30e936b232b8ba17336a852aae51d942a4fb209019f4a7374f8d862a459461'
GITLAB_APP_SECRET = 'f16e90f028a7bbc307c4735ac5ff4756620c23b85296835b4120ea29d9946112'
SHELL_PLUS_POST_IMPORTS = [
('django.db.models', ('Value', )),
('django.db.models.functions', '*'),
('arkindex.documents.models', (
'ElementType',
'TranscriptionType',
'Right',
'PageType',
'PageDirection',
'PageComplement',
)),
('arkindex.dataimport.models', (
'DataImportMode',
'EventType',
)),
('arkindex.images.models', (
'ImageStatus',
)),
('arkindex.users.models', (
'OAuthStatus',
))
]
LOCAL_IMAGESERVER_ID = 4
INTERNAL_HOSTS = []
if not os.environ.get('PONOS_TASK'):
PONOS_DATA_DIR = os.path.join(BASE_DIR, '../../ponos/data')
......@@ -172,6 +172,33 @@ class ChecksTestCase(TestCase):
),
])
@patch('arkindex.project.checks.subprocess.run')
def test_docker_images_check_missing_client(self, run_mock):
"""
Test the Docker images check does not show errors if the Docker client is missing
"""
from arkindex.project.checks import docker_images_check
run_mock.side_effect = FileNotFoundError
with self.settings(ARKINDEX_APP_IMAGE='nope', ARKINDEX_ML_IMAGE='me-neither'):
self.assertListEqual(docker_images_check(), [])
self.assertEqual(run_mock.call_count, 2)
self.assertEqual(run_mock.call_args_list, [
call(
['docker', 'image', 'inspect', 'nope'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
check=True,
),
call(
['docker', 'image', 'inspect', 'me-neither'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
check=True,
),
])
@patch('arkindex.project.checks.parse_recipe')
def test_ponos_recipe_check(self, parse_mock):
from arkindex.project.checks import ponos_recipe_check
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment