Skip to content

filebeat.tests.system.test_registrar.Test test_rotating_file #867

@v1v

Description

@v1v

Flaky Test

Details

{
  "id": "27a1995b-5f24-8948-a4ee-5ded6269370d",
  "web_url": "https://buildkite.com/organizations/elastic/analytics/suites/beats/tests/27a1995b-5f24-8948-a4ee-5ded6269370d",
  "scope": "filebeat.tests.system.test_registrar.Test",
  "name": "test_rotating_file",
  "location": "filebeat/tests/system/test_registrar.py:279",
  "file_name": "filebeat/tests/system/test_registrar.py",
  "instances": 8,
  "latest_occurrence_at": "2026-04-01T07:45:00.320Z",
  "most_recent_instance_at": "2026-04-01T07:45:00.320Z",
  "last_resolved_at": null,
  "ownership_team_ids": [],
  "failure_examples": [
    {
      "message": "{'backtrace': ['self = <test_registrar.Test testMethod=test_rotating_file>', '', \"    @unittest.skipIf(platform.system() == 'Darwin' or os.name == 'nt',\", \"                     'Flaky test: https://github.com/elastic/beats/issues/26378')\", '    def test_rotating_file(self):', '        \"\"\"', '        Checks that the registry is properly updated after a file is rotated', '        \"\"\"', '        self.render_config_template(', '            path=os.path.abspath(self.working_dir) + \"/log/*\",', '            close_inactive=\"1s\"', '        )', '    ', '        os.mkdir(self.working_dir + \"/log/\")', '        testfile_path = self.working_dir + \"/log/test.log\"', '    ', '        filebeat = self.start_beat()', '    ', \"        with open(testfile_path, 'w') as testfile:\", '            testfile.write(\"offset 9\\\\n\")', '    ', '        self.wait_until(lambda: self.output_has(lines=1),', '                        max_timeout=10)', '    ', '        testfilerenamed = self.working_dir + \"/log/test.1.log\"', '        os.rename(testfile_path, testfilerenamed)', '    ', \"        with open(testfile_path, 'w') as testfile:\", '            testfile.write(\"offset 10\\\\n\")', '    ', '        self.wait_until(lambda: self.output_has(lines=2),', '                        max_timeout=10)', '    ', '        # Wait until rotation is detected', '>       self.wait_until(', '            lambda: self.log_contains(', '                \"Updating state for renamed file\"),', '            max_timeout=10)', '', 'tests/system/test_registrar.py:312: ', '_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ', '', 'self = <test_registrar.Test testMethod=test_rotating_file>, cond = <function Test.test_rotating_file.<locals>.<lambda> at 0x7c609c835f70>, max_timeout = 10', \"poll_interval = 0.1, name = 'cond', err_msg = ''\", '', '    def wait_until(self, cond, max_timeout=20, poll_interval=0.1, name=\"cond\", err_msg=\"\"):', '        \"\"\"', '        TODO: this can probably be a \"wait_until_output_count\", among other things, since that could actually use `self`, and this can become an internal function', '        Waits until the cond function returns true,', '        or until the max_timeout is reached. Calls the cond', '        function every poll_interval seconds.', '    ', '        If the max_timeout is reached before cond() returns', '        true, an exception is raised.', '        \"\"\"', '        start = datetime.now()', '        while not cond():', '            if datetime.now() - start > timedelta(seconds=max_timeout):', '                print(\"Test has failed, here are the Beat logs\")', '                if self.output_lines() == 0:', '                    print(\"\\\\n\\\\nBeat had no output file\")', '                else:', '                    print(\"\\\\n\\\\nHere is the beat\\'s output file:\")', '                    for entry in self.read_output():', '                        print(entry)', '>               raise WaitTimeoutError(', '                    f\"Timeout waiting for condition \\'{name}\\'. Waited {max_timeout} seconds: {err_msg}\")', \"E               beat.beat.WaitTimeoutError: Timeout waiting for condition 'cond'. Waited 10 seconds:\", '', '../libbeat/tests/system/beat/beat.py:453: WaitTimeoutError'], 'expanded': [\"beat.beat.WaitTimeoutError: Timeout waiting for condition 'cond'. Waited 10 seconds:\"]}",
      "run_url": "https://api.buildkite.com/v2/analytics/organizations/elastic/suites/beats/runs/a1d07ab0-5cd2-8273-b75d-48e6b690371b",
      "run_time": "2026-04-01T07:32:08.595Z"
    }
  ]
}

Failure Examples

Example 1:
Run: https://api.buildkite.com/v2/analytics/organizations/elastic/suites/beats/runs/a1d07ab0-5cd2-8273-b75d-48e6b690371b
Time: 2026-04-01T07:32:08.595Z

{'backtrace': ['self = <test_registrar.Test testMethod=test_rotating_file>', '', "    @unittest.skipIf(platform.system() == 'Darwin' or os.name == 'nt',", "                     'Flaky test: https://github.com/elastic/beats/issues/26378')", '    def test_rotating_file(self):', '        """', '        Checks that the registry is properly updated after a file is rotated', '        """', '        self.render_config_template(', '            path=os.path.abspath(self.working_dir) + "/log/*",', '            close_inactive="1s"', '        )', '    ', '        os.mkdir(self.working_dir + "/log/")', '        testfile_path = self.working_dir + "/log/test.log"', '    ', '        filebeat = self.start_beat()', '    ', "        with open(testfile_path, 'w') as testfile:", '            testfile.write("offset 9\\n")', '    ', '        self.wait_until(lambda: self.output_has(lines=1),', '                        max_timeout=10)', '    ', '        testfilerenamed = self.working_dir + "/log/test.1.log"', '        os.rename(testfile_path, testfilerenamed)', '    ', "        with open(testfile_path, 'w') as testfile:", '            testfile.write("offset 10\\n")', '    ', '        self.wait_until(lambda: self.output_has(lines=2),', '                        max_timeout=10)', '    ', '        # Wait until rotation is detected', '>       self.wait_until(', '            lambda: self.log_contains(', '                "Updating state for renamed file"),', '            max_timeout=10)', '', 'tests/system/test_registrar.py:312: ', '_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ', '', 'self = <test_registrar.Test testMethod=test_rotating_file>, cond = <function Test.test_rotating_file.<locals>.<lambda> at 0x7c609c835f70>, max_timeout = 10', "poll_interval = 0.1, name = 'cond', err_msg = ''", '', '    def wait_until(self, cond, max_timeout=20, poll_interval=0.1, name="cond", err_msg=""):', '        """', '        TODO: this can probably be a "wait_until_output_count", among other things, since that could actually use `self`, and this can become an internal function', '        Waits until the cond function returns true,', '        or until the max_timeout is reached. Calls the cond', '        function every poll_interval seconds.', '    ', '        If the max_timeout is reached before cond() returns', '        true, an exception is raised.', '        """', '        start = datetime.now()', '        while not cond():', '            if datetime.now() - start > timedelta(seconds=max_timeout):', '                print("Test has failed, here are the Beat logs")', '                if self.output_lines() == 0:', '                    print("\\n\\nBeat had no output file")', '                else:', '                    print("\\n\\nHere is the beat\'s output file:")', '                    for entry in self.read_output():', '                        print(entry)', '>               raise WaitTimeoutError(', '                    f"Timeout waiting for condition \'{name}\'. Waited {max_timeout} seconds: {err_msg}")', "E               beat.beat.WaitTimeoutError: Timeout waiting for condition 'cond'. Waited 10 seconds:", '', '../libbeat/tests/system/beat/beat.py:453: WaitTimeoutError'], 'expanded': ["beat.beat.WaitTimeoutError: Timeout waiting for condition 'cond'. Waited 10 seconds:"]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions