Skip to content

Commit f9f48a1

Browse files
authored
CXX-2783 use Docker image to run mongohouse (#1085)
* use mongohouse docker image * copy waiting script from mongo-c-driver * migrate to ubuntu2204 * remove unused expansion * use `bash`, not `sh` To resolve error: ``` .evergreen/atlas_data_lake/pull-mongohouse-image.sh: 7: Bad substitution ``` * do not check output of `serverStatus` command `mongohoused` responds with `{ "ok" : 1, "host" : "localhost" }`. * remove no-longer-applicable try/catch
1 parent 77094d1 commit f9f48a1

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

.mci.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,26 +193,39 @@ functions:
193193
cd drivers-evergreen-tools
194194
export DRIVERS_TOOLS=$(pwd)
195195
196-
sh .evergreen/atlas_data_lake/build-mongohouse-local.sh
196+
bash .evergreen/atlas_data_lake/pull-mongohouse-image.sh
197197
198198
"run_mongohouse":
199199
command: shell.exec
200200
params:
201201
shell: bash
202-
background: true
203202
script: |
204203
cd drivers-evergreen-tools
205204
export DRIVERS_TOOLS=$(pwd)
206205
207-
sh .evergreen/atlas_data_lake/run-mongohouse-local.sh
206+
bash .evergreen/atlas_data_lake/run-mongohouse-image.sh
208207
209208
"test_mongohouse":
210209
command: shell.exec
211210
params:
212211
shell: bash
213212
working_dir: "mongo-cxx-driver"
214213
script: |
215-
echo "testing that mongohouse is running..."
214+
echo "Waiting for mongohouse to start..."
215+
wait_for_mongohouse() {
216+
for _ in $(seq 300); do
217+
# Exit code 7: "Failed to connect to host".
218+
if curl -s localhost:$1; (("$?" != 7)); then
219+
return 0
220+
else
221+
sleep 1
222+
fi
223+
done
224+
echo "Could not detect mongohouse on port $1" 1>&2
225+
return 1
226+
}
227+
wait_for_mongohouse 27017 || exit
228+
echo "Waiting for mongohouse to start... done."
216229
ps aux | grep mongohouse
217230
218231
cd build
@@ -227,6 +240,7 @@ functions:
227240
fi
228241
229242
export MONGOHOUSE_TESTS_PATH="$(pwd)/../data/mongohouse"
243+
export RUN_MONGOHOUSE_TESTS=ON
230244
231245
ulimit -c unlimited || true
232246
@@ -1840,8 +1854,7 @@ buildvariants:
18401854
display_name: "Mongohouse Test"
18411855
expansions:
18421856
build_type: "Release"
1843-
mongodb_version: "latest"
1844-
run_on: ubuntu2004-test
1857+
run_on: ubuntu2204-small
18451858
tasks:
18461859
- name: test_mongohouse
18471860

src/mongocxx/test/spec/util.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,15 @@ bool should_skip_spec_test(const client& client, document::view test) {
116116
return true;
117117
}
118118

119-
std::string server_version;
120-
try {
121-
server_version = test_util::get_server_version(client);
122-
} catch (const operation_exception& e) {
123-
// Mongohouse does not support serverStatus, so if we get an error from
124-
// serverStatus, exit this logic early and run the test.
125-
std::string message = e.what();
126-
if (message.find("command serverStatus is unsupported") != std::string::npos) {
127-
return false;
128-
}
129-
130-
throw e;
119+
auto run_mongohouse_tests = std::getenv("RUN_MONGOHOUSE_TESTS");
120+
if (run_mongohouse_tests && std::string(run_mongohouse_tests) == "ON") {
121+
// mongohoused does not return `version` field in response to serverStatus.
122+
// Exit early to run the test.
123+
return false;
131124
}
132125

126+
std::string server_version = test_util::get_server_version(client);
127+
133128
std::string topology = test_util::get_topology(client);
134129

135130
if (test["ignore_if_server_version_greater_than"]) {

0 commit comments

Comments
 (0)