Allow test programs use custom port using environment variable or command-line argument

master
Andriy Senkovych 11 years ago
parent 290a188067
commit 3156b530af

@ -6,9 +6,9 @@ try:
except: except:
msgpack = None msgpack = None
import os
host = '127.0.0.1' host = os.getenv('WEBDIS_HOST', '127.0.0.1')
port = 7379 port = int(os.getenv('WEBDIS_PORT', 7379))
class TestWebdis(unittest.TestCase): class TestWebdis(unittest.TestCase):

@ -1,8 +1,12 @@
#!/bin/bash #!/bin/bash
CLIENTS=100 CLIENTS=100
REQUESTS=100000 REQUESTS=100000
HOST=127.0.0.1
PORT=7379 HOST=$WEBDIS_HOST
PORT=$WEBDIS_PORT
[ -n $HOST ] && HOST=127.0.0.1
[ -n $PORT ] && PORT=7379
info() { info() {
echo "Testing on $HOST:$PORT with $CLIENTS clients in parallel, for a total of $REQUESTS requests per benchmark." echo "Testing on $HOST:$PORT with $CLIENTS clients in parallel, for a total of $REQUESTS requests per benchmark."

@ -2,8 +2,9 @@
import socket import socket
import unittest import unittest
HOST = "127.0.0.1" import os
PORT = 7379 HOST = os.getenv('WEBDIS_HOST', '127.0.0.1')
PORT = int(os.getenv('WEBDIS_PORT', 7379))
class BlockingSocket: class BlockingSocket:

Loading…
Cancel
Save