Skip to content

Commit

Permalink
INTPYTHON-447 Fix integration test handling (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Dec 6, 2024
1 parent 696c012 commit aef58f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ jobs:
MONGODB_URI: ${{ secrets.MONGODB_ATLAS_URI }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
[[ "${{ github.repository_owner }}" == "langchain-ai" ]] && make integration_tests || true
if [[ "${{ github.event_name }}" == "push" ]]; then
make integration_tests
fi
working-directory: ${{ inputs.working-directory }}

- name: Ensure the tests did not create any additional files
Expand Down
8 changes: 6 additions & 2 deletions libs/mongodb/tests/integration_tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ def collection() -> Generator:
"""Depending on uri, this could point to any type of cluster."""
uri = os.environ.get("MONGODB_URI")
client: MongoClient = MongoClient(uri)
client[DB_NAME].create_collection(COLLECTION_NAME)
if COLLECTION_NAME not in client[DB_NAME].list_collection_names():
clxn = client[DB_NAME].create_collection(COLLECTION_NAME)
else:
clxn = client[DB_NAME][COLLECTION_NAME]
clxn = client[DB_NAME][COLLECTION_NAME]
clxn.delete_many({})
yield clxn
clxn.drop()
clxn.delete_many({})


def test_search_index_drop_add_delete_commands(collection: Collection) -> None:
Expand Down

0 comments on commit aef58f4

Please sign in to comment.