PLT-6976: Elasticsearch capitalisation and tests. (#6839)

* Fixes Elasticsearch to have consistent capitalisation everywhere
  across the code and UI (except the config file unfortunately).
* Adds basic unit tests for Elastichsearch.
* Adds a Elasticsearch docker image to the Makefile to enable testing
  the Elasticsearch feature.
Этот коммит содержится в:
George Goldberg
2017-07-07 15:36:17 +01:00
коммит произвёл GitHub
родитель 0495a51949
Коммит db2f6cf076
9 изменённых файлов: 62 добавлений и 27 удалений

Просмотреть файл

@@ -11,7 +11,7 @@ import (
)
func TestElasticsearch() *model.AppError {
if esI := einterfaces.GetElasticSearchInterface(); esI != nil {
if esI := einterfaces.GetElasticsearchInterface(); esI != nil {
if err := esI.TestConfig(); err != nil {
return err
}

Просмотреть файл

@@ -99,7 +99,7 @@ func CreatePost(post *model.Post, teamId string, triggerWebhooks bool) (*model.P
rpost = result.Data.(*model.Post)
}
esInterface := einterfaces.GetElasticSearchInterface()
esInterface := einterfaces.GetElasticsearchInterface()
if esInterface != nil && *utils.Cfg.ElasticSearchSettings.EnableIndexing {
go esInterface.IndexPost(rpost, teamId)
}
@@ -284,7 +284,7 @@ func UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model.AppError
} else {
rpost := result.Data.(*model.Post)
esInterface := einterfaces.GetElasticSearchInterface()
esInterface := einterfaces.GetElasticsearchInterface()
if esInterface != nil && *utils.Cfg.ElasticSearchSettings.EnableIndexing {
go func() {
if rchannel := <-Srv.Store.Channel().GetForPost(rpost.Id); rchannel.Err != nil {
@@ -471,7 +471,7 @@ func DeletePost(postId string) (*model.Post, *model.AppError) {
go DeletePostFiles(post)
go DeleteFlaggedPosts(post.Id)
esInterface := einterfaces.GetElasticSearchInterface()
esInterface := einterfaces.GetElasticsearchInterface()
if esInterface != nil && *utils.Cfg.ElasticSearchSettings.EnableIndexing {
go esInterface.DeletePost(post.Id)
}
@@ -502,8 +502,8 @@ func DeletePostFiles(post *model.Post) {
func SearchPostsInTeam(terms string, userId string, teamId string, isOrSearch bool) (*model.PostList, *model.AppError) {
paramsList := model.ParseSearchParams(terms)
esInterface := einterfaces.GetElasticSearchInterface()
if esInterface != nil && *utils.Cfg.ElasticSearchSettings.EnableSearching && utils.IsLicensed && *utils.License.Features.ElasticSearch {
esInterface := einterfaces.GetElasticsearchInterface()
if esInterface != nil && *utils.Cfg.ElasticSearchSettings.EnableSearching && utils.IsLicensed && *utils.License.Features.Elasticsearch {
finalParamsList := []*model.SearchParams{}
for _, params := range paramsList {
@@ -539,7 +539,7 @@ func SearchPostsInTeam(terms string, userId string, teamId string, isOrSearch bo
return nil, err
}
postIds, err := einterfaces.GetElasticSearchInterface().SearchPosts(userChannels, finalParamsList)
postIds, err := einterfaces.GetElasticsearchInterface().SearchPosts(userChannels, finalParamsList)
if err != nil {
return nil, err
}