Add Memcached functional tests to gate
Change-Id: Ieca5e59e36879ce1e0277ee17a1fbe40c7316958
This commit is contained in:
parent
c872fc0b94
commit
a11cde4cc3
26
.zuul.yaml
26
.zuul.yaml
@ -1,3 +1,12 @@
|
|||||||
|
## Functional Tests env vars
|
||||||
|
#
|
||||||
|
# PIFPAF_DAEMON:
|
||||||
|
# The binary to be installed by bindep filtered with
|
||||||
|
# [tests-functional-{PIFPAF_DAEMON}] and executed by pifpaf.
|
||||||
|
#
|
||||||
|
# OSLO_BACKEND:
|
||||||
|
# The functional test directory to pass to STESTR_TEST_PATH
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: oslo.cache-functional
|
name: oslo.cache-functional
|
||||||
parent: openstack-tox
|
parent: openstack-tox
|
||||||
@ -12,10 +21,22 @@
|
|||||||
vars:
|
vars:
|
||||||
tox_environment:
|
tox_environment:
|
||||||
PIFPAF_DAEMON: etcd
|
PIFPAF_DAEMON: etcd
|
||||||
# The next env var correspond to the functional test
|
|
||||||
# directory to pass to STESTR_TEST_PATH
|
|
||||||
OSLO_BACKEND: etcd3gw
|
OSLO_BACKEND: etcd3gw
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: oslo.cache-functional-memcached
|
||||||
|
parent: oslo.cache-functional
|
||||||
|
vars:
|
||||||
|
tox_environment:
|
||||||
|
PIFPAF_DAEMON: memcached
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: oslo.cache-functional-dogpile.cache.bmemcached
|
||||||
|
parent: oslo.cache-functional-memcached
|
||||||
|
vars:
|
||||||
|
tox_environment:
|
||||||
|
OSLO_BACKEND: dogpile_cache_bmemcached
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- check-requirements
|
- check-requirements
|
||||||
@ -28,3 +49,4 @@
|
|||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- oslo.cache-functional-etcd3gw
|
- oslo.cache-functional-etcd3gw
|
||||||
|
- oslo.cache-functional-dogpile.cache.bmemcached
|
||||||
|
@ -2,3 +2,4 @@
|
|||||||
# More info at: https://docs.openstack.org/infra/bindep/readme.html
|
# More info at: https://docs.openstack.org/infra/bindep/readme.html
|
||||||
|
|
||||||
etcd [tests-functional-etcd]
|
etcd [tests-functional-etcd]
|
||||||
|
memcached [tests-functional-memcached]
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright 2020 Red Hat, 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.
|
||||||
|
|
||||||
|
from oslo_cache.tests.functional import test_base
|
||||||
|
|
||||||
|
|
||||||
|
class TestDogpileCacheBMemcachedBackend(test_base.BaseTestCaseCacheBackend):
|
||||||
|
def setUp(self):
|
||||||
|
self.config_fixture.config(
|
||||||
|
group="cache",
|
||||||
|
backend="dogpile.cache.bmemcached",
|
||||||
|
memcache_servers="localhost:11212",
|
||||||
|
)
|
||||||
|
|
||||||
|
# NOTE(hberaud): super must be called after all to ensure that
|
||||||
|
# config fixture is properly initialized with value related to
|
||||||
|
# the current backend in use.
|
||||||
|
super().setUp()
|
@ -12,22 +12,18 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_config import fixture as config_fixture
|
|
||||||
|
|
||||||
from oslo_cache.tests.functional import test_base
|
from oslo_cache.tests.functional import test_base
|
||||||
|
|
||||||
|
|
||||||
class TestEtcdCacheBackend(test_base.BaseTestCaseCacheBackend):
|
class TestEtcdCacheBackend(test_base.BaseTestCaseCacheBackend):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.config_fixture = self.useFixture(config_fixture.Config())
|
|
||||||
self.config_fixture.config(
|
self.config_fixture.config(
|
||||||
group='cache',
|
group='cache',
|
||||||
backend='oslo_cache.etcd3gw',
|
backend='oslo_cache.etcd3gw',
|
||||||
enabled=True,
|
|
||||||
proxies=['oslo_cache.testing.CacheIsolatingProxy'],
|
|
||||||
backend_argument=['host:127.0.0.1', 'port:2379']
|
backend_argument=['host:127.0.0.1', 'port:2379']
|
||||||
)
|
)
|
||||||
|
|
||||||
# NOTE(hberaud): super must be called after all to ensure that
|
# NOTE(hberaud): super must be called after all to ensure that
|
||||||
# config fixture is properly initialized with value related to
|
# config fixture is properly initialized with value related to
|
||||||
# the current backend in use.
|
# the current backend in use.
|
||||||
super(TestEtcdCacheBackend, self).setUp()
|
super().setUp()
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from oslo_config import fixture
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
|
|
||||||
@ -22,24 +23,32 @@ NO_VALUE = cache.NO_VALUE
|
|||||||
|
|
||||||
|
|
||||||
class BaseTestCaseCacheBackend(base.BaseTestCase):
|
class BaseTestCaseCacheBackend(base.BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(BaseTestCaseCacheBackend, self).setUp()
|
super().setUp()
|
||||||
if not hasattr(self, 'config_fixture'):
|
|
||||||
raise Exception("Functional tests base class can't be used "
|
self.conf = self.config_fixture.conf
|
||||||
"directly first you should define a test class "
|
|
||||||
"backend wrapper to init the related "
|
|
||||||
"config fixture")
|
|
||||||
self.region = cache.create_region()
|
self.region = cache.create_region()
|
||||||
cache.configure_cache_region(self.config_fixture.conf, self.region)
|
|
||||||
self.region_kwargs = cache.create_region(
|
self.region_kwargs = cache.create_region(
|
||||||
function=cache.kwarg_function_key_generator
|
function=cache.kwarg_function_key_generator
|
||||||
)
|
)
|
||||||
cache.configure_cache_region(
|
|
||||||
self.config_fixture.conf,
|
cache.configure_cache_region(self.conf, self.region)
|
||||||
self.region_kwargs
|
cache.configure_cache_region(self.conf, self.region_kwargs)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def config_fixture(self):
|
||||||
|
if not hasattr(self, "_config_fixture"):
|
||||||
|
self._config_fixture = self.useFixture(fixture.Config())
|
||||||
|
|
||||||
|
# default config for all tests
|
||||||
|
self._config_fixture.config(
|
||||||
|
group="cache",
|
||||||
|
enabled=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return self._config_fixture
|
||||||
|
|
||||||
def test_backend_get_missing_data(self):
|
def test_backend_get_missing_data(self):
|
||||||
random_key = uuidutils.generate_uuid(dashed=False)
|
random_key = uuidutils.generate_uuid(dashed=False)
|
||||||
# should return NO_VALUE as key does not exist in cache
|
# should return NO_VALUE as key does not exist in cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user