Skip to content

valkey test container - #1

Open
daric93 wants to merge 9 commits into
mainfrom
valkey_test_container
Open

valkey test container#1
daric93 wants to merge 9 commits into
mainfrom
valkey_test_container

Conversation

@daric93

Copy link
Copy Markdown
Owner

No description provided.

@daric93daric93 self-assigned this Dec 8, 2025
Comment threadmodules/valkey/testcontainers/valkey/__init__.py Outdated
"""
return int(super().get_exposed_port(self.port))

@wait_container_is_ready(ValkeyNotReady)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated Decorator Usage

Location:modules/valkey/testcontainers/valkey/__init__.py, line 113

Current Code:

@wait_container_is_ready(ValkeyNotReady)def_connect(self) ->None:
"""Wait for Valkey to be ready by sending PING command."""# ... connection logic

Issue:

The @wait_container_is_ready decorator is deprecated in the codebase. Recent commits show active migration away from this pattern:

Evidence from Codebase:

# From pytest.ini_options filterwarnings:"ignore:The @wait_container_is_ready decorator is deprecated.*:DeprecationWarning"

Recommended Fix:

Migrate to modern wait strategy pattern:

fromtestcontainers.core.wait_strategiesimportExecWaitStrategyclassValkeyContainer(DockerContainer):
def__init__(self, image: str="valkey/valkey:latest", port: int=6379, **kwargs) ->None:
super().__init__(image, **kwargs)
self.port=portself.password: Optional[str] =Noneself.with_exposed_ports(self.port)
defstart(self) ->"ValkeyContainer":
# Build wait strategy based on passwordifself.password:
# Use custom wait strategy for authenticated connectionsself.waiting_for(self._create_auth_wait_strategy())
else:
# Use exec strategy for simple PINGself.waiting_for(
ExecWaitStrategy(["valkey-cli", "ping"])
)
super().start()
returnself

Benefits:

  • Aligns with project direction
  • More composable and testable
  • Consistent with other modules
  • Better error messages

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment threadmodules/valkey/example_basic.py Outdated
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
@daric93
daric93force-pushed the valkey_test_container branch from 4c8007b to 21ec9f8CompareApril 7, 2026 19:52
daric93and others added 6 commits April 7, 2026 15:18
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
🤖 I have created a release *beep* *boop*
---
##
[4.15.0-rc.1](testcontainers/testcontainers-python@testcontainers-v4.14.2...testcontainers-v4.15.0-rc.1)
(2026-04-07)
### Features
* **compose:** add structured container inspect information
([testcontainers#897](testcontainers#897))
([58459a1](testcontainers@58459a1))
* **core:** support SSH-based DOCKER_HOST
([testcontainers#993](testcontainers#993))
([d48115d](testcontainers@d48115d))
* **generic:** Reintroducing the generic SQL module
([testcontainers#892](testcontainers#892))
([2ca2321](testcontainers@2ca2321))
* **keycloak:** support for relative path and management relative path
([testcontainers#982](testcontainers#982))
([898faf6](testcontainers@898faf6))
* **mqtt:** MosquittoContainer: Add version 2.1.2
([testcontainers#978](testcontainers#978))
([af382f7](testcontainers@af382f7))
### Bug Fixes
* **azurite:** make visible to type checkers
([testcontainers#927](testcontainers#927))
([baa5668](testcontainers@baa5668))
* **clickhouse:** add `HttpWaitStrategy` instead of deprecated
`wait_container_is_ready`
([testcontainers#962](testcontainers#962))
([8034541](testcontainers@8034541))
* **compose:** return type in get_service_port docstring
([testcontainers#939](testcontainers#939))
([fed65fe](testcontainers@fed65fe))
* **core:** Refactor copy file
([testcontainers#996](testcontainers#996))
([0e0bb24](testcontainers@0e0bb24))
* **core:** wait for ryuk more reliably, improve tests: long_running,
filter logs
([testcontainers#984](testcontainers#984))
([b12ae13](testcontainers@b12ae13))
* **generic:** Migrate ServerContainer from deprecated decorator to
HttpWaitStrategy
([testcontainers#971](testcontainers#971))
([460b0d8](testcontainers@460b0d8))
* **kafka:** Use wait strategy instead of deprecated wait_for_logs
([testcontainers#903](testcontainers#903))
([87332c1](testcontainers@87332c1))
* **postgres:** add py.typed marker to postgres module
([testcontainers#849](testcontainers#849))
([c8a5bbd](testcontainers@c8a5bbd))
* **qdrant:** migrate Qdrant from deprecated decorator.
([testcontainers#963](testcontainers#963))
([407f798](testcontainers@407f798))
* **redis:** Use wait strategy instead of deprecated decorator
([testcontainers#914](testcontainers#914))
([e25713a](testcontainers@e25713a))
* **sftp:** Avoid using wait_for_logs in module.
([testcontainers#995](testcontainers#995))
([83157eb](testcontainers@83157eb))
---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: David Ankin <daveankin@gmail.com>
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@daric93@jbrinkman@Tranquility2