Skip to content

Commit 82ae6c1

Browse files
committed
Fix test for new field viaq_index_name
Closes #115
1 parent 24805e0 commit 82ae6c1

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

namespaces/_default_.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,5 @@ _index_type_:
192192
type: keyword
193193
example: project.my-cool-project-in-lab04.748e92c2-70d7-11e9-b387-000d3af2d83b.2019.05.09
194194
description: |
195-
Index name in which this message will be stored within the elastic search.
195+
Index name in which this message will be stored within the Elasticsearch.
196196
The value of this field is generated based on the source of the message.

scripts/compare_against_released_patterns_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ def _support_index_pattern_fields_field_only(self, released_file_URL, es_version
151151
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.LINE_BREAK"]
152152
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.STREAM_ID"]
153153
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.SYSTEMD_INVOCATION_ID"]
154-
# ======================
154+
155+
# https://github.com/ViaQ/elasticsearch-templates/pull/115
156+
generated_fields = [item for item in generated_fields if not item["name"] == "viaq_index_name"]
157+
# ======================
155158

156159
# ---- wget
157160
print('\nDownloading released index pattern file for comparison:')

scripts/compare_against_released_templates_test.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ def _remove_all_field(data, es_version):
8686
_idx_type = supported.index_type_name(es_version)
8787
if "_all" in data["mappings"][_idx_type]:
8888
del data["mappings"][_idx_type]["_all"]
89-
89+
90+
@staticmethod
91+
def _remove_viaq_index_name_field(generated_json, es_version):
92+
# Remove 'viaq_index_name' field. It was introduced after support for ES6.x was added.
93+
# https://github.com/ViaQ/elasticsearch-templates/pull/115
94+
_idx_type = supported.index_type_name(es_version)
95+
if "viaq_index_name" in generated_json["mappings"][_idx_type]["properties"]:
96+
del generated_json["mappings"][_idx_type]["properties"]["viaq_index_name"]
9097

9198
@staticmethod
9299
def _generate_json_index_template(args, es_version):
@@ -156,11 +163,14 @@ def _support_compare_index_templates(self, es_version, args, json_url):
156163
del generated_json["mappings"][_idx_type]["properties"]["systemd"]["properties"]["t"]["properties"]["STREAM_ID"]
157164
del generated_json["mappings"][_idx_type]["properties"]["systemd"]["properties"]["t"]["properties"]["SYSTEMD_INVOCATION_ID"]
158165

166+
self._remove_viaq_index_name_field(generated_json, es_version)
167+
159168
elif es_version == supported._es5x:
160-
pass
169+
self._remove_viaq_index_name_field(generated_json, es_version)
161170

162171
elif es_version == supported._es6x:
163172
self._remove_all_field(generated_json, es_version)
173+
self._remove_viaq_index_name_field(generated_json, es_version)
164174
# ======================
165175

166176
generated_index_template = self._sort(generated_json)

0 commit comments

Comments
 (0)