Skip to content

Commit 1283d29

Browse files
authored
INTPYTHON-445 Enable integration tests (#24)
1 parent 3d57a64 commit 1283d29

13 files changed

+22
-13
lines changed

.github/workflows/_release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ jobs:
167167

168168
- name: Run integration tests
169169
env:
170-
MONGODB_ATLAS_URI: ${{ secrets.MONGODB_ATLAS_URI }}
170+
MONGODB_URI: ${{ secrets.MONGODB_ATLAS_URI }}
171+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
171172
run: make integration_tests
172173
working-directory: ${{ inputs.working-directory }}
173174

.github/workflows/_test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ jobs:
4646
run: |
4747
make test
4848
49+
- name: Run integration tests
50+
env:
51+
MONGODB_URI: ${{ secrets.MONGODB_ATLAS_URI }}
52+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
53+
run: |
54+
[[ "${{ github.repository_owner }}" == "langchain-ai" ]] && make integration_tests || true
55+
working-directory: ${{ inputs.working-directory }}
56+
4957
- name: Ensure the tests did not create any additional files
5058
shell: bash
5159
run: |

libs/mongodb/tests/integration_tests/test_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from ..utils import ConsistentFakeEmbeddings, FakeChatModel, FakeLLM
1515

16-
CONN_STRING = os.environ.get("MONGODB_ATLAS_URI")
16+
CONN_STRING = os.environ.get("MONGODB_URI")
1717
INDEX_NAME = "langchain-test-index-semantic-cache"
1818
DATABASE = "langchain_test_db"
1919
COLLECTION = "langchain_test_cache"

libs/mongodb/tests/integration_tests/test_chain_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ..utils import PatchedMongoDBAtlasVectorSearch
1818

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

6767
from langchain_openai import ChatOpenAI, OpenAIEmbeddings

libs/mongodb/tests/integration_tests/test_chat_message_histories.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
COLLECTION = "langchain_test_chat"
1111

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

1515

1616
def test_memory_with_message_store() -> None:

libs/mongodb/tests/integration_tests/test_docstore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from langchain_mongodb.docstores import MongoDBDocStore
88

9-
CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
9+
CONNECTION_STRING = os.environ.get("MONGODB_URI")
1010
DB_NAME = "langchain_test_db"
1111
COLLECTION_NAME = "langchain_test_docstore"
1212

libs/mongodb/tests/integration_tests/test_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@pytest.fixture
2121
def collection() -> Generator:
2222
"""Depending on uri, this could point to any type of cluster."""
23-
uri = os.environ.get("MONGODB_ATLAS_URI")
23+
uri = os.environ.get("MONGODB_URI")
2424
client: MongoClient = MongoClient(uri)
2525
client[DB_NAME].create_collection(COLLECTION_NAME)
2626
clxn = client[DB_NAME][COLLECTION_NAME]

libs/mongodb/tests/integration_tests/test_mmr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch
1313

14-
CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
14+
CONNECTION_STRING = os.environ.get("MONGODB_URI")
1515
DB_NAME = "langchain_test_db"
1616
COLLECTION_NAME = "langchain_test_vectorstores"
1717
INDEX_NAME = "langchain-test-index-vectorstores"

libs/mongodb/tests/integration_tests/test_parent_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch
1919

20-
CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
20+
CONNECTION_STRING = os.environ.get("MONGODB_URI")
2121
DB_NAME = "langchain_test_db"
2222
COLLECTION_NAME = "langchain_test_parent_document_combined"
2323
VECTOR_INDEX_NAME = "langchain-test-parent-document-vector-index"

libs/mongodb/tests/integration_tests/test_retrievers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from ..utils import PatchedMongoDBAtlasVectorSearch
2222

23-
CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI")
23+
CONNECTION_STRING = os.environ.get("MONGODB_URI")
2424
DB_NAME = "langchain_test_db"
2525
COLLECTION_NAME = "langchain_test_retrievers"
2626
VECTOR_INDEX_NAME = "vector_index"

0 commit comments

Comments
 (0)