Skip to content

CXX-2783 use Docker image to run mongohouse #1085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .mci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,39 @@ functions:
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)

sh .evergreen/atlas_data_lake/build-mongohouse-local.sh
bash .evergreen/atlas_data_lake/pull-mongohouse-image.sh

"run_mongohouse":
command: shell.exec
params:
shell: bash
background: true
script: |
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)

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

"test_mongohouse":
command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
echo "testing that mongohouse is running..."
echo "Waiting for mongohouse to start..."
wait_for_mongohouse() {
for _ in $(seq 300); do
# Exit code 7: "Failed to connect to host".
if curl -s localhost:$1; (("$?" != 7)); then
return 0
else
sleep 1
fi
done
echo "Could not detect mongohouse on port $1" 1>&2
return 1
}
wait_for_mongohouse 27017 || exit
echo "Waiting for mongohouse to start... done."
ps aux | grep mongohouse

cd build
Expand All @@ -227,6 +240,7 @@ functions:
fi

export MONGOHOUSE_TESTS_PATH="$(pwd)/../data/mongohouse"
export RUN_MONGOHOUSE_TESTS=ON

ulimit -c unlimited || true

Expand Down Expand Up @@ -1840,8 +1854,7 @@ buildvariants:
display_name: "Mongohouse Test"
expansions:
build_type: "Release"
mongodb_version: "latest"
run_on: ubuntu2004-test
run_on: ubuntu2204-small
tasks:
- name: test_mongohouse

Expand Down
19 changes: 7 additions & 12 deletions src/mongocxx/test/spec/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,15 @@ bool should_skip_spec_test(const client& client, document::view test) {
return true;
}

std::string server_version;
try {
server_version = test_util::get_server_version(client);
} catch (const operation_exception& e) {
// Mongohouse does not support serverStatus, so if we get an error from
// serverStatus, exit this logic early and run the test.
std::string message = e.what();
if (message.find("command serverStatus is unsupported") != std::string::npos) {
return false;
}

throw e;
auto run_mongohouse_tests = std::getenv("RUN_MONGOHOUSE_TESTS");
if (run_mongohouse_tests && std::string(run_mongohouse_tests) == "ON") {
// mongohoused does not return `version` field in response to serverStatus.
// Exit early to run the test.
return false;
}

std::string server_version = test_util::get_server_version(client);

std::string topology = test_util::get_topology(client);

if (test["ignore_if_server_version_greater_than"]) {
Expand Down