Fixing keystone singleton problem
Change-Id: I15adbf83b8445e5c952fda846c9e2e5b3f975d35
This commit is contained in:
parent
24d2fe654d
commit
d0af90fc7d
|
@ -12,3 +12,4 @@ root
|
|||
AUTHORS
|
||||
ChangeLog
|
||||
*.egg*
|
||||
.*.sw*
|
||||
|
|
|
@ -8,10 +8,10 @@ import monasca_agent.common.singleton as singleton
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Make this a singleton class so we don't get the token every time
|
||||
# the class is created
|
||||
@six.add_metaclass(singleton.Singleton)
|
||||
class Keystone(object):
|
||||
# Make this a singleton class so we don't get the token every time
|
||||
# the class is created
|
||||
six.add_metaclass(singleton.Singleton)
|
||||
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import os.path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from monasca_agent.common.keystone import Keystone
|
||||
from monasca_agent.common.util import is_valid_hostname
|
||||
from monasca_agent.common.util import PidFile
|
||||
|
||||
|
||||
class TestConfig(unittest.TestCase):
|
||||
def testKeyStoneIsSingleton(self):
|
||||
keystone_1 = Keystone({})
|
||||
keystone_2 = Keystone({})
|
||||
keystone_3 = Keystone({})
|
||||
|
||||
self.assertTrue(keystone_1 is keystone_2)
|
||||
self.assertTrue(keystone_1 is keystone_3)
|
Loading…
Reference in New Issue