Commit 585f17aa authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Fix problem with elasticsearch testing in behat"

parents e59a6cec 277d07c4
......@@ -610,7 +610,6 @@ class PluginSearchElasticsearch extends PluginSearch {
foreach ($enabledtypes as $type) {
ElasticsearchIndexing::create_triggers($type);
ElasticsearchIndexing::requeue_searchtype_contents($type);
error_log("fetching mapping for $type");
$ES_class = 'ElasticsearchType_' . $type;
if ($ES_class::$mappingconfv6 === false) {
error_log("mapping $type missing - will ignore");
......@@ -724,7 +723,6 @@ class PluginSearchElasticsearch extends PluginSearch {
)
)
);
error_log("setting merged mappings");
$ESClient = self::make_client('write');
// Set mapping on index type.
$ESClient->indices()->putMapping($mappingparams);
......@@ -2131,9 +2129,7 @@ class ElasticsearchIndexing {
)
);
error_log("beore create");
$ESClient->indices()->create($params);
error_log("after create");
}
......
......@@ -123,6 +123,23 @@ class BehatAdmin extends BehatBase {
ArtefactTypeFolder::change_public_folder_name($oldlanguage, $settings['lang']);
}
if (isset($settings['searchplugin']) && $oldsearchplugin != $settings['searchplugin']) {
// Call the old search plugin's sitewide cleanup method
safe_require('search', $oldsearchplugin);
call_static_method(generate_class_name('search', $oldsearchplugin), 'cleanup_sitewide');
// Call the new search plugin's sitewide initialize method
safe_require('search', $settings['searchplugin']);
$initialize = call_static_method(generate_class_name('search', $settings['searchplugin']), 'initialize_sitewide');
if (!$initialize) {
throw new SystemException(get_string('searchconfigerror1', 'admin', $settings['searchplugin']));
}
// Call the new search plugin's can connect
safe_require('search', $settings['searchplugin']);
$connect = call_static_method(generate_class_name('search', $settings['searchplugin']), 'can_connect');
if (!$connect) {
throw new SystemException(get_string('searchconfigerror1', 'admin', $settings['searchplugin']));
}
}
}
/**
......
......@@ -41,3 +41,8 @@ Scenario: Testing functions for user search page (Bug 1431569)
And I press "Go"
Then I should see "Angela"
And I should see "Page UserA_01"
# set system off elasticsearch
Then the following site settings are set:
| field | value |
| searchplugin | internal |
And I log out
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment