Skip to content

Commit 4edb995

Browse files
authored
CDRIVER-4543 Use find-python3.sh in integration-tests.sh (#1167)
* CDRIVER-4543 Use find-python3.sh and venv-utils.sh to create mongo-orchestration venv * Ensure consistent check and clone of DET repository
1 parent 7a6b636 commit 4edb995

File tree

7 files changed

+56
-41
lines changed

7 files changed

+56
-41
lines changed

.evergreen/config.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ functions:
693693
script: |-
694694
set -o errexit
695695
if [ ! -d "drivers-evergreen-tools" ]; then
696-
git clone git@github.com:mongodb-labs/drivers-evergreen-tools.git
696+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
697697
fi
698698
cd drivers-evergreen-tools
699699
export DRIVERS_TOOLS=$(pwd)
@@ -761,7 +761,9 @@ functions:
761761
set -o errexit
762762
# Add AWS variables to a file.
763763
# Clone in one directory above so it does not get uploaded in working directory.
764-
git clone --depth=1 https://github.com/mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
764+
if [ ! -d ../drivers-evergreen-tools ]; then
765+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
766+
fi
765767
cat <<EOF > ../drivers-evergreen-tools/.evergreen/auth_aws/aws_e2e_setup.json
766768
{
767769
"iam_auth_ecs_account" : "${iam_auth_ecs_account}",
@@ -802,7 +804,7 @@ functions:
802804
script: |-
803805
set -o errexit
804806
if [ ! -d "drivers-evergreen-tools" ]; then
805-
git clone git@github.com:mongodb-labs/drivers-evergreen-tools.git --depth=1
807+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
806808
fi
807809
run kms servers:
808810
- command: shell.exec
@@ -24167,7 +24169,9 @@ task_groups:
2416724169
shell: bash
2416824170
script: |-
2416924171
set -o errexit
24170-
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git --depth=1 drivers-evergreen-tools
24172+
if [ ! -d drivers-evergreen-tools ]; then
24173+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
24174+
fi
2417124175
DRIVERS_TOOLS=$(pwd)/drivers-evergreen-tools
2417224176
echo '${testazurekms_publickey}' > /tmp/testazurekms_publickey
2417324177
echo '${testazurekms_privatekey}' > /tmp/testazurekms_privatekey
@@ -24207,7 +24211,9 @@ task_groups:
2420724211
shell: bash
2420824212
script: |-
2420924213
set -o errexit
24210-
git clone --depth=1 https://github.com/mongodb-labs/drivers-evergreen-tools.git
24214+
if [ ! -d drivers-evergreen-tools ]; then
24215+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
24216+
fi
2421124217
DRIVERS_TOOLS=$(pwd)/drivers-evergreen-tools
2421224218
echo '${testgcpkms_key_file}' > /tmp/testgcpkms_key_file.json
2421324219
export GCPKMS_KEYFILE=/tmp/testgcpkms_key_file.json

.evergreen/integration-tests.sh

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -94,47 +94,38 @@ export ORCHESTRATION_URL="http://localhost:8889/v1/${TOPOLOGY}s"
9494
export TMPDIR=$MONGO_ORCHESTRATION_HOME/db
9595
echo From shell `date` > $MONGO_ORCHESTRATION_HOME/server.log
9696

97+
if [ ! -d ../drivers-evergreen-tools ]; then
98+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
99+
fi
100+
. ../drivers-evergreen-tools/.evergreen/find-python3.sh
101+
. ../drivers-evergreen-tools/.evergreen/venv-utils.sh
102+
97103
case "$OS" in
98104
cygwin*)
99-
PYTHON=python.exe
100105
# Python has problems with unix style paths in cygwin. Must use c:\\ paths
101106
rm -rf /cygdrive/c/mongodb
102107
cp -r mongodb /cygdrive/c/mongodb
103108
echo "{ \"releases\": { \"default\": \"c:\\\\mongodb\\\\bin\" }}" > orchestration.config
104109

105110
# Make sure MO is running latest version
106-
$PYTHON -m virtualenv venv
111+
venvcreate "$(find_python3)" venv
112+
PYTHON="python"
107113
cd venv
108-
. Scripts/activate
109114
rm -rf mongo-orchestration
110115
git clone --depth 1 git@github.com:10gen/mongo-orchestration.git
111116
cd mongo-orchestration
112-
pip install .
117+
python -m pip install .
113118
cd ../..
114119
ls `pwd`/mongodb/bin/mongo* || true
115120
nohup mongo-orchestration -f orchestration.config -e default --socket-timeout-ms=60000 --bind=127.0.0.1 --enable-majority-read-concern -s wsgiref start > $MONGO_ORCHESTRATION_HOME/out.log 2> $MONGO_ORCHESTRATION_HOME/err.log < /dev/null &
116121
;;
117122
*)
118123
echo "{ \"releases\": { \"default\": \"`pwd`/mongodb/bin\" } }" > orchestration.config
119-
if [ -f /opt/python/2.7/bin/python ]; then
120-
# Python toolchain installation.
121-
PYTHON=/opt/python/2.7/bin/python
122-
elif [ "x$(lsb_release -cs)" = "xtrusty" -a -f /opt/mongodbtoolchain/v2/bin/python ]; then
123-
# Python toolchain installation.
124-
PYTHON=/opt/mongodbtoolchain/v2/bin/python
125-
else
126-
PYTHON=python
127-
fi
128-
129-
PIP=pip
130-
if ! $PYTHON -c "import virtualenv" ; then
131-
PYTHON=python3
132-
PIP=pip3
133-
fi
134124

135-
$PYTHON -m virtualenv venv
125+
venvcreate "$(find_python3)" venv
126+
PYTHON="python"
127+
PIP="python -m pip"
136128
cd venv
137-
. bin/activate
138129
rm -rf mongo-orchestration
139130
# Make sure MO is running latest version
140131
git clone --depth 1 git@github.com:10gen/mongo-orchestration.git
@@ -150,15 +141,27 @@ case "$OS" in
150141
;;
151142
esac
152143

153-
sleep 15
154-
echo "Checking that mongo-orchestration is running"
155-
curl http://localhost:8889/ -sS --max-time 120 --fail | python -m json.tool
156-
144+
echo "Waiting for mongo-orchestration to start..."
145+
wait_for_mongo_orchestration() {
146+
for i in $(seq 300); do
147+
# Exit code 7: "Failed to connect to host".
148+
if curl -s "localhost:$1" 1>|curl_mo.txt; test $? -ne 7; then
149+
return 0
150+
else
151+
sleep 1
152+
fi
153+
done
154+
echo "Could not detect mongo-orchestration on port $1"
155+
return 1
156+
}
157+
wait_for_mongo_orchestration 8889
158+
echo "Waiting for mongo-orchestration to start... done."
159+
160+
python -m json.tool curl_mo.txt
157161
sleep 5
158-
159162
pwd
160-
curl -sS --data @"$ORCHESTRATION_FILE" "$ORCHESTRATION_URL" --max-time 300 --fail | python -m json.tool
161-
163+
curl -s --data @"$ORCHESTRATION_FILE" "$ORCHESTRATION_URL" 1>|curl_mo.txt
164+
python -m json.tool curl_mo.txt
162165
sleep 15
163166

164167
if [ "$AUTH" = "auth" ]; then

.evergreen/run-aws-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Optional environment variables:
1010
#
1111
# DRIVERS_TOOLS
12-
# The path to clone of https://github.com/mongodb-labs/drivers-evergreen-tools.git.
12+
# The path to clone of https://github.com/mongodb-labs/drivers-evergreen-tools.
1313
# Defaults to $(pwd)../drivers-evergreen-tools
1414
# CDRIVER_BUILD
1515
# The path to the build of mongo-c-driver (e.g. mongo-c-driver/cmake-build).
@@ -195,4 +195,4 @@ EOF
195195
fi
196196

197197
echo "Unexpected testcase '$TESTCASE'"
198-
exit 1
198+
exit 1

.evergreen/run-ocsp-responder.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fi
7373
if [ -n "$RESPONDER_REQUIRED" ]; then
7474
echo "Starting mock responder"
7575
if [ ! -d "../drivers-evergreen-tools" ]; then
76-
git clone --depth=1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
76+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
7777
fi
7878

7979
pushd ../drivers-evergreen-tools/.evergreen/ocsp

build/evergreen_config_lib/functions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
('build mongohouse', Function(
502502
shell_mongoc(r'''
503503
if [ ! -d "drivers-evergreen-tools" ]; then
504-
git clone git@github.com:mongodb-labs/drivers-evergreen-tools.git
504+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
505505
fi
506506
cd drivers-evergreen-tools
507507
export DRIVERS_TOOLS=$(pwd)
@@ -558,7 +558,9 @@
558558
shell_mongoc(r'''
559559
# Add AWS variables to a file.
560560
# Clone in one directory above so it does not get uploaded in working directory.
561-
git clone --depth=1 https://github.com/mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
561+
if [ ! -d ../drivers-evergreen-tools ]; then
562+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
563+
fi
562564
cat <<EOF > ../drivers-evergreen-tools/.evergreen/auth_aws/aws_e2e_setup.json
563565
{
564566
"iam_auth_ecs_account" : "${iam_auth_ecs_account}",
@@ -592,7 +594,7 @@
592594
('clone drivers-evergreen-tools', Function(
593595
shell_exec(r'''
594596
if [ ! -d "drivers-evergreen-tools" ]; then
595-
git clone git@github.com:mongodb-labs/drivers-evergreen-tools.git --depth=1
597+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
596598
fi
597599
''', test=False)
598600
)),

build/evergreen_config_lib/testazurekms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def _create_task_group():
9999
task_group.setup_group_timeout_secs = 1800 # 30 minutes
100100
task_group.setup_group = [
101101
shell_exec(r'''
102-
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git --depth=1 drivers-evergreen-tools
102+
if [ ! -d drivers-evergreen-tools ]; then
103+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
104+
fi
103105
DRIVERS_TOOLS=$(pwd)/drivers-evergreen-tools
104106
echo '${testazurekms_publickey}' > /tmp/testazurekms_publickey
105107
echo '${testazurekms_privatekey}' > /tmp/testazurekms_privatekey

build/evergreen_config_lib/testgcpkms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ def _create_task_group():
8989
task_group.setup_group = [
9090
# Create and set up a GCE instance using driver tools script
9191
shell_exec(r'''
92-
git clone --depth=1 https://github.com/mongodb-labs/drivers-evergreen-tools.git
92+
if [ ! -d drivers-evergreen-tools ]; then
93+
git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git
94+
fi
9395
DRIVERS_TOOLS=$(pwd)/drivers-evergreen-tools
9496
echo '${testgcpkms_key_file}' > /tmp/testgcpkms_key_file.json
9597
export GCPKMS_KEYFILE=/tmp/testgcpkms_key_file.json

0 commit comments

Comments
 (0)