Skip to content

Commit

Permalink
Add valkey testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmueller committed Jan 3, 2025
1 parent 51291e7 commit 11c880d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
13 changes: 12 additions & 1 deletion bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,16 @@ def create_BCI(
)


VALKEY_CONTAINERS = [
create_BCI(
build_tag=f"{APP_CONTAINER_PREFIX}/valkey:{tag}",
bci_type=ImageType.APPLICATION,
available_versions=versions,
forwarded_ports=[PortForwarding(container_port=6379)],
)
for versions, tag in ((("tumbleweed",), "8.0"),)
]

CONTAINERS_WITH_ZYPPER = (
[
BASE_CONTAINER,
Expand Down Expand Up @@ -1064,6 +1074,7 @@ def create_BCI(
*POSTGRESQL_CONTAINERS,
*MARIADB_CLIENT_CONTAINERS,
*MARIADB_CONTAINERS,
*VALKEY_CONTAINERS,
]

#: Containers with L3 support
Expand Down Expand Up @@ -1111,7 +1122,7 @@ def create_BCI(

ACC_CONTAINERS = POSTGRESQL_CONTAINERS

#: Containers that are directly pulled from registry.suse.de
#: Containers pulled from registry.suse.de
ALL_CONTAINERS = CONTAINERS_WITH_ZYPPER + CONTAINERS_WITHOUT_ZYPPER


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ markers = [
'bci-sle15-kernel-module-devel_15.7',
'bci-sle16-kernel-module-devel_16.0',
'spack_0.21',
'valkey_8.0',
]

[tool.ruff]
Expand Down
29 changes: 29 additions & 0 deletions tests/test_valkey.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""This module contains the tests for the valkey container."""

import socket

from tenacity import retry
from tenacity import stop_after_attempt
from tenacity import wait_exponential

from bci_tester.data import VALKEY_CONTAINERS

CONTAINER_IMAGES = VALKEY_CONTAINERS


def test_valkey_ping(auto_container):
"""Test that we can reach valkey port successfully."""
host_port = auto_container.forwarded_ports[0].host_port

# Retry 5 times with exponential backoff delay
@retry(
wait=wait_exponential(multiplier=1, min=4, max=10),
stop=stop_after_attempt(5),
)
def check_valkey_response():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("0.0.0.0", host_port))
sock.sendall(b"PING\n")
assert sock.recv(4) == b"+PONG"

check_valkey_response()
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = {py36,py39,py310,py311,py312,py313}-unit, all, base, cosign, fips, init, dotnet, python, ruby, node, go, openjdk, openjdk_devel, rust, php, busybox, 389ds, metadata, minimal, multistage, repository, doc, lint, get_urls, pcp, distribution, postgres, git, helm, nginx, kernel_module, mariadb, tomcat, spack, gcc, prometheus, grafana, kiwi, postfix, ai
envlist = {py36,py39,py310,py311,py312,py313}-unit, all, base, cosign, fips, init, dotnet, python, ruby, node, go, openjdk, openjdk_devel, rust, php, busybox, 389ds, metadata, minimal, multistage, repository, doc, lint, get_urls, pcp, distribution, postgres, git, helm, nginx, kernel_module, mariadb, tomcat, spack, gcc, prometheus, grafana, kiwi, postfix, ai, valkey
skip_missing_interpreters = True

[common]
Expand Down

0 comments on commit 11c880d

Please sign in to comment.