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:
|
||||
name: oslo.cache-functional
|
||||
parent: openstack-tox
|
||||
@ -12,10 +21,22 @@
|
||||
vars:
|
||||
tox_environment:
|
||||
PIFPAF_DAEMON: etcd
|
||||
# The next env var correspond to the functional test
|
||||
# directory to pass to STESTR_TEST_PATH
|
||||
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:
|
||||
templates:
|
||||
- check-requirements
|
||||
@ -28,3 +49,4 @@
|
||||
check:
|
||||
jobs:
|
||||
- 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
|
||||
|
||||
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
|
||||
# under the License.
|
||||
|
||||
from oslo_config import fixture as config_fixture
|
||||
|
||||
from oslo_cache.tests.functional import test_base
|
||||
|
||||
|
||||
class TestEtcdCacheBackend(test_base.BaseTestCaseCacheBackend):
|
||||
def setUp(self):
|
||||
self.config_fixture = self.useFixture(config_fixture.Config())
|
||||
self.config_fixture.config(
|
||||
group='cache',
|
||||
backend='oslo_cache.etcd3gw',
|
||||
enabled=True,
|
||||
proxies=['oslo_cache.testing.CacheIsolatingProxy'],
|
||||
backend_argument=['host:127.0.0.1', 'port:2379']
|
||||
)
|
||||
|
||||
# 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(TestEtcdCacheBackend, self).setUp()
|
||||
super().setUp()
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import fixture
|
||||
from oslo_utils import uuidutils
|
||||
from oslotest import base
|
||||
|
||||
@ -22,23 +23,31 @@ NO_VALUE = cache.NO_VALUE
|
||||
|
||||
|
||||
class BaseTestCaseCacheBackend(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BaseTestCaseCacheBackend, self).setUp()
|
||||
if not hasattr(self, 'config_fixture'):
|
||||
raise Exception("Functional tests base class can't be used "
|
||||
"directly first you should define a test class "
|
||||
"backend wrapper to init the related "
|
||||
"config fixture")
|
||||
super().setUp()
|
||||
|
||||
self.conf = self.config_fixture.conf
|
||||
|
||||
self.region = cache.create_region()
|
||||
cache.configure_cache_region(self.config_fixture.conf, self.region)
|
||||
self.region_kwargs = cache.create_region(
|
||||
function=cache.kwarg_function_key_generator
|
||||
)
|
||||
cache.configure_cache_region(
|
||||
self.config_fixture.conf,
|
||||
self.region_kwargs
|
||||
)
|
||||
|
||||
cache.configure_cache_region(self.conf, self.region)
|
||||
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):
|
||||
random_key = uuidutils.generate_uuid(dashed=False)
|
||||
|
Loading…
Reference in New Issue
Block a user