Commit 3361b419 authored by Robert Lyon's avatar Robert Lyon

Fix problem with elasticsearch testing in behat

Change-Id: I238baec77c841fb929e7a7552dab5a4def49afe9
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 9cefb8a6
......@@ -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");
}
......
......@@ -117,6 +117,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']));
}
}
}
/**
......
@javascript @core @core_administration
Feature: Checking that elasticsearch plugin is installed
In order to index search results
Feature: Configuration on elastic search
In order to index and search the site using elasticsearch
As an admin
So I can search via elasticsearch
So I can benefit from the rich search information
Scenario: Check elasticsearch plugin is ready
Background:
Given the following plugin settings are set:
| plugintype | plugin | field | value |
| search | elasticsearch | indexname | maharatest |
| search | elasticsearch | types | usr,interaction_instance,interaction_forum_post,group,view,artefact,block_instance,collection |
| search | elasticsearch | cronlimit | 500 |
| search | elasticsearch | shards | 5 |
| search | elasticsearch | replicashards | 0 |
And the following site settings are set:
| field | value |
| searchplugin | elasticsearch |
And the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| UserA | Kupuh1pa! | UserA@example.org | Angela | User | mahara | internal | member |
| UserB | Kupuh1pa! | UserB@example.org | Bob | User | mahara | internal | member |
And the following "pages" exist:
| title | description | ownertype | ownername |
| Page UserA_01 | Page 01 | user | UserA |
And the following "permissions" exist:
| title | accesstype | accessname |
| Page UserA_01 | user | admin |
Scenario: Testing functions for user search page (Bug 1431569)
Given I log in as "admin" with password "Kupuh1pa!"
And I choose "Plugin administration" in "Extensions" from administration menu
When I follow "Configuration for search elasticsearch"
Then I should see "Failed to connect to 127.0.0.1 port 9200"
# TODO: allow actual indexing / searching
And I go to the "search" plugin "elasticsearch" configuration "elasticsearch" type
And I click on "Select all"
And I press "Save"
And I press "Reset"
And I set the following fields to these values:
| Search | Page |
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