Skip to content

Commit c697fb6

Browse files
committed
ref(controller): remove REGISTRY_MODULE hack
1 parent 216fbb1 commit c697fb6

12 files changed

Lines changed: 15 additions & 33 deletions

File tree

controller/api/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,7 @@ def publish(self, source_version='latest'):
867867
source_tag = 'git-{}'.format(self.build.sha) if self.build.sha else source_version
868868
source_image = '{}:{}'.format(self.build.image, source_tag)
869869
# IOW, this image did not come from the builder
870-
# FIXME: remove check for mock registry module
871-
if not self.build.sha and 'mock' not in settings.REGISTRY_MODULE:
870+
if not self.build.sha:
872871
# we assume that the image is not present on our registry,
873872
# so shell out a task to pull in the repository
874873
data = {

controller/api/tests/test_build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
from __future__ import unicode_literals
88

99
import json
10-
import mock
1110
import requests
1211

1312
from django.contrib.auth.models import User
1413
from django.test import TransactionTestCase
14+
import mock
1515
from rest_framework.authtoken.models import Token
1616

1717
from api.models import Build
@@ -24,6 +24,7 @@ def mock_import_repository_task(*args, **kwargs):
2424
return resp
2525

2626

27+
@mock.patch('api.models.publish_release', lambda *args: None)
2728
class BuildTest(TransactionTestCase):
2829

2930
"""Tests build notification from build system"""

controller/api/tests/test_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
import json
1111
import logging
12-
import mock
1312
import requests
1413

1514
from django.contrib.auth.models import User
1615
from django.test import TransactionTestCase
1716
import etcd
17+
import mock
1818
from rest_framework.authtoken.models import Token
1919

2020
import api.exceptions
@@ -52,6 +52,7 @@ def get(self, key, *args, **kwargs):
5252
return etcd.EtcdResult(None, node)
5353

5454

55+
@mock.patch('api.models.publish_release', lambda *args: None)
5556
class ConfigTest(TransactionTestCase):
5657

5758
"""Tests setting and updating config values"""

controller/api/tests/test_container.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
from __future__ import unicode_literals
88

99
import json
10-
import mock
1110
import requests
1211

1312
from django.contrib.auth.models import User
1413
from django.test import TransactionTestCase
15-
from scheduler.states import TransitionError
14+
import mock
1615
from rest_framework.authtoken.models import Token
1716

1817
from api.models import App, Build, Container, Release
18+
from scheduler.states import TransitionError
1919

2020

2121
def mock_import_repository_task(*args, **kwargs):
@@ -25,6 +25,7 @@ def mock_import_repository_task(*args, **kwargs):
2525
return resp
2626

2727

28+
@mock.patch('api.models.publish_release', lambda *args: None)
2829
class ContainerTest(TransactionTestCase):
2930
"""Tests creation of containers on nodes"""
3031

controller/api/tests/test_hooks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
from __future__ import unicode_literals
88

99
import json
10-
import mock
1110
import requests
1211

1312
from django.conf import settings
1413
from django.contrib.auth.models import User
1514
from django.test import TransactionTestCase
15+
import mock
1616
from rest_framework.authtoken.models import Token
1717

1818

@@ -23,6 +23,7 @@ def mock_import_repository_task(*args, **kwargs):
2323
return resp
2424

2525

26+
@mock.patch('api.models.publish_release', lambda *args: None)
2627
class HookTest(TransactionTestCase):
2728

2829
"""Tests API hooks used to trigger actions from external components"""

controller/api/tests/test_release.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
from __future__ import unicode_literals
88

99
import json
10-
import mock
1110
import requests
1211

1312
from django.contrib.auth.models import User
1413
from django.test import TransactionTestCase
14+
import mock
1515
from rest_framework.authtoken.models import Token
1616

1717
from api.models import Release
@@ -24,6 +24,7 @@ def mock_import_repository_task(*args, **kwargs):
2424
return resp
2525

2626

27+
@mock.patch('api.models.publish_release', lambda *args: None)
2728
class ReleaseTest(TransactionTestCase):
2829

2930
"""Tests push notification from build system"""

controller/api/tests/test_scheduler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
from django.conf import settings
1212
from django.contrib.auth.models import User
1313
from django.test import TransactionTestCase
14+
import mock
1415
from rest_framework.authtoken.models import Token
1516

1617
from scheduler import chaos
1718

1819

20+
@mock.patch('api.models.publish_release', lambda *args: None)
1921
class SchedulerTest(TransactionTestCase):
2022
"""Tests creation of containers on nodes"""
2123

controller/deis/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@
303303
BUILDER_KEY = os.environ.get('DEIS_BUILDER_KEY', 'CHANGEME_sapm$s%upvsw5l_zuy_&29rkywd^78ff(qi')
304304

305305
# registry settings
306-
REGISTRY_MODULE = 'registry.mock'
307306
REGISTRY_URL = 'http://localhost:5000'
308307
REGISTRY_HOST = 'localhost'
309308
REGISTRY_PORT = 5000

controller/registry/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
import importlib
2-
3-
from django.conf import settings
4-
5-
# import the registry module specified in settings
6-
_registry_module = importlib.import_module(settings.REGISTRY_MODULE)
7-
8-
# expose the publish_release method publicly
9-
publish_release = _registry_module.publish_release
1+
from private import publish_release # noqa

controller/registry/mock.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)