Skip to content

Commit 4a84579

Browse files
authored
PYTHON-5217 Add helper scripts and test for atlas data lake (#636)
1 parent 91d2352 commit 4a84579

File tree

8 files changed

+80
-13
lines changed

8 files changed

+80
-13
lines changed

.evergreen/atlas_data_lake/pull-mongohouse-image.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
88
. $SCRIPT_DIR/../handle-paths.sh
99
pushd $SCRIPT_DIR
1010
REPO="904697982180.dkr.ecr.us-east-1.amazonaws.com/atlas-query-engine-test"
11-
. ../secrets_handling/setup-secrets.sh drivers/adl
11+
if [ ! -f secrets-export.sh ]; then
12+
. ../secrets_handling/setup-secrets.sh drivers/adl
13+
fi
1214
source secrets-export.sh
1315
unset AWS_SESSION_TOKEN
1416
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $REPO

.evergreen/atlas_data_lake/run-mongohouse-image.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
1111
IMAGE=904697982180.dkr.ecr.us-east-1.amazonaws.com/atlas-query-engine-test
1212
USE_TTY=""
1313
test -t 1 && USE_TTY="-t"
14-
docker run -d -p 27017:27017 -v "$DRIVERS_TOOLS/.evergreen/atlas_data_lake:/src" -i $USE_TTY $IMAGE --config ./testdata/config/external/drivers/config.yaml
14+
if command -v podman &> /dev/null; then
15+
DOCKER="podman --storage-opt ignore_chown_errors=true"
16+
else
17+
DOCKER=docker
18+
fi
19+
$DOCKER run -d -p 27017:27017 --platform linux/amd64 --name atlas-data-lake -v "$DRIVERS_TOOLS/.evergreen/atlas_data_lake:/src" -i $USE_TTY $IMAGE --config ./testdata/config/external/drivers/config.yaml

.evergreen/atlas_data_lake/setup.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script sets Atlas Data Lake tests.
4+
#
5+
set -eu
6+
7+
SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
8+
. $SCRIPT_DIR/../handle-paths.sh
9+
10+
bash $SCRIPT_DIR/pull-mongohouse-image.sh
11+
bash $SCRIPT_DIR/run-mongohouse-image.sh
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script tears down Atlas Data Lake tests.
4+
#
5+
set -eu
6+
7+
if command -v podman &> /dev/null; then
8+
DOCKER="podman --storage-opt ignore_chown_errors=true"
9+
else
10+
DOCKER=docker
11+
fi
12+
$DOCKER kill atlas-data-lake || true
13+
$DOCKER rm atlas-data-lake

.evergreen/config.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,14 @@ functions:
520520
include_expansions_in_env: [AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN]
521521
args: [src/.evergreen/tests/test-aws.sh]
522522

523+
"run data lake test":
524+
- command: subprocess.exec
525+
type: test
526+
params:
527+
binary: bash
528+
include_expansions_in_env: [AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN]
529+
args: [src/.evergreen/tests/test-data-lake.sh]
530+
523531
"run csfle test":
524532
- command: ec2.assume_role
525533
params:
@@ -1037,12 +1045,18 @@ tasks:
10371045
commands:
10381046
- func: "run aws test"
10391047

1048+
- name: "test-atlas-data-lake"
1049+
tags: ["pr", "data_lake"]
1050+
commands:
1051+
- func: "run data lake test"
1052+
10401053
- name: "test-cli-full"
10411054
tags: ["pr"]
10421055
commands:
10431056
- func: "run cli test full"
10441057

10451058
- name: "test-ocsp"
1059+
tags: ["pr", "ocsp"]
10461060
commands:
10471061
- func: "run ocsp test"
10481062

@@ -1427,20 +1441,15 @@ buildvariants:
14271441
tasks:
14281442
- ".releng" # Run all tasks with the "releng" tag
14291443

1430-
# Tests relating to docker images
1431-
- name: tests-docker
1432-
display_name: Docker
1433-
run_on:
1434-
- ubuntu2204-small
1435-
tasks:
1436-
- ".docker" # Run all tasks with the "docker" tag
1437-
1438-
- name: tests-aws
1439-
display_name: Auth AWS
1444+
- name: tests-misc
1445+
display_name: Other tests
14401446
run_on:
14411447
- ubuntu2204-small
14421448
tasks:
14431449
- ".aws"
1450+
- ".data_lake"
1451+
- ".ocsp"
1452+
- ".docker"
14441453

14451454
- name: tests-oidc
14461455
display_name: Auth OIDC

.evergreen/docker/run-server.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ fi
3131
pushd $DRIVERS_TOOLS
3232
cp .gitignore .dockerignore
3333
USER="--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)"
34-
$DOCKER build $PLATFORM -t $NAME -f $SCRIPT_DIR/$IMAGE/Dockerfile $USER .
34+
ARGS="$PLATFORM -t $NAME -f $SCRIPT_DIR/$IMAGE/Dockerfile $USER ."
35+
# Allow a single failure due to transient issues with apt-get.
36+
$DOCKER build $ARGS || $DOCKER build $ARGS
3537
popd
3638

3739
# Handle environment variables.

.evergreen/tests/test-data-lake.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
# Test aws setup function for different inputs.
4+
set -eu
5+
6+
SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
7+
. $SCRIPT_DIR/../handle-paths.sh
8+
9+
pushd $SCRIPT_DIR/..
10+
DOWNLOAD_DIR=$SCRIPT_DIR/dl_test
11+
bash install-cli.sh .
12+
./mongosh-dl --version 2.1.1 --out ${DOWNLOAD_DIR}/bin --strip-path-components 2 --retries 5
13+
popd
14+
15+
pushd $SCRIPT_DIR/../atlas_data_lake
16+
bash ./setup.sh
17+
source secrets-export.sh
18+
${DOWNLOAD_DIR}/bin/mongosh "mongodb://$ADL_USERNAME:$ADL_PASSWORD@localhost:27017" --eval "db.runCommand({\"ping\":1})"
19+
bash ./teardown.sh
20+
popd
21+
22+
rm -rf "${SCRIPT_DIR:?}/${DOWNLOAD_DIR}"
23+
24+
make -C ${DRIVERS_TOOLS} test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ test-env.sh
9797
# Temporary files created during operation.
9898
/uri.txt
9999
/results.json
100+
/test-results.json
100101
/mongodb
101102
node_index.tab
102103
mongodb-binaries.tgz

0 commit comments

Comments
 (0)