Function merino_integration_tests::merino_test
source · [−]pub async fn merino_test<FSettings, FTest, Fut>(
settings_changer: FSettings,
test: FTest
) -> Fut::Output where
FSettings: FnOnce(&mut Settings),
FTest: Fn(TestingTools) -> Fut,
Fut: Future,
Expand description
Run a test with a fully configured Merino server.
The server will listen on a port assigned arbitrarily by the OS.
A suite of tools will be passed to the test function in the form of an
instance of TestingTools
. It includes an HTTP client configured to use
the test server, an HTTP mock server that Remote Settings has been configured
to read from, and a log collector that can make assertions about logs that
were printed.
Example
#[actix_rt::test]
async fn a_test() {
merino_test(
|settings| settings.debug = false,
|TestingTools { test_client, mut log_watcher, .. }| async move {
assert!(true) // Test goes here
}
).await
}
Panics
May panic if tests could not be set up correctly.