Skip to content

Commit

Permalink
Add test for MI auth
Browse files Browse the repository at this point in the history
  • Loading branch information
abhahn committed Aug 5, 2024
1 parent a474b71 commit 7b19a71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/integration_tests/dotenv_templates/dotenv.jinja2
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
DATASOURCE_TYPE={{ DATASOURCE_TYPE }}
AZURE_OPENAI_ENDPOINT={{ AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_MODEL={{ AZURE_OPENAI_MODEL }}
{% if not USE_MI %}
AZURE_OPENAI_KEY={{ AZURE_OPENAI_KEY }}
{% endif %}
AZURE_OPENAI_TEMPERATURE=0
AZURE_OPENAI_TOP_P=1.0
AZURE_OPENAI_MAX_TOKENS=1000
Expand All @@ -14,8 +16,10 @@ AZURE_OPENAI_EMBEDDING_NAME={{ AZURE_OPENAI_EMBEDDING_NAME }}
{% endif %}
{% if USE_AOAI_EMBEDDINGS %}
AZURE_OPENAI_EMBEDDING_ENDPOINT={{ AZURE_OPENAI_ENDPOINT }}/openai/deployments/ada/embeddings?api-version=2023-03-15-preview
{% if not USE_MI %}
AZURE_OPENAI_EMBEDDING_KEY={{ AZURE_OPENAI_KEY }}
{% endif %}
{% endif %}
{% if ENABLE_CHAT_HISTORY %}
AZURE_COSMOSDB_ACCOUNT={{ AZURE_COSMOSDB_ACCOUNT }}
AZURE_COSMOSDB_DATABASE={{ AZURE_COSMOSDB_DATABASE }}
Expand Down
8 changes: 7 additions & 1 deletion tests/integration_tests/test_datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def use_aoai_embeddings(request):
def use_elasticsearch_embeddings(request):
return request.param

@pytest.fixture(scope="function", params=[True, False], ids=["use_mi", "use_keys"])
def use_mi(request):
return request.param


@pytest.fixture(scope="function")
def dotenv_rendered_template_path(
Expand All @@ -73,7 +77,8 @@ def dotenv_rendered_template_path(
enable_chat_history,
stream,
use_aoai_embeddings,
use_elasticsearch_embeddings
use_elasticsearch_embeddings,
use_mi
):
rendered_template_name = request.node.name.replace("[", "_").replace("]", "_")
template_path = os.path.join(
Expand All @@ -92,6 +97,7 @@ def dotenv_rendered_template_path(
dotenv_template_params["USE_ELASTICSEARCH_EMBEDDINGS"] = use_elasticsearch_embeddings

dotenv_template_params["USE_AOAI_EMBEDDINGS"] = use_aoai_embeddings
dotenv_template_params["USE_MI"] = use_mi

if use_aoai_embeddings or use_elasticsearch_embeddings:
dotenv_template_params["AZURE_SEARCH_QUERY_TYPE"] = "vector"
Expand Down

0 comments on commit 7b19a71

Please sign in to comment.