Skip to content

Commit

Permalink
Fix flaky python test
Browse files Browse the repository at this point in the history
Fix the flaky python test. Moving the file instead of truncating it seems to solve the problem. Maybe the write was not properly synced to disk.

The advantage of moving the file is that if the test runs we can later inspect it.
  • Loading branch information
belimawr committed May 10, 2024
1 parent a15951d commit bd10c59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions filebeat/tests/system/test_reload_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def test_start_stop(self):

self.wait_until(lambda: self.output_lines() == 1)

# Remove input
with open(self.working_dir + "/configs/input.yml", 'w') as f:
f.write("")
# Remove input by moving the file
# we keep it around to help debugging
os.rename(self.working_dir + "/configs/input.yml", self.working_dir + "/configs/input.yml.disabled")

# Wait until input is stopped
self.wait_until(
Expand Down

0 comments on commit bd10c59

Please sign in to comment.