Skip to content

test: add unit tests for Azure OpenAI path in OpenAIEmbeddingFunction#6760

Open
satishkc7 wants to merge 2 commits intochroma-core:mainfrom
satishkc7:fix/azure-openai-embedding-azure-deployment
Open

test: add unit tests for Azure OpenAI path in OpenAIEmbeddingFunction#6760
satishkc7 wants to merge 2 commits intochroma-core:mainfrom
satishkc7:fix/azure-openai-embedding-azure-deployment

Conversation

@satishkc7
Copy link
Copy Markdown

Closes #1770

The underlying bug (missing azure_deployment when constructing AzureOpenAI) was fixed in a prior refactor — deployment_id is now accepted and forwarded as azure_deployment. However, there were no tests covering this path at all.

This PR adds 10 unit tests in chromadb/test/ef/test_openai_azure_ef.py that cover:

ValidationValueError is raised with a clear message when any required Azure param is missing:

  • api_version not specified
  • deployment_id not specified
  • api_base not specified

Client constructionAzureOpenAI is instantiated with the correct keyword arguments:

  • azure_deployment receives deployment_id
  • azure_endpoint receives api_base
  • api_version, api_key, and default_headers are forwarded correctly

Config round-tripget_config() persists deployment_id, and build_from_config() restores the same Azure parameters.

All tests mock the openai package so they run without a real API key.

@github-actions
Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Copy Markdown
Contributor

propel-code-bot bot commented Mar 27, 2026

Add Azure OpenAI path unit tests for OpenAIEmbeddingFunction

This PR adds a new test module to cover the Azure OpenAI path in OpenAIEmbeddingFunction, focusing on validation, client construction, and config round-trip behavior. The tests mock openai clients and environment variables to run without real credentials.

This summary was automatically generated by @propel-code-bot

propel-code-bot[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

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

Review found no issues with the added Azure OpenAI test coverage.

Status: No Issues Found | Risk: Low

Review Details

📁 1 files reviewed | 💬 0 comments

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.

[Bug]: When using AzureOpenAI for embedding azure_deployment needs to be provided as well

1 participant