Commit 8df72681 authored by zhifan huang's avatar zhifan huang

test: fix client_count too large

parent 4ea707df
...@@ -19,9 +19,11 @@ WORK_DIR = Path(__file__).parent / "temp_net_test" ...@@ -19,9 +19,11 @@ WORK_DIR = Path(__file__).parent / "temp_net_test"
DH_FILE = WORK_DIR / "dh2048.pem" DH_FILE = WORK_DIR / "dh2048.pem"
RE6STNET = "re6stnet" RE6STNET = "re6stnet"
RE6STNET = "python -m re6st.cli.node"
RE6ST_REGISTRY = "re6st-registry" RE6ST_REGISTRY = "re6st-registry"
#RE6ST_REGISTRY = "python -m re6st.cli.registry" RE6ST_REGISTRY = "python -m re6st.cli.registry"
RE6ST_CONF = "re6st-conf" RE6ST_CONF = "re6st-conf"
RE6ST_CONF = "python -m re6st.cli.conf"
def initial(): def initial():
"""create the workplace and dh file""" """create the workplace and dh file"""
...@@ -42,11 +44,12 @@ class Re6stRegistry(object): ...@@ -42,11 +44,12 @@ class Re6stRegistry(object):
"""class run a re6st-registry service on a namespace""" """class run a re6st-registry service on a namespace"""
registry_seq = 0 registry_seq = 0
def __init__(self, node, ip6, recreate=False): def __init__(self, node, ip6, client_number, recreate=False):
self.node = node self.node = node
# TODO need set once # TODO need set once
self.ip = node.ip self.ip = node.ip
self.ip6 = ip6 self.ip6 = ip6
self.client_number = client_number
self.name = self.generate_name() self.name = self.generate_name()
self.path = WORK_DIR / self.name self.path = WORK_DIR / self.name
...@@ -116,10 +119,10 @@ class Re6stRegistry(object): ...@@ -116,10 +119,10 @@ class Re6stRegistry(object):
def run(self): def run(self):
cmd = ("{script} --ca {ca} --key {key} --dh {dh} --ipv4 10.42.0.0/16 8 " cmd = ("{script} --ca {ca} --key {key} --dh {dh} --ipv4 10.42.0.0/16 8 "
" --logfile {log} --db {db} --run {run} --hello 4 --mailhost s " " --logfile {log} --db {db} --run {run} --hello 4 --mailhost s "
"-v4") "-v4 --client-count {nb}")
cmd = cmd.format(script=RE6ST_REGISTRY, ca=self.ca_crt, cmd = cmd.format(script=RE6ST_REGISTRY, ca=self.ca_crt,
key=self.ca_key, dh=DH_FILE, log=self.log, db=self.db, key=self.ca_key, dh=DH_FILE, log=self.log, db=self.db,
run=self.run_path).split() run=self.run_path, nb=(self.client_number+1)//2).split()
logging.debug("run registry %s at ns: %s with cmd: %s", logging.debug("run registry %s at ns: %s with cmd: %s",
self.name, self.node.pid, " ".join(cmd)) self.name, self.node.pid, " ".join(cmd))
self.proc = self.node.Popen(cmd, stdout=PIPE, stderr=PIPE) self.proc = self.node.Popen(cmd, stdout=PIPE, stderr=PIPE)
......
...@@ -21,7 +21,8 @@ def deploy_re6st(nm, recreate=False): ...@@ -21,7 +21,8 @@ def deploy_re6st(nm, recreate=False):
re6st_wrap.Re6stRegistry.registry_seq = 0 re6st_wrap.Re6stRegistry.registry_seq = 0
re6st_wrap.Re6stNode.node_seq = 0 re6st_wrap.Re6stNode.node_seq = 0
for registry in net: for registry in net:
reg = re6st_wrap.Re6stRegistry(registry, "2001:db8:42::", recreate=recreate) reg = re6st_wrap.Re6stRegistry(registry, "2001:db8:42::", len(net[registry]),
recreate=recreate)
reg_node = re6st_wrap.Re6stNode(registry, reg, name=reg.name) reg_node = re6st_wrap.Re6stNode(registry, reg, name=reg.name)
registrys.append(reg) registrys.append(reg)
reg_node.run("--gateway", "--disable-proto", "none", "--ip", registry.ip) reg_node.run("--gateway", "--disable-proto", "none", "--ip", registry.ip)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment