Skip to content

Commit

Permalink
INTPYTHON-445 Enable integration tests (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Dec 6, 2024
1 parent 3d57a64 commit 1283d29
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ jobs:

- name: Run integration tests
env:
MONGODB_ATLAS_URI: ${{ secrets.MONGODB_ATLAS_URI }}
MONGODB_URI: ${{ secrets.MONGODB_ATLAS_URI }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: make integration_tests
working-directory: ${{ inputs.working-directory }}

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ jobs:
run: |
make test
- name: Run integration tests
env:
MONGODB_URI: ${{ secrets.MONGODB_ATLAS_URI }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
[[ "${{ github.repository_owner }}" == "langchain-ai" ]] && make integration_tests || true
working-directory: ${{ inputs.working-directory }}

- name: Ensure the tests did not create any additional files
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion libs/mongodb/tests/integration_tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from ..utils import ConsistentFakeEmbeddings, FakeChatModel, FakeLLM

CONN_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONN_STRING = os.environ.get("MONGODB_URI")
INDEX_NAME = "langchain-test-index-semantic-cache"
DATABASE = "langchain_test_db"
COLLECTION = "langchain_test_cache"
Expand Down
4 changes: 2 additions & 2 deletions libs/mongodb/tests/integration_tests/test_chain_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from ..utils import PatchedMongoDBAtlasVectorSearch

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
COLLECTION_NAME = "langchain_test_chain_example"
INDEX_NAME = "langchain-test-chain-example-vector-index"
Expand Down Expand Up @@ -61,7 +61,7 @@ def test_chain(
Follows example in the docs: https://python.langchain.com/docs/how_to/hybrid/
Requires OpenAI_API_KEY for embedding and chat model.
Requires INDEX_NAME to have been set up on MONGODB_ATLAS_URI
Requires INDEX_NAME to have been set up on MONGODB_URI
"""

from langchain_openai import ChatOpenAI, OpenAIEmbeddings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
COLLECTION = "langchain_test_chat"

# Replace these with your mongodb connection string
connection_string = os.environ.get("MONGODB_ATLAS_URI", "")
connection_string = os.environ.get("MONGODB_URI", "")


def test_memory_with_message_store() -> None:
Expand Down
2 changes: 1 addition & 1 deletion libs/mongodb/tests/integration_tests/test_docstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from langchain_mongodb.docstores import MongoDBDocStore

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
COLLECTION_NAME = "langchain_test_docstore"

Expand Down
2 changes: 1 addition & 1 deletion libs/mongodb/tests/integration_tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@pytest.fixture
def collection() -> Generator:
"""Depending on uri, this could point to any type of cluster."""
uri = os.environ.get("MONGODB_ATLAS_URI")
uri = os.environ.get("MONGODB_URI")
client: MongoClient = MongoClient(uri)
client[DB_NAME].create_collection(COLLECTION_NAME)
clxn = client[DB_NAME][COLLECTION_NAME]
Expand Down
2 changes: 1 addition & 1 deletion libs/mongodb/tests/integration_tests/test_mmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
COLLECTION_NAME = "langchain_test_vectorstores"
INDEX_NAME = "langchain-test-index-vectorstores"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
COLLECTION_NAME = "langchain_test_parent_document_combined"
VECTOR_INDEX_NAME = "langchain-test-parent-document-vector-index"
Expand Down
2 changes: 1 addition & 1 deletion libs/mongodb/tests/integration_tests/test_retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from ..utils import PatchedMongoDBAtlasVectorSearch

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
COLLECTION_NAME = "langchain_test_retrievers"
VECTOR_INDEX_NAME = "vector_index"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
INDEX_NAME = "langchain-test-index-vectorstores"
COLLECTION_NAME = "langchain_test_vectorstores"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
COLLECTION_NAME = "langchain_test_from_documents"
INDEX_NAME = "langchain-test-index-from-documents"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch

CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
CONNECTION_STRING = os.environ.get("MONGODB_URI")
DB_NAME = "langchain_test_db"
COLLECTION_NAME = "langchain_test_from_texts"
INDEX_NAME = "langchain-test-index-from-texts"
Expand Down

0 comments on commit 1283d29

Please sign in to comment.