redis: Add functional tests
This adds functional tests with redis and redis sentinel, to ensure the current implementation can initialize clients properly. Change-Id: I6318f6ad00d5b0ee3db1be5e8671a4c346b9daff
This commit is contained in:
parent
7bb43bbbd5
commit
6c73ace4f7
24
.zuul.yaml
24
.zuul.yaml
@ -51,6 +51,28 @@
|
|||||||
tox_environment:
|
tox_environment:
|
||||||
OSLO_BACKEND: memcache_pool
|
OSLO_BACKEND: memcache_pool
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: oslo.cache-functional-redis
|
||||||
|
parent: oslo.cache-functional
|
||||||
|
vars:
|
||||||
|
tox_environment:
|
||||||
|
PIFPAF_DAEMON: redis
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: oslo.cache-functional-dogpile.cache.redis
|
||||||
|
parent: oslo.cache-functional-redis
|
||||||
|
vars:
|
||||||
|
tox_environment:
|
||||||
|
OSLO_BACKEND: dogpile_cache_redis
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: oslo.cache-functional-dogpile.cache.redis_sentinel
|
||||||
|
parent: oslo.cache-functional-redis
|
||||||
|
vars:
|
||||||
|
tox_environment:
|
||||||
|
OSLO_BACKEND: dogpile_cache_redis_sentinel
|
||||||
|
PIFPAF_OPTS: --sentinel
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- check-requirements
|
- check-requirements
|
||||||
@ -65,3 +87,5 @@
|
|||||||
- oslo.cache-functional-dogpile.cache.bmemcached
|
- oslo.cache-functional-dogpile.cache.bmemcached
|
||||||
- oslo.cache-functional-dogpile.cache.pymemcache
|
- oslo.cache-functional-dogpile.cache.pymemcache
|
||||||
- oslo.cache-functional-memcache_pool
|
- oslo.cache-functional-memcache_pool
|
||||||
|
- oslo.cache-functional-dogpile.cache.redis
|
||||||
|
- oslo.cache-functional-dogpile.cache.redis_sentinel
|
||||||
|
@ -3,3 +3,6 @@
|
|||||||
|
|
||||||
etcd [tests-functional-etcd]
|
etcd [tests-functional-etcd]
|
||||||
memcached [tests-functional-memcached]
|
memcached [tests-functional-memcached]
|
||||||
|
redis [platform:rpm tests-functional-redis]
|
||||||
|
redis-server [platform:dpkg tests-functional-redis]
|
||||||
|
redis-sentinel [platform:dpkg tests-functional-redis]
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright 2024 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# 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 TestRedisCacheBackend(test_base.BaseTestCaseCacheBackend):
|
||||||
|
def setUp(self):
|
||||||
|
self.config_fixture.config(
|
||||||
|
group='cache',
|
||||||
|
backend='dogpile.cache.redis',
|
||||||
|
redis_server='127.0.0.1:6379',
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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()
|
@ -0,0 +1,30 @@
|
|||||||
|
# Copyright 2024 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# 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 TestRedisSentinelCacheBackend(test_base.BaseTestCaseCacheBackend):
|
||||||
|
def setUp(self):
|
||||||
|
self.config_fixture.config(
|
||||||
|
group='cache',
|
||||||
|
backend='dogpile.cache.redis_sentinel',
|
||||||
|
redis_sentinels=['127.0.0.1:6380'],
|
||||||
|
redis_sentinel_service_name='pifpaf'
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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()
|
9
playbooks/tests/functional/Debian.yaml
Normal file
9
playbooks/tests/functional/Debian.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
backend_services_map:
|
||||||
|
redis:
|
||||||
|
- redis-server
|
||||||
|
- redis-sentinel
|
||||||
|
memcached:
|
||||||
|
- memcached
|
||||||
|
etcd:
|
||||||
|
- etcd
|
9
playbooks/tests/functional/RedHat.yaml
Normal file
9
playbooks/tests/functional/RedHat.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
backend_services_map:
|
||||||
|
redis:
|
||||||
|
- redis
|
||||||
|
- redis-sentinel
|
||||||
|
memcached:
|
||||||
|
- memcached
|
||||||
|
etcd:
|
||||||
|
- etcd
|
@ -5,13 +5,16 @@
|
|||||||
- role: bindep
|
- role: bindep
|
||||||
bindep_profile: "tests-functional-{{ oslo_cache_backend_daemon }}"
|
bindep_profile: "tests-functional-{{ oslo_cache_backend_daemon }}"
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Include OS-specific variables
|
||||||
|
include_vars: "{{ ansible_os_family }}.yaml"
|
||||||
# NOTE(yoctozepto): Debian and Ubuntu have this nasty policy of starting
|
# NOTE(yoctozepto): Debian and Ubuntu have this nasty policy of starting
|
||||||
# installed services for us. We don't rely on system-wide service and use
|
# installed services for us. We don't rely on system-wide service and use
|
||||||
# pifpaf. Unfortunately, default port may conflict with system-wide service.
|
# pifpaf. Unfortunately, default port may conflict with system-wide service.
|
||||||
# So, for sanity and resource conservation, let's stop it before tests run.
|
# So, for sanity and resource conservation, let's stop it before tests run.
|
||||||
- name: "Stop {{ oslo_cache_backend_daemon }}"
|
- name: "Stop backend services"
|
||||||
service:
|
service:
|
||||||
name: "{{ oslo_cache_backend_daemon }}"
|
name: "{{ item }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
enabled: no
|
enabled: no
|
||||||
become: yes
|
become: yes
|
||||||
|
loop: "{{ backend_services_map[oslo_cache_backend_daemon] }}"
|
||||||
|
@ -40,6 +40,7 @@ dogpile =
|
|||||||
python-memcached>=1.56 # PSF
|
python-memcached>=1.56 # PSF
|
||||||
pymemcache>=3.5.0 # Apache-2.0
|
pymemcache>=3.5.0 # Apache-2.0
|
||||||
python-binary-memcached>=0.29.0 # MIT
|
python-binary-memcached>=0.29.0 # MIT
|
||||||
|
redis>=3.0.0 # MIT
|
||||||
mongo =
|
mongo =
|
||||||
pymongo!=3.1,>=3.0.2 # Apache-2.0
|
pymongo!=3.1,>=3.0.2 # Apache-2.0
|
||||||
etcd3gw =
|
etcd3gw =
|
||||||
|
@ -6,3 +6,4 @@ python-binary-memcached>=0.29.0 # MIT
|
|||||||
python-memcached>=1.56 # PSF
|
python-memcached>=1.56 # PSF
|
||||||
pymongo!=3.1,>=3.0.2 # Apache-2.0
|
pymongo!=3.1,>=3.0.2 # Apache-2.0
|
||||||
etcd3gw>=0.2.0 # Apache-2.0
|
etcd3gw>=0.2.0 # Apache-2.0
|
||||||
|
redis>=3.0.0 # MIT
|
||||||
|
2
tox.ini
2
tox.ini
@ -17,7 +17,7 @@ setenv =
|
|||||||
STESTR_TEST_PATH=./oslo_cache/tests/functional/{env:OSLO_BACKEND}
|
STESTR_TEST_PATH=./oslo_cache/tests/functional/{env:OSLO_BACKEND}
|
||||||
commands =
|
commands =
|
||||||
find . -type f -name "*.pyc" -delete
|
find . -type f -name "*.pyc" -delete
|
||||||
pifpaf -e OSLO_CACHE_TEST run {env:PIFPAF_DAEMON} -- stestr run --slowest
|
pifpaf -e OSLO_CACHE_TEST run {env:PIFPAF_DAEMON} {env:PIFPAF_OPTS} -- stestr run --slowest
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps =
|
deps =
|
||||||
|
Loading…
Reference in New Issue
Block a user