Browse Source

TCP Connect robot keyword

* reduce timeout to a reasonable value
* explicitly close socket, don't wait for GC
tags/1.8.2
Anton Yuzhaninov 5 years ago
parent
commit
43ceedc68f
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      test/functional/lib/rspamd.py

+ 7
- 0
test/functional/lib/rspamd.py View File

@@ -160,8 +160,15 @@ def spamc(addr, port, filename):
return r.decode('utf-8')

def TCP_Connect(addr, port):
"""Attempts to open a TCP connection to specified address:port

Example:
| Wait Until Keyword Succeeds | 5s | 10ms | TCP Connect | localhost | 8080 |
"""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(5) # seconds
s.connect((addr, port))
s.close()

def update_dictionary(a, b):
a.update(b)

Loading…
Cancel
Save