Skip to content

Commit d7301f1

Browse files
NODE-6950: add langchainjs to testing pipeline (#66)
1 parent be53473 commit d7301f1

File tree

6 files changed

+103
-1
lines changed

6 files changed

+103
-1
lines changed

.evergreen/config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,25 @@ tasks:
250250
- func: "fetch repo"
251251
- func: "execute tests"
252252

253+
- name: test-langchain-js-local
254+
tags: [local]
255+
commands:
256+
- func: "fetch repo"
257+
- func: "execute tests"
258+
- command: attach.xunit_results
259+
params:
260+
file: src/langchain-js/langchainjs/libs/langchain-mongodb/results.xml
261+
262+
- name: test-langchain-js-remote
263+
tags: [remote]
264+
commands:
265+
- func: "fetch repo"
266+
- func: "setup remote atlas"
267+
- func: "execute tests"
268+
- command: attach.xunit_results
269+
params:
270+
file: src/langchain-js/langchainjs/libs/langchain-mongodb/results.xml
271+
253272
buildvariants:
254273
- name: test-semantic-kernel-python-rhel
255274
display_name: Semantic-Kernel RHEL Python
@@ -369,3 +388,13 @@ buildvariants:
369388
- ubuntu2204-small
370389
tasks:
371390
- name: test-langchaingo-local
391+
392+
- name: test-langchain-js-ubuntu
393+
display_name: LangchainJS Ubuntu2204
394+
expansions:
395+
DIR: langchain-js
396+
run_on:
397+
- ubuntu2204-small
398+
tasks:
399+
- name: test-langchain-js-local
400+
- name: test-langchain-js-remote

.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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Test execution flow is defined in `.evergreen/config.yml`. The test pipeline's c
107107

108108
- `DIR` -- The subdirectory where the tasks will run
109109

110-
- `run_on` -- Specified platform to run on. `rhel87-small` should be used by default. Any other distro may fail Atlas CLI setup.
110+
- `run_on` -- Specified platform to run on. `rhel87-small` or `ubuntu2204-small` should be used by default. Any other distro may fail Atlas CLI setup.
111111
- `tasks` -- Tasks to run. See below for more details
112112
- `cron` -- The tests are run via a cron job on a nightly cadence. This can be modified by setting a different cadence. Cron jobs can be scheduled using [cron syntax](https://crontab.guru/#0_0_*_*_*)
113113

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+
REPO_ORG=langchain-ai
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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
setup_remote_atlas() {
5+
# Get the MONGODB_URI and OPENAI_API_KEY.
6+
SCRIPT_DIR=$(realpath "$(dirname ${BASH_SOURCE[0]})")
7+
ROOT_DIR=$(dirname $SCRIPT_DIR)
8+
9+
if [[ -f "$ROOT_DIR/env.sh" ]]; then
10+
echo "Sourcing $ROOT_DIR/env.sh"
11+
source $ROOT_DIR/env.sh
12+
fi
13+
14+
bash "$ROOT_DIR/.evergreen/fetch-secrets.sh"
15+
source secrets-export.sh
16+
17+
if [[ -n "$MONGODB_URI" ]]; then
18+
export MONGODB_ATLAS_URI=$MONGODB_URI
19+
fi
20+
}
21+
22+
setup_node_and_yarn() {
23+
# setup node, npm and yarn
24+
PATH=/opt/devtools/node22/bin:$(pwd)/bin:$PATH
25+
npm_config_prefix=$(pwd)
26+
export PATH
27+
export npm_config_prefix
28+
29+
npm install --global yarn
30+
}
31+
32+
setup_langchain_integration() {
33+
cd libs/langchain-mongodb
34+
35+
yarn install
36+
yarn build
37+
38+
yarn add --dev jest-junit
39+
export JEST_JUNIT_OUTPUT_NAME=results.xml
40+
41+
# optionally enable to debug local atlas in CI.
42+
# export DEBUG=testcontainers*
43+
}
44+
45+
setup_remote_atlas
46+
setup_node_and_yarn
47+
setup_langchain_integration
48+
49+
yarn test:int --reporters=default --reporters=jest-junit

0 commit comments

Comments
 (0)