Skip to content

Commit

Permalink
Fix for topbeat flaky test. Maybe, possibly (#1518)
Browse files Browse the repository at this point in the history
Check that we have a full line before attempting to JSON decode it. See

Closes #1517.
  • Loading branch information
tsg authored and andrewkroh committed Apr 28, 2016
1 parent 1531005 commit a4281c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libbeat/tests/system/beat/beat.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def read_output(self,
jsons = []
with open(os.path.join(self.working_dir, output_file), "r") as f:
for line in f:
if len(line) == 0 or line[len(line)-1] != "\n":
# hit EOF
break

try:
jsons.append(self.flatten_object(json.loads(line), []))
except:
Expand All @@ -219,6 +223,10 @@ def read_output_json(self, output_file=None):
jsons = []
with open(os.path.join(self.working_dir, output_file), "r") as f:
for line in f:
if len(line) == 0 or line[len(line)-1] != "\n":
# hit EOF
break

jsons.append(json.loads(line))
return jsons

Expand Down

0 comments on commit a4281c0

Please sign in to comment.