From 945b0faadd40c8dc76d104bce14ee902bd513127 Mon Sep 17 00:00:00 2001 From: lokeshrangineni <19699092+lokeshrangineni@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:12:04 -0400 Subject: [PATCH] fix: Updating the documentation and adding tests for project length (#4628) Updated the documentation to make it clear after spending some time. Addressing the issue - https://github.com/feast-dev/feast/issues/4626 Signed-off-by: lrangine <19699092+lokeshrangineni@users.noreply.github.com> --- sdk/python/feast/repo_config.py | 4 +-- ..._operations_validate_feast_project_name.py | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 sdk/python/tests/unit/sdk/python/feast/test_repo_operations_validate_feast_project_name.py diff --git a/sdk/python/feast/repo_config.py b/sdk/python/feast/repo_config.py index bf0bde6fcb..1b991d058b 100644 --- a/sdk/python/feast/repo_config.py +++ b/sdk/python/feast/repo_config.py @@ -158,9 +158,9 @@ class RepoConfig(FeastBaseModel): """Repo config. Typically loaded from `feature_store.yaml`""" project: StrictStr - """ str: Feast project id. This can be any alphanumeric string up to 16 characters. + """ str: This acts as a Feast unique project identifier. This can be any alphanumeric string and can have '_' but can not start with '_'. You can have multiple independent feature repositories deployed to the same cloud - provider account, as long as they have different project ids. + provider account, as long as they have different project identifier. """ provider: StrictStr = "local" diff --git a/sdk/python/tests/unit/sdk/python/feast/test_repo_operations_validate_feast_project_name.py b/sdk/python/tests/unit/sdk/python/feast/test_repo_operations_validate_feast_project_name.py new file mode 100644 index 0000000000..ba4a60ddc0 --- /dev/null +++ b/sdk/python/tests/unit/sdk/python/feast/test_repo_operations_validate_feast_project_name.py @@ -0,0 +1,26 @@ +from sdk.python.feast.repo_operations import is_valid_name + + +def test_is_valid_name(): + test_cases = [ + # Valid project name cases + ("valid_name1", True), + ("username_1234", True), + ("valid123", True), + ("1234567890123456", True), + ("invalid_name_", True), + ("12345678901234567", True), + ("too_long_name_123", True), + # Invalid project name cases + ("_invalidName", False), + ("invalid-Name", False), + ("invalid name", False), + ("invalid@name", False), + ("invalid$name", False), + ("__", False), + ] + + for name, expected in test_cases: + assert ( + is_valid_name(name) == expected + ), f"Failed for project invalid name: {name}"