Skip to content

Commit fd30f52

Browse files
initial commit
1 parent 3f05afa commit fd30f52

File tree

6 files changed

+98
-1
lines changed

6 files changed

+98
-1
lines changed

.evergreen/config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,25 @@ tasks:
244244
- func: "fetch repo"
245245
- func: "execute tests"
246246

247+
- name: test-langchain-js-local
248+
tags: [local]
249+
commands:
250+
- func: "fetch repo"
251+
- func: "execute tests"
252+
- command: attach.xunit_results
253+
params:
254+
file: src/langchain-js/langchainjs/libs/langchain-mongodb/results.xml
255+
256+
- name: test-langchain-js-remote
257+
tags: [remote]
258+
commands:
259+
- func: "fetch repo"
260+
- func: "setup remote atlas"
261+
- func: "execute tests"
262+
- command: attach.xunit_results
263+
params:
264+
file: src/langchain-js/langchainjs/libs/langchain-mongodb/results.xml
265+
247266
buildvariants:
248267
- name: test-semantic-kernel-python-rhel
249268
display_name: Semantic-Kernel RHEL Python
@@ -363,3 +382,13 @@ buildvariants:
363382
- ubuntu2204-small
364383
tasks:
365384
- name: test-langchaingo-local
385+
386+
- name: test-langchain-js-ubuntu
387+
display_name: LangchainJS Ubuntu2204
388+
expansions:
389+
DIR: langchain-js
390+
run_on:
391+
- ubuntu2204-small
392+
tasks:
393+
- name: test-langchain-js-local
394+
- name: test-langchain-js-remote

.evergreen/scaffold_atlas.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def create_index(client: MongoClient, filename: Path) -> None:
7979
collection_name,
8080
)
8181

82-
collection = client[database_name][collection_name]
82+
db = client[database_name]
83+
84+
collection = db[collection_name] if collection_name in db.list_collection_names() else db.create_collection(collection_name)
8385

8486
search_index = SearchIndexModel(
8587
loaded_index_configuration, name=index_name, type=index_type

.evergreen/setup-remote.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ case $DIR in
4141
pymongo-voyageai)
4242
MONGODB_URI=$VOYAGEAI_MONGODB_URI
4343
;;
44+
langchain-js)
45+
MONGODB_URI=$LANGCHAIN_MONGODB_URI
46+
;;
4447
*)
4548
echo "Missing config in setup-remote.sh for DIR: $DIR"
4649
exit 1

langchain-js/config.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
REPO_NAME=langchainjs
2+
CLONE_URL="https://github.com/baileympearson/langchainjs.git"
3+
DATABASE=langchain_test_db
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "default",
3+
"type": "search",
4+
"mappings": {
5+
"fields": {
6+
"e": {
7+
"type": "number"
8+
},
9+
"embedding": {
10+
"dimensions": 1536,
11+
"similarity": "euclidean",
12+
"type": "knnVector"
13+
}
14+
}
15+
},
16+
"database": "langchain",
17+
"collectionName": "test"
18+
}

langchain-js/run.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
git branch
4+
git switch test-use-local-atlas
5+
git log -n 1
6+
7+
# Get the MONGODB_URI and OPENAI_API_KEY.
8+
SCRIPT_DIR=$(realpath "$(dirname ${BASH_SOURCE[0]})")
9+
ROOT_DIR=$(dirname $SCRIPT_DIR)
10+
11+
if [[ -f "$ROOT_DIR/env.sh" ]]; then
12+
echo "Sourcing $ROOT_DIR/env.sh"
13+
source $ROOT_DIR/env.sh
14+
fi
15+
16+
# setup node, npm and yarn
17+
PATH=/opt/devtools/node22/bin:$(pwd)/bin:$PATH
18+
npm_config_prefix=$(pwd)
19+
export PATH
20+
export npm_config_prefix
21+
22+
npm install --global yarn
23+
24+
bash ../../.evergreen/fetch-secrets.sh
25+
source secrets-export.sh
26+
27+
cd libs/langchain-mongodb
28+
29+
yarn install
30+
yarn build
31+
32+
yarn add --dev jest-junit
33+
export JEST_JUNIT_OUTPUT_NAME=results.xml
34+
35+
if [[ -n "$MONGODB_URI" ]]; then
36+
export MONGODB_ATLAS_URI=$MONGODB_URI
37+
fi
38+
39+
echo "MONGODB_ATLAS_URI: $MONGODB_ATLAS_URI"
40+
41+
export DEBUG=testcontainers*
42+
yarn test:int --reporters=default --reporters=jest-junit

0 commit comments

Comments
 (0)