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_close_renamed in Windows #22613

Closed
jsoriano opened this issue Nov 17, 2020 · 6 comments
Closed

Flaky test_close_renamed in Windows #22613

jsoriano opened this issue Nov 17, 2020 · 6 comments
Labels
Filebeat Filebeat flaky-test Unstable or unreliable test cases. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@jsoriano
Copy link
Member

Flaky Test

  • Test Name: test_close_renamed
  • Link:
    # Make sure new file was picked up. As it has the same file name,
    # one entry for the new and one for the old should exist
    self.wait_until(
    lambda: len(self.get_registry()) == 2, max_timeout=10)
  • Branch: 7.x
  • Notes: Related to recent registry refactors?

Stack Trace

self = <test_harvester.Test testMethod=test_close_renamed>
    def test_close_renamed(self):
        """
        Checks that a file is closed when its renamed / rotated
        """
    
        self.render_config_template(
            path=os.path.abspath(self.working_dir) + "/log/test.log",
            close_renamed="true",
            clean_removed="false",
            scan_frequency="0.1s"
        )
        os.mkdir(self.working_dir + "/log/")
    
        testfile1 = self.working_dir + "/log/test.log"
        testfile2 = self.working_dir + "/log/test.log.rotated"
        file = open(testfile1, 'w')
    
        iterations1 = 5
        for n in range(0, iterations1):
            file.write("rotation file")
            file.write("\n")
    
        file.close()
    
        filebeat = self.start_beat()
    
        # Let it read the file
        self.wait_until(
            lambda: self.output_has(lines=iterations1), max_timeout=10)
    
        os.rename(testfile1, testfile2)
    
        with open(testfile1, 'w') as f:
            f.write("Hello World\n")
    
        # Wait until error shows up
        self.wait_until(
            lambda: self.log_contains(
                "Closing because close_renamed is enabled"),
            max_timeout=15)
    
        # Let it read the file
        self.wait_until(
            lambda: self.output_has(lines=iterations1 + 1), max_timeout=10)
    
        # Wait until registry file is created
        self.wait_until(
            lambda: self.log_contains_count("Registry file updated") > 1)
    
        # Make sure new file was picked up. As it has the same file name,
        # one entry for the new and one for the old should exist
>       self.wait_until(
            lambda: len(self.get_registry()) == 2, max_timeout=10)
tests\system\test_harvester.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_harvester.Test testMethod=test_close_renamed>
cond = <function Test.test_close_renamed.<locals>.<lambda> at 0x0000000EB2D58CA0>
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:362: TimeoutError
@jsoriano jsoriano added Filebeat Filebeat flaky-test Unstable or unreliable test cases. Team:Services (Deprecated) Label for the former Integrations-Services team labels Nov 17, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

jsoriano added a commit that referenced this issue Nov 17, 2020
Skip flaky tests reported in these issues:
* #22613
* #22407
* #22612
* #22171
* #22172
jsoriano added a commit to jsoriano/beats that referenced this issue Nov 17, 2020
Skip flaky tests reported in these issues:
* elastic#22613
* elastic#22407
* elastic#22612
* elastic#22171
* elastic#22172

(cherry picked from commit 315543b)
jsoriano added a commit to jsoriano/beats that referenced this issue Nov 17, 2020
Skip flaky tests reported in these issues:
* elastic#22613
* elastic#22407
* elastic#22612
* elastic#22171
* elastic#22172

(cherry picked from commit 315543b)
jsoriano added a commit that referenced this issue Nov 18, 2020
Skip flaky tests reported in these issues:
* #22613
* #22407
* #22612
* #22171
* #22172

(cherry picked from commit 315543b)
jsoriano added a commit that referenced this issue Nov 18, 2020
Skip flaky tests reported in these issues:
* #22613
* #22407
* #22612
* #22171
* #22172

(cherry picked from commit 315543b)
@botelastic
Copy link

botelastic bot commented Jan 27, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@botelastic botelastic bot added the Stalled label Jan 27, 2022
@jlind23
Copy link
Collaborator

jlind23 commented Mar 31, 2022

Backlog grooming: Closing for now.

@jlind23 jlind23 closed this as completed Mar 31, 2022
@jlind23 jlind23 reopened this Mar 31, 2022
@botelastic botelastic bot removed the Stalled label Mar 31, 2022
@jlind23 jlind23 added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team and removed Team:Services (Deprecated) Label for the former Integrations-Services team labels Mar 31, 2022
@elasticmachine
Copy link
Collaborator

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

@jlind23
Copy link
Collaborator

jlind23 commented Mar 31, 2022

@cmacknz What should we do with this one? Fixing it or removing it?

@cmacknz
Copy link
Member

cmacknz commented Mar 31, 2022

It looks like it is only skipped for Windows, so the test can stay for the other platforms.

Fixing this is probably fairly low value, we could just close this issue and leave the test as is. The issue link will stay in the code where it is marked as skipped.

The test has been disabled for over a year without issue.

@jlind23 jlind23 closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filebeat Filebeat 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

4 participants