Detect service ports from pifpaf environments

... instead of using own hard-code.

Change-Id: I8dabc0449ddc2605f2e3844e64ed2d6de6fdd546
This commit is contained in:
Takashi Kajinami
2025-01-12 17:44:06 +09:00
parent 5f8746c8ff
commit 96e0f414fd
6 changed files with 33 additions and 7 deletions

View File

@@ -12,15 +12,20 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_cache.tests.functional import test_base
MEMCACHED_PORT = os.getenv("OSLO_CACHE_TEST_MEMCACHED_PORT", "11212")
class TestDogpileCacheBMemcachedBackend(test_base.BaseTestCaseCacheBackend):
def setUp(self):
self.config_fixture.config(
group="cache",
backend="dogpile.cache.bmemcached",
memcache_servers="localhost:11212",
memcache_servers=f"localhost:{MEMCACHED_PORT}",
)
# NOTE(hberaud): super must be called after all to ensure that

View File

@@ -12,15 +12,20 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_cache.tests.functional import test_base
MEMCACHED_PORT = os.getenv("OSLO_CACHE_TEST_MEMCACHED_PORT", "11212")
class TestDogpileCachePyMemcacheBackend(test_base.BaseTestCaseCacheBackend):
def setUp(self):
self.config_fixture.config(
group="cache",
backend="dogpile.cache.pymemcache",
memcache_servers="localhost:11212",
memcache_servers=[f'localhost:{MEMCACHED_PORT}']
)
# NOTE(hberaud): super must be called after all to ensure that

View File

@@ -12,15 +12,20 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_cache.tests.functional import test_base
REDIS_PORT = os.getenv("OSLO_CACHE_TEST_REDIS_PORT", "6379")
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',
redis_server=f"127.0.0.1:{REDIS_PORT}",
)
# NOTE(hberaud): super must be called after all to ensure that

View File

@@ -12,15 +12,20 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_cache.tests.functional import test_base
REDIS_SENTINEL_PORT = os.getenv("OSLO_CACHE_TEST_REDIS_SENTINEL_PORT", "6380")
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_sentinels=[f"127.0.0.1:{REDIS_SENTINEL_PORT}"],
redis_sentinel_service_name='pifpaf'
)

View File

@@ -12,15 +12,20 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_cache.tests.functional import test_base
ETCD_PORT = os.getenv("OSLO_CACHE_TEST_ETCD_PORT", "2379")
class TestEtcdCacheBackend(test_base.BaseTestCaseCacheBackend):
def setUp(self):
self.config_fixture.config(
group='cache',
backend='oslo_cache.etcd3gw',
backend_argument=['host:127.0.0.1', 'port:2379']
backend_argument=['host:127.0.0.1', f'port:{ETCD_PORT}']
)
# NOTE(hberaud): super must be called after all to ensure that

View File

@@ -17,9 +17,11 @@ import os
from oslo_cache.tests.functional import test_base
MEMCACHED_PORT = os.getenv("OSLO_CACHE_TEST_MEMCACHED_PORT", "11212")
class TestMemcachePoolCacheBackend(test_base.BaseTestCaseCacheBackend):
def setUp(self):
MEMCACHED_PORT = os.getenv("OSLO_CACHE_TEST_MEMCACHED_PORT", "11211")
self.config_fixture.config(
group='cache',
backend='oslo_cache.memcache_pool',
@@ -34,7 +36,6 @@ class TestMemcachePoolCacheBackend(test_base.BaseTestCaseCacheBackend):
class TestBMemcachePoolCacheBackend(test_base.BaseTestCaseCacheBackend):
def setUp(self):
MEMCACHED_PORT = os.getenv("OSLO_CACHE_TEST_MEMCACHED_PORT", "11211")
# If the cache support the sasl, the memcache_sasl_enabled
# should be True.
self.config_fixture.config(