From 9a9408bc90b91d0401ebcf49996208c8a5ba123b Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 22 Nov 2019 12:27:37 +0100 Subject: [PATCH] Fix: import stomp in the function scope (#14703) --- x-pack/metricbeat/tests/system/test_activemq.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/metricbeat/tests/system/test_activemq.py b/x-pack/metricbeat/tests/system/test_activemq.py index 15305a7fcfd..f7a66e78223 100644 --- a/x-pack/metricbeat/tests/system/test_activemq.py +++ b/x-pack/metricbeat/tests/system/test_activemq.py @@ -2,7 +2,6 @@ import string import sys -import stomp import unittest from xpack_metricbeat import XPackTest @@ -39,12 +38,14 @@ def destination_metrics_collected(self, destination_type, destination_name): return False def verify_destination_metrics_collection(self, destination_type): + from stomp import Connection + self.render_config_template(modules=[self.get_activemq_module_config(destination_type)]) proc = self.start_beat(home=self.beat_path) destination_name = ''.join(random.choice(string.ascii_lowercase) for i in range(10)) - conn = stomp.Connection([self.get_stomp_host_port()]) + conn = Connection([self.get_stomp_host_port()]) conn.start() conn.connect(wait=True) conn.send('/{}/{}'.format(destination_type, destination_name), 'first message')