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

Flaky Test [Extended / filebeat-macos-macosx&&x86_64 / test_rotating_file – filebeat.tests.system.test_registrar.Test] #26378

Open
jsoriano opened this issue Jun 21, 2021 · 2 comments
Labels
ci-reported Issues that have been automatically reported from the CI flaky-test Unstable or unreliable test cases. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@jsoriano
Copy link
Member

jsoriano commented Jun 21, 2021

Flaky Test

Stack Trace

self = <test_registrar.Test testMethod=test_rotating_file>

    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:311: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_registrar.Test testMethod=test_rotating_file>
cond = <function Test.test_rotating_file.<locals>.<lambda> at 0x10e648ef0>
max_timeout = 10, poll_interval = 0.1, name = 'cond'

    def wait_until(self, cond, max_timeout=10, poll_interval=0.1, name="cond"):
        """
        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):
                raise TimeoutError("Timeout waiting for '{}' to be true. ".format(name) +
>                                  "Waited {} seconds.".format(max_timeout))
E               beat.beat.TimeoutError: Timeout waiting for 'cond' to be true. Waited 10 seconds.

../libbeat/tests/system/beat/beat.py:363: TimeoutError
@jsoriano jsoriano added flaky-test Unstable or unreliable test cases. ci-reported Issues that have been automatically reported from the CI Team:Elastic-Agent Label for the Agent team labels Jun 21, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@cmacknz cmacknz added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team and removed Team:Elastic-Agent Label for the Agent team labels Apr 5, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-reported Issues that have been automatically reported from the CI flaky-test Unstable or unreliable test cases. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

No branches or pull requests

3 participants