diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a4cb74634c..1def64cf186 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -171,6 +171,7 @@ These tests create new temporary tables / datasets locally only, and they are cl The services with containerized replacements currently implemented are: - Datastore +- DynamoDB - Redis You can run `make test-python-integration-container` to run tests against the containerized versions of dependencies. diff --git a/sdk/python/tests/integration/feature_repos/repo_configuration.py b/sdk/python/tests/integration/feature_repos/repo_configuration.py index 6557394cae6..bb63131bd8c 100644 --- a/sdk/python/tests/integration/feature_repos/repo_configuration.py +++ b/sdk/python/tests/integration/feature_repos/repo_configuration.py @@ -47,6 +47,9 @@ from tests.integration.feature_repos.universal.online_store.datastore import ( DatastoreOnlineStoreCreator, ) +from tests.integration.feature_repos.universal.online_store.dynamodb import ( + DynamoDBOnlineStoreCreator, +) from tests.integration.feature_repos.universal.online_store.redis import ( RedisOnlineStoreCreator, ) @@ -130,7 +133,10 @@ if os.getenv("FEAST_LOCAL_ONLINE_CONTAINER", "False").lower() == "true": replacements = {"datastore": DatastoreOnlineStoreCreator} - replacement_dicts = [(REDIS_CONFIG, RedisOnlineStoreCreator)] + replacement_dicts = [ + (REDIS_CONFIG, RedisOnlineStoreCreator), + (DYNAMO_CONFIG, DynamoDBOnlineStoreCreator), + ] for c in FULL_REPO_CONFIGS: if isinstance(c.online_store, dict): for _replacement in replacement_dicts: diff --git a/sdk/python/tests/integration/feature_repos/universal/online_store/dynamodb.py b/sdk/python/tests/integration/feature_repos/universal/online_store/dynamodb.py new file mode 100644 index 00000000000..e4d8e0c3d02 --- /dev/null +++ b/sdk/python/tests/integration/feature_repos/universal/online_store/dynamodb.py @@ -0,0 +1,34 @@ +from typing import Dict + +from testcontainers.core.container import DockerContainer +from testcontainers.core.waiting_utils import wait_for_logs + +from tests.integration.feature_repos.universal.online_store_creator import ( + OnlineStoreCreator, +) + + +class DynamoDBOnlineStoreCreator(OnlineStoreCreator): + def __init__(self, project_name: str): + super().__init__(project_name) + self.container = DockerContainer( + "amazon/dynamodb-local:latest" + ).with_exposed_ports("8000") + + def create_online_store(self) -> Dict[str, str]: + self.container.start() + log_string_to_wait_for = ( + "Initializing DynamoDB Local with the following configuration:" + ) + wait_for_logs( + container=self.container, predicate=log_string_to_wait_for, timeout=5 + ) + exposed_port = self.container.get_exposed_port("8000") + return { + "type": "dynamodb", + "endpoint_url": f"http://localhost:{exposed_port}", + "region": "us-west-2", + } + + def teardown(self): + self.container.stop()