From a0b3400910bcd6292b03ce938bf97fbe061b42e8 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 7 Apr 2025 09:14:14 -0500 Subject: [PATCH 1/8] INTPYTHON-573 Use drivers-tools to run the local atlas server --- .evergreen/config.yml | 7 +++++ .evergreen/utils.sh | 59 +++++-------------------------------------- 2 files changed, 13 insertions(+), 53 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 30c6700..048fdcc 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -75,9 +75,16 @@ functions: args: [.evergreen/setup-remote.sh] pre_error_fails_task: true +post_error_fails_task: true pre: - func: "fetch source" - func: "fetch secrets" +post: + - command: subprocess.exec + type: setup + working_dir: "src" + binary: bash + args: [drivers-evergreen-tools/.evergreen/teardown.sh] tasks: - name: test-semantic-kernel-python-local diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index f163066..beeb4af 100644 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -52,64 +52,17 @@ is_python_310() { } -retry() { - for i in 1 2 4 8 16; do - { "$@" && return 0; } || sleep $i - done - return 1 -} - # start mongodb-atlas-local container, because of a bug in podman we have to define the healtcheck ourselves (is the same as in the image) # stores the connection string in .local_atlas_uri file setup_local_atlas() { - echo "Starting the container" - - IMAGE=mongodb/mongodb-atlas-local:latest - retry podman pull $IMAGE - - podman kill mongodb_atlas_local || true - - CONTAINER_ID=$(podman run --rm -d -e DO_NOT_TRACK=1 -P --health-cmd "/usr/local/bin/runner healthcheck" $IMAGE) - podman rename $CONTAINER_ID mongodb_atlas_local || true - - echo "waiting for container to become healthy..." - function wait() { - CONTAINER_ID=$1 - - echo "waiting for container to become healthy..." - podman healthcheck run "$CONTAINER_ID" - for _ in $(seq 600); do - STATE=$(podman inspect -f '{{ .State.Health.Status }}' "$CONTAINER_ID") - - case $STATE in - healthy) - echo "container is healthy" - return 0 - ;; - unhealthy) - echo "container is unhealthy" - podman logs "$CONTAINER_ID" - stop - exit 1 - ;; - *) - echo "Unrecognized state $STATE" - sleep 1 - esac - done - - echo "container did not get healthy within 120 seconds, quitting" - podman logs mongodb_atlas_local - stop - exit 2 - } - - wait "$CONTAINER_ID" - EXPOSED_PORT=$(podman inspect --format='{{ (index (index .NetworkSettings.Ports "27017/tcp") 0).HostPort }}' "$CONTAINER_ID") - export CONN_STRING="mongodb://127.0.0.1:$EXPOSED_PORT/?directConnection=true" SCRIPT_DIR=$(realpath "$(dirname ${BASH_SOURCE[0]})") - echo "CONN_STRING=mongodb://127.0.0.1:$EXPOSED_PORT/?directConnection=true" > $SCRIPT_DIR/.local_atlas_uri + # Ensure drivers-evergeen-tools checkout. + pushd $SCRIPT_DIR/.. + git clone https://github.com/mongodb-labs/drivers-evergreen-tools || true + . drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas + popd + echo "CONN_STRING=mongodb://127.0.0.1:27017/?directConnection=true" > $SCRIPT_DIR/.local_atlas_uri } fetch_local_atlas_uri() { From 115358e97e8bde47046aa848d33cb119184770e6 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 7 Apr 2025 09:47:38 -0500 Subject: [PATCH 2/8] fix teardown --- .evergreen/config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 048fdcc..8654b16 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -82,9 +82,10 @@ pre: post: - command: subprocess.exec type: setup - working_dir: "src" - binary: bash - args: [drivers-evergreen-tools/.evergreen/teardown.sh] + params: + working_dir: "src" + binary: bash + args: [drivers-evergreen-tools/.evergreen/teardown.sh] tasks: - name: test-semantic-kernel-python-local From 4b5301e2eb3ad5073e44e191694fe29b9e902b68 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 7 Apr 2025 09:58:45 -0500 Subject: [PATCH 3/8] fix constring handling --- .evergreen/utils.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index beeb4af..830ccf4 100644 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -62,7 +62,8 @@ setup_local_atlas() { git clone https://github.com/mongodb-labs/drivers-evergreen-tools || true . drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas popd - echo "CONN_STRING=mongodb://127.0.0.1:27017/?directConnection=true" > $SCRIPT_DIR/.local_atlas_uri + export CONN_STRING"=mongodb://127.0.0.1:27017/?directConnection=true" + echo "CONN_STRING=$CONN_STRING" > $SCRIPT_DIR/.local_atlas_uri } fetch_local_atlas_uri() { From 6c6ab44fa1314593f503b9b7b2cd15a0535e6935 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 7 Apr 2025 11:59:47 -0500 Subject: [PATCH 4/8] test with fix-podman-setup branch --- .evergreen/fetch-secrets.sh | 2 +- .evergreen/utils.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/fetch-secrets.sh b/.evergreen/fetch-secrets.sh index 808e506..400b6cf 100644 --- a/.evergreen/fetch-secrets.sh +++ b/.evergreen/fetch-secrets.sh @@ -3,7 +3,7 @@ set -eu # Clone drivers-evergeen-tools. -git clone https://github.com/mongodb-labs/drivers-evergreen-tools || true +git clone --branch fix-podman-setup https://github.com/blink1073/drivers-evergreen-tools # Get the secrets for drivers/ai-ml-pipeline-testing. . drivers-evergreen-tools/.evergreen/secrets_handling/setup-secrets.sh drivers/ai-ml-pipeline-testing diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index 830ccf4..6009dd2 100644 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -59,7 +59,7 @@ setup_local_atlas() { SCRIPT_DIR=$(realpath "$(dirname ${BASH_SOURCE[0]})") # Ensure drivers-evergeen-tools checkout. pushd $SCRIPT_DIR/.. - git clone https://github.com/mongodb-labs/drivers-evergreen-tools || true + git clone --branch fix-podman-setup https://github.com/blink1073/drivers-evergreen-tools || true . drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas popd export CONN_STRING"=mongodb://127.0.0.1:27017/?directConnection=true" From 02657349c6efc1fff12539f6efae12d95d874869 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 7 Apr 2025 12:02:07 -0500 Subject: [PATCH 5/8] enable verbose mode --- .evergreen/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index 6009dd2..d194d92 100644 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -60,7 +60,7 @@ setup_local_atlas() { # Ensure drivers-evergeen-tools checkout. pushd $SCRIPT_DIR/.. git clone --branch fix-podman-setup https://github.com/blink1073/drivers-evergreen-tools || true - . drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas + . drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas -v popd export CONN_STRING"=mongodb://127.0.0.1:27017/?directConnection=true" echo "CONN_STRING=$CONN_STRING" > $SCRIPT_DIR/.local_atlas_uri From fdf3d4cd3f9cc9a945ef3cfc72d2ad9330b873a1 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 7 Apr 2025 20:25:56 -0500 Subject: [PATCH 6/8] test with INTPYTHON-572 --- langchain-python/config.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain-python/config.env b/langchain-python/config.env index 5470511..d2689f5 100644 --- a/langchain-python/config.env +++ b/langchain-python/config.env @@ -1,3 +1,3 @@ REPO_NAME=langchain-mongodb -CLONE_URL="https://github.com/langchain-ai/langchain-mongodb.git" +CLONE_URL="--branch INTPYTHON-572 https://github.com/blink1073/langchain-mongodb.git" DATABASE=langchain_test_db From c39c50ecbfef82da7147721bd6b192fcd3b2c15f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 11 Apr 2025 12:57:12 -0500 Subject: [PATCH 7/8] Revert "test with INTPYTHON-572" This reverts commit fdf3d4cd3f9cc9a945ef3cfc72d2ad9330b873a1. --- langchain-python/config.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain-python/config.env b/langchain-python/config.env index d2689f5..5470511 100644 --- a/langchain-python/config.env +++ b/langchain-python/config.env @@ -1,3 +1,3 @@ REPO_NAME=langchain-mongodb -CLONE_URL="--branch INTPYTHON-572 https://github.com/blink1073/langchain-mongodb.git" +CLONE_URL="https://github.com/langchain-ai/langchain-mongodb.git" DATABASE=langchain_test_db From b413a10e149b4b5900538ee31a5f6cab3c4e9be7 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 11 Apr 2025 13:36:04 -0500 Subject: [PATCH 8/8] use upstream --- .evergreen/fetch-secrets.sh | 2 +- .evergreen/utils.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/fetch-secrets.sh b/.evergreen/fetch-secrets.sh index 400b6cf..2ca2980 100644 --- a/.evergreen/fetch-secrets.sh +++ b/.evergreen/fetch-secrets.sh @@ -3,7 +3,7 @@ set -eu # Clone drivers-evergeen-tools. -git clone --branch fix-podman-setup https://github.com/blink1073/drivers-evergreen-tools +git clone https://github.com/mongodb-labs/drivers-evergreen-tools # Get the secrets for drivers/ai-ml-pipeline-testing. . drivers-evergreen-tools/.evergreen/secrets_handling/setup-secrets.sh drivers/ai-ml-pipeline-testing diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index d194d92..d72e673 100644 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -59,7 +59,7 @@ setup_local_atlas() { SCRIPT_DIR=$(realpath "$(dirname ${BASH_SOURCE[0]})") # Ensure drivers-evergeen-tools checkout. pushd $SCRIPT_DIR/.. - git clone --branch fix-podman-setup https://github.com/blink1073/drivers-evergreen-tools || true + git clone https://github.com/mongodb-labs/drivers-evergreen-tools || true . drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas -v popd export CONN_STRING"=mongodb://127.0.0.1:27017/?directConnection=true"