Skip to content

Commit

Permalink
Use shorter filename in Filebeat test for Windows (#4271)
Browse files Browse the repository at this point in the history
The test was failing on Windows when `os.rename` failed with `[Error 3] The system cannot find the path specified`. The root cause of the failure was that the path was ~260 characters on Jenkins which is greater than the `MAX_PATH` value in Windows. This PR shortens the test log’s name to resolve the issue.

The other changes to normalize the filepath are nice to have for Windows, but not strictly required.
  • Loading branch information
andrewkroh authored and ruflin committed May 10, 2017
1 parent e5dbf0f commit 770b78a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions filebeat/tests/system/test_prospector.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,17 +485,18 @@ def test_close_inactive_file_rotation_and_removal_while_new_file_created(self):
Test that close_inactive still applies also if file was rotated,
new file created, and rotated file removed.
"""
log_path = os.path.abspath(os.path.join(self.working_dir, "log"))
os.mkdir(log_path)
testfile = os.path.join(log_path, "a.log")
renamed_file = os.path.join(log_path, "b.log")

self.render_config_template(
path=os.path.abspath(self.working_dir) + "/log/test.log",
path=testfile,
ignore_older="1h",
close_inactive="3s",
scan_frequency="0.1s",
)

os.mkdir(self.working_dir + "/log/")
testfile = self.working_dir + "/log/test.log"
renamed_file = self.working_dir + "/log/test_renamed.log"

filebeat = self.start_beat()

# wait for first "Start next scan" log message
Expand Down

0 comments on commit 770b78a

Please sign in to comment.