File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
libs/mongodb/tests/integration_tests Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 51
51
MONGODB_URI : ${{ secrets.MONGODB_ATLAS_URI }}
52
52
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
53
53
run : |
54
- [[ "${{ github.repository_owner }}" == "langchain-ai" ]] && make integration_tests || true
54
+ if [[ "${{ github.event_name }}" == "push" ]]; then
55
+ make integration_tests
56
+ fi
55
57
working-directory : ${{ inputs.working-directory }}
56
58
57
59
- name : Ensure the tests did not create any additional files
Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ def collection() -> Generator:
22
22
"""Depending on uri, this could point to any type of cluster."""
23
23
uri = os .environ .get ("MONGODB_URI" )
24
24
client : MongoClient = MongoClient (uri )
25
- client [DB_NAME ].create_collection (COLLECTION_NAME )
25
+ if COLLECTION_NAME not in client [DB_NAME ].list_collection_names ():
26
+ clxn = client [DB_NAME ].create_collection (COLLECTION_NAME )
27
+ else :
28
+ clxn = client [DB_NAME ][COLLECTION_NAME ]
26
29
clxn = client [DB_NAME ][COLLECTION_NAME ]
30
+ clxn .delete_many ({})
27
31
yield clxn
28
- clxn .drop ( )
32
+ clxn .delete_many ({} )
29
33
30
34
31
35
def test_search_index_drop_add_delete_commands (collection : Collection ) -> None :
You can’t perform that action at this time.
0 commit comments