mirror of
https://github.com/ansible/awx.git
synced 2026-09-16 00:40:11 -02:30
equate unix socket file to localhost for ha
This commit is contained in:
@@ -18,3 +18,4 @@ from awx.main.tests.views import * # noqa
|
||||
from awx.main.tests.commands import * # noqa
|
||||
from awx.main.tests.fact import * # noqa
|
||||
from awx.main.tests.unified_jobs import * # noqa
|
||||
from awx.main.tests.ha import * # noqa
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Copyright (c) 2015 Ansible, Inc.
|
||||
|
||||
# Python
|
||||
import mock
|
||||
|
||||
# Django
|
||||
from django.test import SimpleTestCase
|
||||
from django.conf import settings
|
||||
|
||||
# AWX
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.ha import * # noqa
|
||||
from awx.main.tests.base import BaseTest
|
||||
|
||||
__all__ = ['HAUnitTest',]
|
||||
|
||||
class HAUnitTest(SimpleTestCase):
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=2)
|
||||
def test_multiple_instances(self, ignore):
|
||||
self.assertTrue(is_ha_environment())
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=1)
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', { 'HOST': 'localhost' })
|
||||
def test_db_localhost(self, ignore):
|
||||
self.assertFalse(is_ha_environment())
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=1)
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', { 'HOST': '127.0.0.1' })
|
||||
def test_db_127_0_0_1(self, ignore):
|
||||
self.assertFalse(is_ha_environment())
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=1)
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', { 'HOST': '/i/might/be/a/file' })
|
||||
def test_db_file_socket(self, ignore):
|
||||
self.assertFalse(is_ha_environment())
|
||||
Reference in New Issue
Block a user