Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .evergreen/execute-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ set +a

cd ${REPO_NAME}

MAX_ATTEMPTS=3
MAX_ATTEMPTS=${MAX_ATTEMPTS:-3}
ATTEMPT=1
EXIT_CODE=0
set +e

while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
bash ${ROOT_DIR}/${DIR}/run.sh
bash ${ROOT_DIR}/${DIR}/run.sh "$@"

EXIT_CODE=$?

if [ $EXIT_CODE -eq 0 ]; then
break
else
echo "Tests failed on attempt $ATTEMPT of $MAX_ATTEMPTS..."
((ATTEMPT++))
ATTEMPT=$((ATTEMPT+1))
fi
done

Expand Down
1 change: 1 addition & 0 deletions .evergreen/provision-atlas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ scaffold_atlas
source secrets-export.sh

# Create the env file
echo "export DIR=$DIR" > env.sh
echo "export VOYAGEAI_S3_BUCKET=$VOYAGEAI_S3_BUCKET" >> env.sh
echo "export AZURE_OPENAI_ENDPOINT=$AZURE_OPENAI_ENDPOINT" >> env.sh
echo "export AZURE_OPENAI_API_KEY=$AZURE_OPENAI_API_KEY" >> env.sh
Expand Down
1 change: 1 addition & 0 deletions .evergreen/setup-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ esac
export MONGODB_URI

# Create the env file
echo "export DIR=$DIR" > env.sh
echo "export VOYAGEAI_S3_BUCKET=$VOYAGEAI_S3_BUCKET" >> env.sh
echo "export AZURE_OPENAI_ENDPOINT=$AZURE_OPENAI_ENDPOINT" >> env.sh
echo "export AZURE_OPENAI_API_KEY=$AZURE_OPENAI_API_KEY" >> env.sh
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ xunit-results/
drivers-evergreen-tools
atlas
.evergreen/.local_atlas_uri
mo-expansion.*
pwfile

# Secrets
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ CONN_STRING=$(fetch_local_atlas_uri)

Stores the local Atlas URI within the `CONN_STRING` var. The script can then pass `CONN_STRING` as an environment variable to the test suite.

#### Running tests locally.
#### Running tests locally

We can run the tests with a local checkout of the repo.

Expand All @@ -86,6 +86,18 @@ bash .evergreen/execute-tests.sh
Use `.evergreen/setup-remote.sh` instead of `.evergreen/provision-atlas.sh` to test against the remote cluster.
Set `COMMUNITY_WITH_SEARCH=1` to test against MongoDB Community with Search edition.

We can also run locally using `just` (`brew install just`):

```bash
just setup docarray # local atlas
just test
```

```bash
just setup-remote n8n-js # remote atlas
just test
```

#### Pre-populating the Local Atlas Deployment

You can pre-populate a test's local Atlas deployment before running the `run.sh` script by providing JSON files in the optional `database` directory of the created subdirectory. The `.evergreen/scaffold_atlas.py` file will search for every JSON file within this database directory and upload the documents to the database provided by the `DATABASE` expansion provided in the build variant of the `.evergreen/config.yml` setup. The collection the script uploads to is based on the name of your JSON file:
Expand Down
23 changes: 23 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://just.systems/man/en/ for instructions
set shell := ["bash", "-c"]
set dotenv-filename := "env.sh"

# Make the default recipe private so it doesn't show up in the list.
[private]
default:
@just --list

_base dir:
DIR={{dir}} bash .evergreen/fetch-secrets.sh
DIR={{dir}} bash .evergreen/fetch-repo.sh

setup dir:
just _base {{dir}}
DIR={{dir}} bash .evergreen/provision-atlas.sh

setup-remote dir:
just _base {{dir}}
DIR={{dir}} bash .evergreen/setup-remote.sh

test *args="":
MAX_ATTEMPTS=1 bash .evergreen/execute-tests.sh {{args}}