11'use strict' ;
2- // To run these tests locally :
2+ // To run these tests against cloud-dev :
33// > ATLAS_PUBLIC_KEY="..." \
44// ATLAS_PRIVATE_KEY="..." \
55// AI_TESTS_ATTEMPTS_PER_TEST=100 \
66// node scripts/ai-accuracy-tests/index.js
77
8+ // To run these tests with local mms:
9+ // First create an API key in your Atlas organization with
10+ // the permissions "Organization Member".
11+ // Then using that key run:
12+ // > ATLAS_PUBLIC_KEY="..." \
13+ // ATLAS_PRIVATE_KEY="..." \
14+ // AI_TESTS_BACKEND=atlas-local \
15+ // node scripts/ai-accuracy-tests/index.js
16+
817const { MongoCluster } = require ( 'mongodb-runner' ) ;
918const fs = require ( 'fs' ) . promises ;
1019const os = require ( 'os' ) ;
@@ -32,12 +41,12 @@ const USE_SAMPLE_DOCS = process.env.AI_TESTS_USE_SAMPLE_DOCS === 'true';
3241
3342const BACKEND = process . env . AI_TESTS_BACKEND || 'atlas-dev' ;
3443
35- if ( ! [ 'atlas-dev' , 'compass' ] . includes ( BACKEND ) ) {
44+ if ( ! [ 'atlas-dev' , 'atlas-local' , ' compass'] . includes ( BACKEND ) ) {
3645 throw new Error ( 'Unknown backend' ) ;
3746}
3847
3948const fetch = ( ( ) => {
40- if ( BACKEND === 'atlas-dev' ) {
49+ if ( BACKEND === 'atlas-dev' || BACKEND === 'atlas-local' ) {
4150 const ATLAS_PUBLIC_KEY = process . env . ATLAS_PUBLIC_KEY ;
4251 const ATLAS_PRIVATE_KEY = process . env . ATLAS_PRIVATE_KEY ;
4352
@@ -59,6 +68,8 @@ const backendBaseUrl =
5968 process . env . AI_TESTS_BACKEND_URL ||
6069 ( BACKEND === 'atlas-dev'
6170 ? 'https://cloud-dev.mongodb.com/api/private'
71+ : BACKEND === 'atlas-local'
72+ ? 'http://localhost:8080/api/private'
6273 : 'http://localhost:8080' ) ;
6374
6475let httpErrors = 0 ;
0 commit comments