Files
poppy/tests/unit/distributed_task/utils/test_utils.py
Isaac Mungai 0458de585d Check shard is within records limit
Before adding a new record to a domain, check to see
if it's at maximum capacity and skip to the next cert
if necessary.

Change-Id: I7e4c56e27cebc45a9cdddf9659762f29f9c6227c
2016-09-21 14:18:02 -04:00

67 lines
2.5 KiB
Python

# Copyright (c) 2015 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unittests for TaskFlow distributed_task driver implementation."""
import mock
from poppy.distributed_task.utils import memoized_controllers
from tests.unit import base
class TestMemoizeUtils(base.TestCase):
def setUp(self):
super(TestMemoizeUtils, self).setUp()
rax_dns_set_credentials = mock.patch('pyrax.set_credentials')
rax_dns_set_credentials.start()
self.addCleanup(rax_dns_set_credentials.stop)
rax_dns = mock.patch('pyrax.cloud_dns')
rax_dns.start()
self.addCleanup(rax_dns.stop)
def test_memoization_service_controller(self):
service_controller_first = \
memoized_controllers.task_controllers('poppy')
service_controller_cached = \
memoized_controllers.task_controllers('poppy')
self.assertEqual(id(service_controller_first),
id(service_controller_cached))
def test_memoization_storage_controller(self):
service_controller_first, storage_controller_first = \
memoized_controllers.task_controllers('poppy', 'storage')
service_controller_cached, storage_controller_cached = \
memoized_controllers.task_controllers('poppy', 'storage')
self.assertEqual(id(service_controller_first),
id(service_controller_cached))
self.assertEqual(id(storage_controller_first),
id(storage_controller_cached))
def test_memoization_dns_controller(self):
service_controller_first, dns_controller_first = \
memoized_controllers.task_controllers('poppy', 'storage')
service_controller_cached, dns_controller_cached = \
memoized_controllers.task_controllers('poppy', 'storage')
self.assertEqual(id(service_controller_first),
id(service_controller_cached))
self.assertEqual(id(dns_controller_first),
id(dns_controller_cached))