Skip to content

test: Macae v4 unittestcases kd#753

Merged
Roopan-Microsoft merged 33 commits intodev-v4from
macae-v4-unittestcases-kd
Jan 22, 2026
Merged

test: Macae v4 unittestcases kd#753
Roopan-Microsoft merged 33 commits intodev-v4from
macae-v4-unittestcases-kd

Conversation

@Kingshuk-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces significant improvements to testing infrastructure, test coverage, and code organization for the backend, especially in the authentication module. The main changes include adding comprehensive unit and integration tests for authentication utilities, updating test configuration for better maintainability and coverage, and refactoring imports for clarity and correctness.

Testing Infrastructure & Coverage Improvements:

  • Added a .coveragerc configuration file to standardize code coverage measurement, specifying source directories, files to omit, and exclusion patterns for coverage reporting.
  • Updated the GitHub Actions workflow (.github/workflows/test.yml) to use the new coverage configuration and simplified ignore patterns for test execution.
  • Enhanced pytest.ini with explicit Python paths, test discovery patterns, and test class/function naming conventions for improved test discovery and execution.

Authentication Module Testing:

  • Added comprehensive unit and integration tests for backend.auth.auth_utils in src/tests/backend/auth/test_auth_utils.py, covering various scenarios including valid/invalid headers, base64 decoding, error handling, and integration flows.
  • Introduced fixtures and test configuration in src/tests/backend/auth/conftest.py to support reusable test data and setup for authentication tests.
  • Created empty __init__.py files for test packages to ensure correct package recognition and import behavior by pytest. [1] [2]

Code Organization & Import Refactoring:

  • Refactored relative imports to absolute imports within backend modules for clarity and to prevent import errors, especially in settings.py, messages.py, and plan_to_mplan_converter.py. [1] [2] [3]
  • Added placeholder __init__.py files to src and src/backend to clarify package structure. [1] [2]

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install

What to Check

Verify that the following are valid

  • ...

Other Information

Dhruvkumar-Microsoft and others added 3 commits December 10, 2025 10:43
- Implemented unit tests for the OrchestrationManager class to ensure proper functionality.
- Mocked external dependencies including Azure services and agent framework components.
- Covered various scenarios including orchestration initialization, agent creation, and event processing.
- Added tests for error handling in orchestration execution and WebSocket communication.
- Ensured proper participant mapping and workflow execution in orchestration methods.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request significantly enhances the testing infrastructure and test coverage for the backend, particularly focusing on v4 orchestration, magentic agents, configuration, and common services. The changes introduce comprehensive unit tests with extensive mocking strategies to test complex async workflows, agent lifecycle management, configuration handling, and service integrations.

Key Changes:

  • Added comprehensive test suites for orchestration components (human approval manager, plan converter), magentic agents (proxy agent, factory, foundry agent, lifecycle), and configuration modules (settings, agent registry)
  • Enhanced testing infrastructure with proper test discovery patterns, coverage configuration, and GitHub Actions workflow updates
  • Refactored import statements from relative to absolute paths for improved clarity and maintainability

Reviewed changes

Copilot reviewed 44 out of 46 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/tests/backend/v4/orchestration/test_human_approval_manager.py Comprehensive tests for human approval workflows with 701 lines covering plan approval, timeouts, and error handling
src/tests/backend/v4/orchestration/helper/test_plan_to_mplan_converter.py Tests for plan-to-MPlan conversion logic including bullet parsing and agent extraction
src/tests/backend/v4/magentic_agents/test_proxy_agent.py Tests for proxy agent functionality including clarification requests and timeout handling
src/tests/backend/v4/magentic_agents/test_magentic_agent_factory.py Tests for agent factory including model validation and configuration error handling
src/tests/backend/v4/magentic_agents/test_foundry_agent.py Tests for foundry agent covering Azure Search integration and tool collection
src/tests/backend/v4/magentic_agents/models/test_agent_models.py Tests for MCP and Search configuration dataclasses
src/tests/backend/v4/magentic_agents/common/test_lifecycle.py Tests for agent lifecycle management including registration and cleanup
src/tests/backend/v4/config/test_settings.py Tests for configuration classes covering Azure, MCP, orchestration, and connection configs
src/tests/backend/v4/config/test_agent_registry.py Tests for agent registry including thread-safety and weak reference behavior
src/tests/backend/v4/common/services/test_team_service.py Tests for team service including CRUD operations and validation
src/tests/backend/v4/common/services/test_foundry_service.py Tests for foundry service covering client management and model deployments
src/backend/v4/orchestration/helper/plan_to_mplan_converter.py Import path fix from relative to absolute import
__init__.py files Added empty init files for proper package recognition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/backend/v4/orchestration/helper/plan_to_mplan_converter.py
Comment thread src/tests/backend/v4/magentic_agents/test_foundry_agent.py Outdated
Comment thread src/tests/backend/v4/magentic_agents/test_foundry_agent.py Outdated
Comment thread src/tests/backend/v4/config/test_settings.py Outdated
Comment thread src/tests/backend/v4/config/test_settings.py Outdated
Copy link
Copy Markdown
Contributor

@AjitPadhi-Microsoft AjitPadhi-Microsoft left a comment

Choose a reason for hiding this comment

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

@Kingshuk-Microsoft Added few review comment please check

Comment thread .github/workflows/test.yml Outdated
Comment thread src/tests/backend/v4/orchestration/__init__.py Outdated
…les mocking with MagicMock and removing platform-specific skip markers.
…and clarity. Update test cases to ensure proper environment setup and enhance coverage for user language endpoint functionality.
…ve platform-specific skip markers and enhance mock setup for cross-platform compatibility.
@Roopan-Microsoft Roopan-Microsoft merged commit eb5d8f1 into dev-v4 Jan 22, 2026
4 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

🎉 This PR is included in version 4.0.7 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants