elastic / beats

:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
https://www.elastic.co/products/beats
Other
12.14k stars 4.91k forks source link

Metricbeat test for `module/zookeeper/test_zookeeper` is flaky on CI #40468

Open dliappis opened 1 month ago

dliappis commented 1 month ago

Flaky Test

Stack Trace

See Buildkite failed CI output: https://buildkite.com/elastic/beats-metricbeat/builds/8277#01913221-21ac-4bf2-a32c-495f265f4b6f/166-438

module/zookeeper/test_zookeeper.py F.....                                                                                                                [100%]
=========================================================================== FAILURES ===========================================================================
_____________________________________________________________ ZooKeeperMntrTest_0.test_connection ______________________________________________________________
self = <test_zookeeper.ZooKeeperMntrTest_0 testMethod=test_connection>
    @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
    @pytest.mark.tag('integration')
    def test_connection(self):
        """
        ZooKeeper server module outputs an event.
        """
        self.render_config_template(modules=[{
            "name": "zookeeper",
            "metricsets": ["connection"],
            "hosts": self.get_hosts(),
            "period": "5s"
        }])
        proc = self.start_beat()
        self.wait_until(lambda: self.output_lines() > 0)
        proc.check_kill_and_wait()
        self.assert_no_logged_warnings()
        output = self.read_output_json()
>       self.assertEqual(len(output), 1)
E       AssertionError: 2 != 1
module/zookeeper/test_zookeeper.py:102: AssertionError

Reproduction

Follow the instructions in https://docs.elastic.dev/ingest-dev-docs/beats/beats-ci#reproducing-pull-request-failures to launch an identical worker. If it doesn't reproduce at first try, you may need to run mage pythonIntegTest a few times.

dliappis commented 1 month ago

cc @elastic/obs-infraobs-integrations