Add support for keystoneclient 0.4.0
Keystoneclient auth_middleware changed the way it parses the datetime returned from the cache, breaking the Ceilometer unit tests. This patch fixes the fake cache system that's used in unit test, so it works with all keystoneclient versions. This also update the sample configuration files to include the new options provided by keystoneclient 0.4.0. Fixes-Bug: #1238529 Change-Id: Iecfd50d9e9801aeb919f2c09a728e4ea15245a5e
This commit is contained in:
parent
3a3b8463ef
commit
e3cef871ac
@ -742,6 +742,10 @@
|
||||
# server. (boolean value)
|
||||
#http_connect_timeout=<None>
|
||||
|
||||
# How many times are we trying to reconnect when communicating
|
||||
# with Identity API Server. (integer value)
|
||||
#http_request_max_retries=3
|
||||
|
||||
# Allows to pass in the name of a fake http_handler callback
|
||||
# function used instead of httplib.HTTPConnection or
|
||||
# httplib.HTTPSConnection. Useful for unit testing where
|
||||
@ -774,6 +778,13 @@
|
||||
# (string value)
|
||||
#keyfile=<None>
|
||||
|
||||
# A PEM encoded Certificate Authority to use when verifying
|
||||
# HTTPs connections. Defaults to system CAs. (string value)
|
||||
#cafile=<None>
|
||||
|
||||
# Verify HTTPS connections. (boolean value)
|
||||
#insecure=false
|
||||
|
||||
# Directory used to cache files related to PKI tokens (string
|
||||
# value)
|
||||
#signing_dir=<None>
|
||||
|
@ -27,6 +27,7 @@ from ceilometer import sample
|
||||
from ceilometer.api import acl
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.openstack.common import timeutils
|
||||
|
||||
from .base import FunctionalTest
|
||||
|
||||
@ -37,12 +38,8 @@ VALID_TOKEN2 = '4562138218392832'
|
||||
|
||||
|
||||
class FakeMemcache(object):
|
||||
def __init__(self):
|
||||
self.set_key = None
|
||||
self.set_value = None
|
||||
self.token_expiration = None
|
||||
|
||||
def get(self, key):
|
||||
@staticmethod
|
||||
def get(key):
|
||||
if key == "tokens/%s" % VALID_TOKEN:
|
||||
dt = datetime.datetime.now() + datetime.timedelta(minutes=5)
|
||||
return json.dumps(({'access': {
|
||||
@ -55,7 +52,7 @@ class FakeMemcache(object):
|
||||
'roles': [
|
||||
{'name': 'admin'},
|
||||
]},
|
||||
}}, dt.strftime("%s")))
|
||||
}}, timeutils.isotime(dt)))
|
||||
if key == "tokens/%s" % VALID_TOKEN2:
|
||||
dt = datetime.datetime.now() + datetime.timedelta(minutes=5)
|
||||
return json.dumps(({'access': {
|
||||
@ -68,11 +65,11 @@ class FakeMemcache(object):
|
||||
'roles': [
|
||||
{'name': 'Member'},
|
||||
]},
|
||||
}}, dt.strftime("%s")))
|
||||
}}, timeutils.isotime(dt)))
|
||||
|
||||
def set(self, key, value, **kwargs):
|
||||
self.set_value = value
|
||||
self.set_key = key
|
||||
@staticmethod
|
||||
def set(key, value, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class TestAPIACL(FunctionalTest,
|
||||
|
Loading…
Reference in New Issue
Block a user