Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add valkey testing #668

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,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 @@ -1065,6 +1075,7 @@ def create_BCI(
*POSTGRESQL_CONTAINERS,
*MARIADB_CLIENT_CONTAINERS,
*MARIADB_CONTAINERS,
*VALKEY_CONTAINERS,
]

#: Containers with L3 support
Expand Down Expand Up @@ -1112,7 +1123,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 @@ -146,6 +146,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
5 changes: 5 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
from bci_tester.data import SAC_PYTHON_CONTAINERS
from bci_tester.data import SPACK_CONTAINERS
from bci_tester.data import TOMCAT_CONTAINERS
from bci_tester.data import VALKEY_CONTAINERS
from bci_tester.data import ImageType
from bci_tester.runtime_choice import PODMAN_SELECTED

Expand Down Expand Up @@ -286,6 +287,10 @@ def _get_container_label_prefix(
(OPENWEBUI_CONTAINER, "open-webui", ImageType.SAC_APPLICATION),
(MILVUS_CONTAINER, "milvus", ImageType.SAC_APPLICATION),
]
+ [
(valkey_container, "valkey", ImageType.APPLICATION)
for valkey_container in VALKEY_CONTAINERS
]
]


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
Loading