Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] Add export tests to x-pack/filebeat #20156

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion filebeat/tests/system/filebeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def setUpClass(self):
if not hasattr(self, "beat_name"):
self.beat_name = "filebeat"
if not hasattr(self, "beat_path"):
self.beat_path = os.path.abspath(os.path.join(curdir, "../../"))
self.beat_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))

super(BaseTest, self).setUpClass()

Expand Down
4 changes: 4 additions & 0 deletions libbeat/tests/system/beat/common_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def test_export_index_pattern(self):
output = self.run_export_cmd("index-pattern")
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."

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_export_config(self):
Expand Down
30 changes: 30 additions & 0 deletions x-pack/filebeat/tests/system/test_filebeat_xpack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import jinja2
import os
import sys

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../filebeat/tests/system')))

from filebeat import BaseTest as FilebeatTest
from beat import common_tests


class FilebeatXPackTest(FilebeatTest, common_tests.TestExportsMixin):

@classmethod
def setUpClass(self):
self.beat_name = "filebeat"
self.beat_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../../"))

super(FilebeatTest, self).setUpClass()

def setUp(self):
super(FilebeatTest, self).setUp()

# Hack to make jinja2 have the right paths
self.template_env = jinja2.Environment(
loader=jinja2.FileSystemLoader([
os.path.abspath(os.path.join(self.beat_path, "../../filebeat")),
os.path.abspath(os.path.join(self.beat_path, "../../libbeat"))
])
)