From bd10c59af2c4f227ddde541cc46d13beb415ea6b Mon Sep 17 00:00:00 2001 From: Tiago Queiroz Date: Fri, 10 May 2024 12:53:50 -0400 Subject: [PATCH] Fix flaky python test 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. --- filebeat/tests/system/test_reload_inputs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filebeat/tests/system/test_reload_inputs.py b/filebeat/tests/system/test_reload_inputs.py index 36c5b2eeedd2..bd1e19408942 100644 --- a/filebeat/tests/system/test_reload_inputs.py +++ b/filebeat/tests/system/test_reload_inputs.py @@ -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(