Skip to content

feat: backend unit test part II #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 26, 2025
Merged

Conversation

VishalS-Microsoft
Copy link
Contributor

Purpose

This pull request introduces several changes, primarily focusing on adding test coverage for various modules, refining abstract methods in the storage interface, and improving the structure of test files. Below is a summary of the most important changes grouped by theme:

Test Coverage Enhancements

  • Added comprehensive unit tests for auth_utils, including scenarios for tenant ID extraction, user details initialization, and user authentication (src/tests/backend/api/auth/auth_utils_test.py).
  • Introduced tests for status_updates, covering WebSocket connection management, status update sending, and connection closure (src/tests/backend/api/status_updates_test.py).
  • Added tests for SQL agent classes, including BaseSQLAgent, FixerAgent, MigratorAgent, and PickerAgent, to validate their properties, behaviors, and response handling (src/tests/backend/sql_agents/agents/agent_base_test.py, src/tests/backend/sql_agents/agents/fixer/fixer_agent_test.py, src/tests/backend/sql_agents/agents/migrator/migrator_agent_test.py, src/tests/backend/sql_agents/agents/picker/picker_agent_test.py). [1] [2] [3] [4]
  • Added tests for agent responses, including FixerResponse and MigratorResponse, to ensure proper validation and handling of optional fields (src/tests/backend/sql_agents/agents/fixer/fixer_response_test.py, src/tests/backend/sql_agents/agents/migrator/migrator_response_test.py). [1] [2]
  • Implemented tests for the SQLAgentFactory class to validate agent creation and error handling for invalid agent types (src/tests/backend/sql_agents/agents/agent_factory_test.py).

Abstract Method Refinements

  • Updated abstract methods (upload_file, get_file, delete_file, list_files) in blob_base.py to include # pragma: no cover to exclude them from coverage reports, as they are meant to be implemented by subclasses (src/backend/common/storage/blob_base.py). [1] [2] [3] [4]
  • Added # pragma: no cover for the convert_script function in convert_script.py to exclude it from coverage since it serves as an entry point (src/backend/sql_agents/convert_script.py).

Test File Cleanup

  • Removed unnecessary sys.path manipulation and # noqa comments in cosmosdb_test.py, simplifying the test file structure (src/tests/backend/common/database/cosmosdb_test.py).

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

@Roopan-Microsoft Roopan-Microsoft merged commit a753efe into hotfix May 26, 2025
6 checks passed
@Roopan-Microsoft Roopan-Microsoft deleted the psl-backend-unit-test-part-II branch May 26, 2025 12:55
Sign up for free to 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.

4 participants