1.9 KiB
1.9 KiB
Extensions
This module provides utilities for setting up and configuring MongoDB extensions in resmoke test suites.
Overview
Extensions are dynamically loaded shared objects (.so files) that provide additional functionality
to MongoDB. The utilities in this folder can handle:
- Discovering extension
.sofiles in build directories - Generating
.confconfiguration files for extensions - Cleaning up configuration files after tests
Configuration File Generation in Tests
Extension .conf files are YAML configuration files that tell the server how to load an extension.
They contain:
sharedLibraryPath: Path to the.sofileextensionOptions: Optional configuration parameters for the extension
For example:
# foo.conf
sharedLibraryPath: /path/to/libfoo_mongo_extension.so
extensionOptions:
someSetting: <value>
How Config Files Are Generated
The generate_extension_configs.py module creates .conf files:
- Receives a list of
.sofile paths (either from automatic discovery viafind_and_generate_extension_configs.py, or manually via--so-filescommand-line argument) - For each
.so, creates a.conffile in the temp directory (/tmp/mongo/extensions/) - Looks up corresponding extension options from
src/mongo/db/extension/test_examples/configurations.yml, if any are specified - Writes the config file with
sharedLibraryPathand anyextensionOptions
Automatic Discovery and Generation
The find_and_generate_extension_configs.py module combines discovery and generation:
- Searches for
*_mongo_extension.sofiles in build directories:- Evergreen:
dist-test/lib/ - Local:
bazel-bin/install-dist-test/lib/orbazel-bin/install-extensions/lib/
- Evergreen:
- Generates
.conffiles with a unique UUID suffix to avoid collisions - Adds the
loadExtensionsparameter to mongod/mongos options