From 1d70a33bde50f7c533a50c5c91bafe4a21ddd0a3 Mon Sep 17 00:00:00 2001 From: cdelgado Date: Tue, 18 Jan 2022 12:09:14 +0100 Subject: [PATCH] Event index is not available on integration test --- .../enterprisesearch/test_enterprisesearch.py | 35 +++++-------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/x-pack/metricbeat/module/enterprisesearch/test_enterprisesearch.py b/x-pack/metricbeat/module/enterprisesearch/test_enterprisesearch.py index 73d0af2e8bb..cba273bc7ee 100644 --- a/x-pack/metricbeat/module/enterprisesearch/test_enterprisesearch.py +++ b/x-pack/metricbeat/module/enterprisesearch/test_enterprisesearch.py @@ -11,19 +11,11 @@ class Test(XPackTest): # ------------------------------------------------------------------------- @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, 'integration test') - def test_health_xpack_disabled(self, xpackEnabled): - """Tests the Health API and the associated metricset with XPack disabled""" - self.health_check(xpackEnabled=False) - - @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, 'integration test') - def test_health_xpack_enabled(self, xpackEnabled): - """Tests the Health API and the associated metricset with XPack enabled""" - self.health_check(xpackEnabled=True) - - def health_check(self, xpackEnabled): + def test_health(self): + """Tests the Health API and the associated metricset""" # Setup the environment - self.setup_environment(metricset="health", xpackEnabled=xpackEnabled) + self.setup_environment(metricset="health") # Get a single event for testing evt = self.get_event() @@ -33,23 +25,14 @@ def health_check(self, xpackEnabled): health = evt["enterprisesearch"]["health"] self.assertIn("jvm", health) - self.assertEqual(evt["index"].startsWith(".monitoring-"), xpackEnabled) # ------------------------------------------------------------------------- @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, 'integration test') - def test_stats_xpack_disabled(self): - """Tests the Stats API and the associated metricset with XPack disabled""" - self.stats_check(xpackEnabled=False) - - @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, 'integration test') - def test_stats_xpack_enabled(self): - """Tests the Stats API and the associated metricset with XPack enabled""" - self.stats_check(xpackEnabled=True) - - def stats_check(self, xpackEnabled): + def test_stats(self): + """Tests the Stats API and the associated metricset""" # Setup the environment - self.setup_environment(metricset="stats", xpackEnabled=xpackEnabled) + self.setup_environment(metricset="stats") # Get a single event for testing evt = self.get_event() @@ -59,10 +42,9 @@ def stats_check(self, xpackEnabled): stats = evt["enterprisesearch"]["stats"] self.assertIn("http", stats) - self.assertEqual(evt["index"].startsWith(".monitoring-"), xpackEnabled) # ------------------------------------------------------------------------- - def setup_environment(self, metricset, xpackEnabled): + def setup_environment(self, metricset): """Sets up the testing environment and starts all components needed""" self.render_config_template(modules=[{ @@ -71,8 +53,7 @@ def setup_environment(self, metricset, xpackEnabled): "hosts": [self.compose_host(service="enterprise_search")], "username": self.get_username(), "password": self.get_password(), - "period": "5s", - "xpack.enabled": xpackEnabled + "period": "5s" }]) proc = self.start_beat(home=self.beat_path)