Skip to content

Commit

Permalink
Fix Winlogbeat export index-pattern with migration.6_to_7.enabled (el…
Browse files Browse the repository at this point in the history
…astic#20540)

- Test export index-pattern with migration.6_to_7.enabled=true
- Always run these tests, not only when integration testing
- Remove conflicting Winlogbeat alias
  • Loading branch information
adriansr authored and melchiormoulin committed Oct 14, 2020
1 parent 78ad60c commit 81572b5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
19 changes: 14 additions & 5 deletions libbeat/tests/system/beat/common_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def run_export_cmd(self, cmd, extra=[]):
pos = output.rfind(trailer)
if pos == -1:
raise Exception("didn't return expected trailer:{} got:{}".format(
trailer.__repr__(), output[-100:].__repr__()))
trailer.__repr__(),
output[-100:].__repr__()))
return output[:pos]

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_export_ilm_policy(self):
"""
Test that the ilm-policy can be exported with `export ilm-policy`
Expand All @@ -39,7 +39,6 @@ def test_export_ilm_policy(self):
js = json.loads(output)
assert "policy" in js

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_export_template(self):
"""
Test that the template can be exported with `export template`
Expand All @@ -48,7 +47,6 @@ def test_export_template(self):
js = json.loads(output)
assert "index_patterns" in js and "mappings" in js

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_export_index_pattern(self):
"""
Test that the index-pattern can be exported with `export index-pattern`
Expand All @@ -61,7 +59,18 @@ def test_export_index_pattern(self):
"to keep the Beat setup request size below " \
"Kibana's server.maxPayloadBytes."

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_export_index_pattern_migration(self):
"""
Test that the index-pattern can be exported with `export index-pattern` (migration enabled)
"""
output = self.run_export_cmd("index-pattern", extra=['-E', 'migration.6_to_7.enabled=true'])
js = json.loads(output)
assert "objects" in js
size = len(output.encode('utf-8'))
assert size < 1024*1024, "Kibana index pattern must be less than 1MiB " \
"to keep the Beat setup request size below " \
"Kibana's server.maxPayloadBytes."

def test_export_config(self):
"""
Test that the config can be exported with `export config`
Expand Down
5 changes: 0 additions & 5 deletions winlogbeat/_meta/fields.common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,6 @@
path: winlog.user.identifier
migration: true

- name: user.domain
type: alias
path: winlog.user.domain
migration: true

- name: user.type
type: alias
path: winlog.user.type
Expand Down
9 changes: 0 additions & 9 deletions winlogbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7204,15 +7204,6 @@ alias to: winlog.user.identifier
--
*`user.domain`*::
+
--
type: alias
alias to: winlog.user.domain
--
*`user.type`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion winlogbeat/include/fields.go

Large diffs are not rendered by default.

0 comments on commit 81572b5

Please sign in to comment.