Skip to content

Commit

Permalink
handle other containers not yet ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Faircloth committed Jun 29, 2019
1 parent 06022f7 commit 515dff3
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/test_poc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,30 @@ def setup_wordlist():

@pytest.fixture
def setup_splunk():
return client.connect(username="admin", password="Changed@11", host="splunk", port="8089")
tried=0
while true:
try:
c = client.connect(username="admin", password="Changed@11", host="splunk", port="8089")
except ConnectionRefusedError:
tried +=1
if tried>90:
raise
sleep(1)
return c

def sendsingle(message):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('sc4s', 514)

sock.connect(server_address)
tried = 0
try

sock.connect(server_address)
except:
if tried > 90:
raise
sleep(1)

sock.sendall(str.encode(message))
sock.close()

Expand Down

0 comments on commit 515dff3

Please sign in to comment.