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 удалений

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

@@ -49,7 +49,7 @@ type Features struct {
MHPNS *bool `json:"mhpns"`
SAML *bool `json:"saml"`
PasswordRequirements *bool `json:"password_requirements"`
ElasticSearch *bool `json:"elastic_search"`
Elasticsearch *bool `json:"elastic_search"`
Announcement *bool `json:"announcement"`
// after we enabled more features for webrtc we'll need to control them with this
FutureFeatures *bool `json:"future_features"`
@@ -68,7 +68,7 @@ func (f *Features) ToMap() map[string]interface{} {
"mhpns": *f.MHPNS,
"saml": *f.SAML,
"password": *f.PasswordRequirements,
"elastic_search": *f.ElasticSearch,
"elastic_search": *f.Elasticsearch,
"future": *f.FutureFeatures,
}
}
@@ -139,9 +139,9 @@ func (f *Features) SetDefaults() {
*f.PasswordRequirements = *f.FutureFeatures
}
if f.ElasticSearch == nil {
f.ElasticSearch = new(bool)
*f.ElasticSearch = *f.FutureFeatures
if f.Elasticsearch == nil {
f.Elasticsearch = new(bool)
*f.Elasticsearch = *f.FutureFeatures
}
if f.Announcement == nil {

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

@@ -45,7 +45,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
CheckTrue(t, *f.MHPNS)
CheckTrue(t, *f.SAML)
CheckTrue(t, *f.PasswordRequirements)
CheckTrue(t, *f.ElasticSearch)
CheckTrue(t, *f.Elasticsearch)
CheckTrue(t, *f.FutureFeatures)
f = Features{}
@@ -64,7 +64,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
*f.MHPNS = true
*f.SAML = true
*f.PasswordRequirements = true
*f.ElasticSearch = true
*f.Elasticsearch = true
f.SetDefaults()
@@ -80,7 +80,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
CheckTrue(t, *f.MHPNS)
CheckTrue(t, *f.SAML)
CheckTrue(t, *f.PasswordRequirements)
CheckTrue(t, *f.ElasticSearch)
CheckTrue(t, *f.Elasticsearch)
CheckFalse(t, *f.FutureFeatures)
}
@@ -161,7 +161,7 @@ func TestLicenseToFromJson(t *testing.T) {
CheckBool(t, *f1.MHPNS, *f.MHPNS)
CheckBool(t, *f1.SAML, *f.SAML)
CheckBool(t, *f1.PasswordRequirements, *f.PasswordRequirements)
CheckBool(t, *f1.ElasticSearch, *f.ElasticSearch)
CheckBool(t, *f1.Elasticsearch, *f.Elasticsearch)
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)
invalid := `{"asdf`