diff --git a/scripts/gen_doc.py b/scripts/gen_doc.py index 892960b4..145a790d 100755 --- a/scripts/gen_doc.py +++ b/scripts/gen_doc.py @@ -7,6 +7,8 @@ import ast from pathlib import Path +DIRECTORIES = ["src", "tests/unit", "tests/integration", "tests/e2e"] + def generate_docfile(directory): """Generate README.md in the CWD.""" @@ -48,10 +50,17 @@ def generate_documentation_on_path(path): def main(): """Entry point to this script, regenerates documentation in all directories.""" - generate_documentation_on_path("src/") - for path in Path("src").rglob("*"): - if path.is_dir(): - generate_documentation_on_path(path) + for directory in DIRECTORIES: + generate_documentation_on_path(f"{directory}/") + for path in Path(directory).rglob("*"): + if path.is_dir(): + if ( + path.name == "lightspeed_stack.egg-info" + or path.name == "__pycache__" + or ".ruff_cache" in str(path) + ): + continue + generate_documentation_on_path(path) if __name__ == "__main__": diff --git a/tests/e2e/README.md b/tests/e2e/README.md new file mode 100644 index 00000000..12a42bef --- /dev/null +++ b/tests/e2e/README.md @@ -0,0 +1,11 @@ +# List of source files stored in `tests/e2e/` directory + +## [__init__.py](__init__.py) +End-to-end tests for the lightspeed-stack REST API service. + +## [gen_scenario_list.py](gen_scenario_list.py) +Scenario list generator. + +## [test_api.py](test_api.py) +End-to-end tests for basic REST API endpoints. + diff --git a/tests/e2e/__init__.py b/tests/e2e/__init__.py index 7c17339b..1a2c5553 100644 --- a/tests/e2e/__init__.py +++ b/tests/e2e/__init__.py @@ -1 +1 @@ -"""End to end tests for the lightspeed-stack REST API service.""" +"""End-to-end tests for the lightspeed-stack REST API service.""" diff --git a/tests/e2e/configs/README.md b/tests/e2e/configs/README.md new file mode 100644 index 00000000..7f1a9f7a --- /dev/null +++ b/tests/e2e/configs/README.md @@ -0,0 +1,2 @@ +# List of source files stored in `tests/e2e/configs` directory + diff --git a/tests/e2e/configuration/README.md b/tests/e2e/configuration/README.md new file mode 100644 index 00000000..db6f5a44 --- /dev/null +++ b/tests/e2e/configuration/README.md @@ -0,0 +1,2 @@ +# List of source files stored in `tests/e2e/configuration` directory + diff --git a/tests/e2e/features/README.md b/tests/e2e/features/README.md new file mode 100644 index 00000000..33a56606 --- /dev/null +++ b/tests/e2e/features/README.md @@ -0,0 +1,5 @@ +# List of source files stored in `tests/e2e/features` directory + +## [environment.py](environment.py) +Code to be called before and after certain events during testing. + diff --git a/tests/e2e/features/steps/README.md b/tests/e2e/features/steps/README.md new file mode 100644 index 00000000..d504b9fb --- /dev/null +++ b/tests/e2e/features/steps/README.md @@ -0,0 +1,29 @@ +# List of source files stored in `tests/e2e/features/steps` directory + +## [__init__.py](__init__.py) +Implementation of end-to-end tests steps. + +## [auth.py](auth.py) +Implementation of common test steps. + +## [common.py](common.py) +Implementation of common test steps. + +## [common_http.py](common_http.py) +Common steps for HTTP-related operations. + +## [conversation.py](conversation.py) +Implementation of common test steps. + +## [feedback.py](feedback.py) +Implementation of common test steps for the feedback API. + +## [health.py](health.py) +Implementation of common test steps. + +## [info.py](info.py) +Implementation of common test steps. + +## [llm_query_response.py](llm_query_response.py) +LLM query and response steps. + diff --git a/tests/e2e/features/steps/__init__.py b/tests/e2e/features/steps/__init__.py index 9f9c392f..ac4b597e 100644 --- a/tests/e2e/features/steps/__init__.py +++ b/tests/e2e/features/steps/__init__.py @@ -1 +1 @@ -"""Implementation of end to end tests steps.""" +"""Implementation of end-to-end tests steps.""" diff --git a/tests/e2e/features/steps/common_http.py b/tests/e2e/features/steps/common_http.py index 2f244933..d29f6075 100644 --- a/tests/e2e/features/steps/common_http.py +++ b/tests/e2e/features/steps/common_http.py @@ -1,4 +1,4 @@ -"""Common steps for HTTP related operations.""" +"""Common steps for HTTP-related operations.""" import json diff --git a/tests/e2e/test_api.py b/tests/e2e/test_api.py index 5fe29398..7786c6fa 100644 --- a/tests/e2e/test_api.py +++ b/tests/e2e/test_api.py @@ -1 +1 @@ -"""Integration tests for basic REST API endpoints.""" +"""End-to-end tests for basic REST API endpoints.""" diff --git a/tests/e2e/utils/README.md b/tests/e2e/utils/README.md new file mode 100644 index 00000000..55f6e87d --- /dev/null +++ b/tests/e2e/utils/README.md @@ -0,0 +1,5 @@ +# List of source files stored in `tests/e2e/utils` directory + +## [utils.py](utils.py) +Unsorted utility functions to be used from other sources and test step definitions. + diff --git a/tests/integration/README.md b/tests/integration/README.md new file mode 100644 index 00000000..71715e56 --- /dev/null +++ b/tests/integration/README.md @@ -0,0 +1,17 @@ +# List of source files stored in `tests/integration/` directory + +## [__init__.py](__init__.py) +Integration tests. + +## [conftest.py](conftest.py) +Shared fixtures for integration tests. + +## [test_configuration.py](test_configuration.py) +Integration tests for configuration loading and handling. + +## [test_openapi_json.py](test_openapi_json.py) +Tests the OpenAPI specification that is to be stored in docs/openapi.json. + +## [test_version.py](test_version.py) +Test if version is handled correctly. + diff --git a/tests/integration/endpoints/README.md b/tests/integration/endpoints/README.md new file mode 100644 index 00000000..3cd57f3d --- /dev/null +++ b/tests/integration/endpoints/README.md @@ -0,0 +1,14 @@ +# List of source files stored in `tests/integration/endpoints` directory + +## [__init__.py](__init__.py) +Integration tests for API endpoints. + +## [test_config_integration.py](test_config_integration.py) +Integration tests for the /config endpoint. + +## [test_health_integration.py](test_health_integration.py) +Integration tests for the /health endpoint. + +## [test_info_integration.py](test_info_integration.py) +Integration tests for the /info endpoint. + diff --git a/tests/unit/README.md b/tests/unit/README.md new file mode 100644 index 00000000..61a41ed6 --- /dev/null +++ b/tests/unit/README.md @@ -0,0 +1,26 @@ +# List of source files stored in `tests/unit/` directory + +## [__init__.py](__init__.py) +Unit tests. + +## [conftest.py](conftest.py) +Shared pytest fixtures for unit tests. + +## [test_client.py](test_client.py) +Unit tests for functions defined in src/client.py. + +## [test_configuration.py](test_configuration.py) +Unit tests for functions defined in src/configuration.py. + +## [test_configuration_unknown_fields.py](test_configuration_unknown_fields.py) +Test configuration validation for unknown fields. + +## [test_lightspeed_stack.py](test_lightspeed_stack.py) +Unit tests for functions defined in src/lightspeed_stack.py. + +## [test_llama_stack_configuration.py](test_llama_stack_configuration.py) +Unit tests for functions defined in src/llama_stack_configuration.py. + +## [test_log.py](test_log.py) +Unit tests for functions defined in src/log.py. + diff --git a/tests/unit/app/README.md b/tests/unit/app/README.md new file mode 100644 index 00000000..2c4395bd --- /dev/null +++ b/tests/unit/app/README.md @@ -0,0 +1,11 @@ +# List of source files stored in `tests/unit/app` directory + +## [__init__.py](__init__.py) +Init of tests/unit/app. + +## [test_database.py](test_database.py) +Unit tests for app.database module. + +## [test_routers.py](test_routers.py) +Unit tests for routers.py. + diff --git a/tests/unit/app/endpoints/README.md b/tests/unit/app/endpoints/README.md new file mode 100644 index 00000000..636dad17 --- /dev/null +++ b/tests/unit/app/endpoints/README.md @@ -0,0 +1,53 @@ +# List of source files stored in `tests/unit/app/endpoints` directory + +## [__init__.py](__init__.py) +Unit tests for endpoints implementations. + +## [test_authorized.py](test_authorized.py) +Unit tests for the /authorized REST API endpoint. + +## [test_config.py](test_config.py) +Unit tests for the /config REST API endpoint. + +## [test_conversations.py](test_conversations.py) +Unit tests for the /conversations REST API endpoints. + +## [test_conversations_v2.py](test_conversations_v2.py) +Unit tests for the /conversations REST API endpoints. + +## [test_feedback.py](test_feedback.py) +Unit tests for the /feedback REST API endpoint. + +## [test_health.py](test_health.py) +Unit tests for the /health REST API endpoint. + +## [test_info.py](test_info.py) +Unit tests for the /info REST API endpoint. + +## [test_metrics.py](test_metrics.py) +Unit tests for the /metrics REST API endpoint. + +## [test_models.py](test_models.py) +Unit tests for the /models REST API endpoint. + +## [test_providers.py](test_providers.py) +Unit tests for the /providers REST API endpoints. + +## [test_query.py](test_query.py) +Unit tests for the /query REST API endpoint. + +## [test_query_v2.py](test_query_v2.py) +Unit tests for the /query (v2) REST API endpoint using Responses API. + +## [test_root.py](test_root.py) +Unit tests for the / endpoint handler. + +## [test_shields.py](test_shields.py) +Unit tests for the /shields REST API endpoint. + +## [test_streaming_query.py](test_streaming_query.py) +Unit tests for the /streaming-query REST API endpoint. + +## [test_tools.py](test_tools.py) +Unit tests for tools endpoint. + diff --git a/tests/unit/authentication/README.md b/tests/unit/authentication/README.md new file mode 100644 index 00000000..95b3d398 --- /dev/null +++ b/tests/unit/authentication/README.md @@ -0,0 +1,23 @@ +# List of source files stored in `tests/unit/authentication` directory + +## [__init__.py](__init__.py) +Authentication unit tests package. + +## [test_auth.py](test_auth.py) +Unit tests for functions defined in authentication/__init__.py + +## [test_jwk_token.py](test_jwk_token.py) +Unit tests for functions defined in authentication/jwk_token.py + +## [test_k8s.py](test_k8s.py) +Unit tests for authentication/k8s module. + +## [test_noop.py](test_noop.py) +Unit tests for functions defined in authentication/noop.py + +## [test_noop_with_token.py](test_noop_with_token.py) +Unit tests for functions defined in authentication/noop_with_token.py + +## [test_utils.py](test_utils.py) +Unit tests for functions defined in authentication/utils.py + diff --git a/tests/unit/authorization/README.md b/tests/unit/authorization/README.md new file mode 100644 index 00000000..41b1265e --- /dev/null +++ b/tests/unit/authorization/README.md @@ -0,0 +1,11 @@ +# List of source files stored in `tests/unit/authorization` directory + +## [__init__.py](__init__.py) +Unit tests for authorization module. + +## [test_middleware.py](test_middleware.py) +Unit tests for the authorization middleware. + +## [test_resolvers.py](test_resolvers.py) +Unit tests for the authorization resolvers. + diff --git a/tests/unit/cache/README.md b/tests/unit/cache/README.md new file mode 100644 index 00000000..58f3b65b --- /dev/null +++ b/tests/unit/cache/README.md @@ -0,0 +1,17 @@ +# List of source files stored in `tests/unit/cache` directory + +## [__init__.py](__init__.py) +Test cases for conversation history cache implementations. + +## [test_cache_factory.py](test_cache_factory.py) +Unit tests for CacheFactory class. + +## [test_noop_cache.py](test_noop_cache.py) +Unit tests for NoopCache class. + +## [test_postgres_cache.py](test_postgres_cache.py) +Unit tests for PostgreSQL cache implementation. + +## [test_sqlite_cache.py](test_sqlite_cache.py) +Unit tests for SQLite cache implementation. + diff --git a/tests/unit/metrics/README.md b/tests/unit/metrics/README.md new file mode 100644 index 00000000..94369fce --- /dev/null +++ b/tests/unit/metrics/README.md @@ -0,0 +1,8 @@ +# List of source files stored in `tests/unit/metrics` directory + +## [__init__.py](__init__.py) +Unit tests for metrics. + +## [test_utis.py](test_utis.py) +Unit tests for functions defined in metrics/utils.py + diff --git a/tests/unit/models/README.md b/tests/unit/models/README.md new file mode 100644 index 00000000..9e8eba75 --- /dev/null +++ b/tests/unit/models/README.md @@ -0,0 +1,5 @@ +# List of source files stored in `tests/unit/models` directory + +## [__init__.py](__init__.py) +Unit tests for models. + diff --git a/tests/unit/models/config/README.md b/tests/unit/models/config/README.md new file mode 100644 index 00000000..85be30dd --- /dev/null +++ b/tests/unit/models/config/README.md @@ -0,0 +1,59 @@ +# List of source files stored in `tests/unit/models/config` directory + +## [__init__.py](__init__.py) +Unit tests for models defined in config.py. + +## [test_authentication_configuration.py](test_authentication_configuration.py) +Unit tests for AuthenticationConfiguration model. + +## [test_byok_rag.py](test_byok_rag.py) +Unit tests for ByokRag model. + +## [test_conversation_cache.py](test_conversation_cache.py) +Unit tests for ConversationCacheConfiguration model. + +## [test_cors.py](test_cors.py) +Unit tests for CORSConfiguration model. + +## [test_customization.py](test_customization.py) +Unit tests for Customization model. + +## [test_database_configuration.py](test_database_configuration.py) +Unit tests for DatabaseConfiguration model. + +## [test_dump_configuration.py](test_dump_configuration.py) +Unit tests checking ability to dump configuration. + +## [test_inference_configuration.py](test_inference_configuration.py) +Unit tests for InferenceConfiguration model. + +## [test_jwt_role_rule.py](test_jwt_role_rule.py) +Unit tests for JwtRoleRule model. + +## [test_llama_stack_configuration.py](test_llama_stack_configuration.py) +Unit tests for LlamaStackConfiguration model. + +## [test_model_context_protocol_server.py](test_model_context_protocol_server.py) +Unit tests for ModelContextProtocolServer model. + +## [test_postgresql_database_configuration.py](test_postgresql_database_configuration.py) +Unit tests for PostgreSQLDatabaseConfiguration model. + +## [test_quota_handlers_config.py](test_quota_handlers_config.py) +Unit tests for QuotaHandlersConfiguration model. + +## [test_quota_limiter_config.py](test_quota_limiter_config.py) +Unit tests for QuotaLimiterConfig model. + +## [test_quota_scheduler_config.py](test_quota_scheduler_config.py) +Unit tests for QuotaSchedulerConfig model. + +## [test_service_configuration.py](test_service_configuration.py) +Unit tests for ServiceConfiguration model. + +## [test_tls_configuration.py](test_tls_configuration.py) +Unit tests for TLSConfiguration model. + +## [test_user_data_collection.py](test_user_data_collection.py) +Unit tests for UserDataCollection model. + diff --git a/tests/unit/models/requests/README.md b/tests/unit/models/requests/README.md new file mode 100644 index 00000000..6f46f33c --- /dev/null +++ b/tests/unit/models/requests/README.md @@ -0,0 +1,17 @@ +# List of source files stored in `tests/unit/models/requests` directory + +## [__init__.py](__init__.py) +Unit tests for models defined in requests.py. + +## [test_attachment.py](test_attachment.py) +Unit tests for Attachment model. + +## [test_feedback_request.py](test_feedback_request.py) +Unit tests for FeedbackRequest model. + +## [test_feedback_status_update_request.py](test_feedback_status_update_request.py) +Unit tests for FeedbackStatusUpdateRequest model. + +## [test_query_request.py](test_query_request.py) +Unit tests for QueryRequest model. + diff --git a/tests/unit/models/responses/README.md b/tests/unit/models/responses/README.md new file mode 100644 index 00000000..78d6c1fc --- /dev/null +++ b/tests/unit/models/responses/README.md @@ -0,0 +1,20 @@ +# List of source files stored in `tests/unit/models/responses` directory + +## [__init__.py](__init__.py) +Unit tests for models defined in responses.py. + +## [test_authorized_response.py](test_authorized_response.py) +Unit tests for AuthorizedResponse model. + +## [test_query_response.py](test_query_response.py) +Unit tests for QueryResponse model. + +## [test_rag_chunk.py](test_rag_chunk.py) +Unit tests for RAGChunk model. + +## [test_status_response.py](test_status_response.py) +Unit tests for StatusResponse model. + +## [test_unauthorized_response.py](test_unauthorized_response.py) +Unit tests for UnauthorizedResponse model. + diff --git a/tests/unit/quota/README.md b/tests/unit/quota/README.md new file mode 100644 index 00000000..fd1febf1 --- /dev/null +++ b/tests/unit/quota/README.md @@ -0,0 +1,23 @@ +# List of source files stored in `tests/unit/quota` directory + +## [__init__.py](__init__.py) +Unit tests for quota limiters. + +## [test_cluster_quota_limiter.py](test_cluster_quota_limiter.py) +Unit tests for ClusterQuotaLimiter class. + +## [test_connect_pg.py](test_connect_pg.py) +Unit tests for PostgreSQL connection handler. + +## [test_connect_sqlite.py](test_connect_sqlite.py) +Unit tests for SQLite connection handler. + +## [test_quota_exceed_error.py](test_quota_exceed_error.py) +Unit tests for QuotaExceedError class. + +## [test_quota_limiter_factory.py](test_quota_limiter_factory.py) +Unit tests for quota limiter factory class. + +## [test_user_quota_limiter.py](test_user_quota_limiter.py) +Unit tests for UserQuotaLimiter class. + diff --git a/tests/unit/runners/README.md b/tests/unit/runners/README.md new file mode 100644 index 00000000..33ffdcab --- /dev/null +++ b/tests/unit/runners/README.md @@ -0,0 +1,8 @@ +# List of source files stored in `tests/unit/runners` directory + +## [__init__.py](__init__.py) +Unit tests for runners. + +## [test_uvicorn_runner.py](test_uvicorn_runner.py) +Unit tests for the Uvicorn runner implementation. + diff --git a/tests/unit/runners/test_uvicorn_runner.py b/tests/unit/runners/test_uvicorn_runner.py index fc44811e..33691d1b 100644 --- a/tests/unit/runners/test_uvicorn_runner.py +++ b/tests/unit/runners/test_uvicorn_runner.py @@ -1,4 +1,4 @@ -"""Unit tests for runners.""" +"""Unit tests for the Uvicorn runner implementation.""" from pathlib import Path from pytest_mock import MockerFixture diff --git a/tests/unit/utils/README.md b/tests/unit/utils/README.md new file mode 100644 index 00000000..12f2d5bd --- /dev/null +++ b/tests/unit/utils/README.md @@ -0,0 +1,35 @@ +# List of source files stored in `tests/unit/utils` directory + +## [__init__.py](__init__.py) +Init of tests/unit/utils. + +## [auth_helpers.py](auth_helpers.py) +Helper functions for mocking authorization in tests. + +## [test_checks.py](test_checks.py) +Unit tests for functions defined in utils/checks module. + +## [test_common.py](test_common.py) +Test module for utils/common.py. + +## [test_connection_decorator.py](test_connection_decorator.py) +Unit tests for the connection decorator. + +## [test_endpoints.py](test_endpoints.py) +Unit tests for endpoints utility functions. + +## [test_llama_stack_version.py](test_llama_stack_version.py) +Unit tests for utility function to check Llama Stack version. + +## [test_mcp_headers.py](test_mcp_headers.py) +Unit tests for MCP headers utility functions. + +## [test_suid.py](test_suid.py) +Unit tests for functions defined in utils.suid module. + +## [test_transcripts.py](test_transcripts.py) +Unit tests for functions defined in utils.transcripts module. + +## [test_types.py](test_types.py) +Unit tests for functions defined in utils/types.py. +