From 4dda2c10bfd441eb4dc5cfe53b68ed766b12793e Mon Sep 17 00:00:00 2001 From: Ryan Faircloth Date: Sat, 29 Jun 2019 19:56:34 -0400 Subject: [PATCH] Update test_poc.py --- tests/test_poc.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/test_poc.py b/tests/test_poc.py index 2e44ab2..9e71e4a 100644 --- a/tests/test_poc.py +++ b/tests/test_poc.py @@ -28,6 +28,7 @@ def setup_splunk(): while True: try: c = client.connect(username="admin", password="Changed@11", host="splunk", port="8089") + break except ConnectionRefusedError: tried +=1 if tried>90: @@ -40,12 +41,15 @@ def sendsingle(message): server_address = ('sc4s', 514) tried = 0 - try: - sock.connect(server_address) - except: - if tried > 90: - raise - sleep(1) + while True: + try: + sock.connect(server_address) + break + except: + tried +=1 + if tried > 90: + raise + sleep(1) sock.sendall(str.encode(message)) sock.close()