-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51291e7
commit 11c880d
Showing
4 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters