@@ -53,20 +53,9 @@ functions:
53
53
54
54
mkdir -p $(dirname "$ORCHESTRATION_FILE")
55
55
56
- # Borrow MO config from the C driver
57
- #
58
- curl --location "https://raw.githubusercontent.com/mongodb/mongo-c-driver/master/orchestration_configs/${topology_type}s/${orchestration_file}" > "$ORCHESTRATION_FILE"
59
- export ORCHESTRATION_URL="http://localhost:8889/v1/${topology_type}s"
60
- export MONGO_ORCHESTRATION_HOME=/tmp/orchestration-home
61
-
62
- if [ ! -d /tmp/orchestration-home ]; then
63
- mkdir /tmp/orchestration-home
64
- fi
65
-
66
56
${start_mongo_orchestration}
67
57
${start_topology}
68
58
69
-
70
59
mongodb_test_uri="mongodb://${auth_uri_prefix}${hosts}"
71
60
72
61
./gradlew -Dorg.mongodb.test.uri=$mongodb_test_uri --stacktrace --info test
@@ -76,8 +65,52 @@ functions:
76
65
params :
77
66
file : ./mongo-java-driver/*/build/test-results/TEST-*.xml
78
67
68
+ " upload mo artifacts " :
69
+ - command : shell.exec
70
+ params :
71
+ working_dir : " mongo-java-driver"
72
+ script : |
73
+ set -o verbose
74
+ set -o errexit
79
75
80
- # ######################################
76
+ [ -d MO ] && find MO -name mongo*.log | xargs tar czf mongodb-logs.tgz
77
+ [ -f mongodb-logs.tgz ] && tar ztvf mongodb-logs.tgz
78
+
79
+ [ -d MO ] && tar czf mongodb-orchestration-logs.tgz MO/*.log
80
+ [ -f mongodb-orchestration-logs.tgz ] && tar ztvf mongodb-orchestration-logs.tgz
81
+ - command : s3.put
82
+ params :
83
+ aws_key : ${aws_key}
84
+ aws_secret : ${aws_secret}
85
+ local_file : mongo-java-driver/mongodb-logs.tgz
86
+ remote_file : mongo-java-driver/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tgz
87
+ bucket : mciuploads
88
+ permissions : public-read
89
+ content_type : ${content_type|application/x-gzip}
90
+ display_name : " mongodb-logs.tar.gz"
91
+ - command : s3.put
92
+ params :
93
+ aws_key : ${aws_key}
94
+ aws_secret : ${aws_secret}
95
+ local_file : mongo-java-driver/mongodb-orchestration-logs.tgz
96
+ remote_file : mongo-java-driver/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-orchestration-logs.tgz
97
+ bucket : mciuploads
98
+ permissions : public-read
99
+ content_type : ${content_type|application/x-gzip}
100
+ display_name : " mongodb-orchestration-logs.tgz"
101
+
102
+ " cleanup" :
103
+ command : shell.exec
104
+ params :
105
+ working_dir : " mongo-java-driver"
106
+ script : |
107
+ set -o errexit
108
+ export MONGO_ORCHESTRATION_HOME=$(pwd)"/MO"
109
+ export TMPDIR=$MONGO_ORCHESTRATION_HOME/db
110
+ mongo-orchestration stop
111
+
112
+
113
+ # ####################################
81
114
# Tasks #
82
115
# ######################################
83
116
@@ -95,6 +128,8 @@ tasks:
95
128
- func : " fetch mongodb"
96
129
- func : " run tests"
97
130
- func : " attach junit results"
131
+ - func : " upload mo artifacts"
132
+ - func : " cleanup"
98
133
99
134
100
135
# ######################################
@@ -107,26 +142,30 @@ scripts:
107
142
mongo_orchestration :
108
143
unix : &mongo_orchestration_unix
109
144
start_mongo_orchestration : |
110
- trap 'set +o errexit; mongo-orchestration --pidfile /data/mo.pid stop;' EXIT
111
- pidfile=/data/mo.pid
112
- if [ -f $pidfile ]; then
113
- echo "Existing pidfile $pidfile "
114
- cat $pidfile
115
- mongo-orchestration --pidfile /data/mo.pid stop;
116
- rm -f $pidfile
117
- fi
118
- df -h
119
- ls -la
120
- echo "Starting Mongo Orchestration..."
145
+ echo "Starting MongoDB Orchestration..."
146
+
147
+ # Borrow MO config from the C driver
148
+ curl --location "https://raw.githubusercontent.com/mongodb/mongo-c-driver/master/orchestration_configs/${topology_type}s/${orchestration_file}" > "$ORCHESTRATION_FILE "
149
+ export ORCHESTRATION_URL="http://localhost:8889/v1/${topology_type}s"
150
+ export MONGO_ORCHESTRATION_HOME=$(pwd)"/MO"
151
+
152
+ rm -rf $MONGO_ORCHESTRATION_HOME
153
+ mkdir -p $MONGO_ORCHESTRATION_HOME/lib
154
+ mkdir -p $MONGO_ORCHESTRATION_HOME/db
155
+
121
156
echo "{ \"releases\": { \"default\": \"`pwd`/mongodb/bin\" } }" > orchestration.config
122
- TMPDIR=/data/db mongo-orchestration -f orchestration.config -e default start --socket-timeout-ms=60000 --bind=127.0.0.1 --enable-majority-read-concern --pidfile $pidfile
123
- curl -s http://localhost:8889/
157
+ export TMPDIR=$MONGO_ORCHESTRATION_HOME/db
158
+ nohup mongo-orchestration -f orchestration.config -e default --socket-timeout-ms=60000 --bind=127.0.0.1 --enable-majority-read-concern start > $MONGO_ORCHESTRATION_HOME/out.log 2> $MONGO_ORCHESTRATION_HOME/err.log < /dev/null &
159
+
160
+ sleep 15
161
+ curl http://localhost:8889/ --silent --max-time 120 --fail
162
+ echo "MongoDB Orchestration started..."
163
+ sleep 5
124
164
start_topology_command : &start_topology_command
125
165
start_topology : |
126
- curl -s --data @"$ORCHESTRATION_FILE" "$ORCHESTRATION_URL"
127
- ./mongodb/bin/mongo $MONGO_SHELL_CONNECTION_FLAGS --eval 'printjson(db.serverBuildInfo())' admin
128
- ./mongodb/bin/mongo $MONGO_SHELL_CONNECTION_FLAGS --eval 'printjson(db.adminCommand({getCmdLineOpts:1}))' admin
129
- ./mongodb/bin/mongo $MONGO_SHELL_CONNECTION_FLAGS --eval 'printjson(db.isMaster())' admin
166
+ echo "Starting MongoDB cluster..."
167
+ curl --silent --data @"$ORCHESTRATION_FILE" "$ORCHESTRATION_URL" --max-time 300 --fail
168
+ echo "MongoDB cluster started..."
130
169
131
170
132
171
# ######################################
0 commit comments