summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2017-02-07 16:29:46 +0100
committerMagnus Ahltorp <map@kth.se>2017-02-07 16:29:46 +0100
commit4108558e0ac7622776db69a283b83486647f8c65 (patch)
treebc7fc8c78ad048121eae859a91da26ae220106a0 /tools
parent71cc72d3c5e977355ebb0aa8bcb065a08207ec2f (diff)
Improve start and stop of Erlang nodesbetter-start-stop
Diffstat (limited to 'tools')
-rwxr-xr-xtools/compileconfig.py8
-rwxr-xr-xtools/testcase1.py42
2 files changed, 43 insertions, 7 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index a5f013a..13fb433 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -447,10 +447,14 @@ def gen_testmakefile(config, testmakefile, machines, shellvars=False):
print >>configfile, "STORAGENODES=" + delimiter + " ".join(['%s:%s' % (name, 'catlfish') for name in storagenodenames if name not in frontendnodenames]) + delimiter
print >>configfile, "SIGNINGNODES=" + delimiter + " ".join(['%s:%s' % (name, 'catlfish') for name in signingnodenames]) + delimiter
print >>configfile, "MERGESECONDARYNODES=" + delimiter + " ".join(['%s:%s' % (name, 'catlfish') for name in mergesecondarynodenames]) + delimiter
- print >>configfile, "MERGEPRIMARYNODE=" '%s:%s' % (config["primarymergenode"], 'merge')
+ print >>configfile, "MERGEPRIMARYNODES=" + delimiter + '%s:%s' % (config["primarymergenode"], 'merge') + delimiter
print >>configfile, "MACHINES=" + delimiter + " ".join([str(e) for e in range(1, machines+1)]) + delimiter
- print >>configfile, "TESTURLS=" + delimiter + " ".join(frontendnodeaddresses+storagenodeaddresses+signingnodeaddresses+mergesecondarynodeaddresses) + delimiter
+ print >>configfile, "FRONTENDTESTURLS=" + delimiter + " ".join(frontendnodeaddresses) + delimiter
+ print >>configfile, "STORAGETESTURLS=" + delimiter + " ".join(storagenodeaddresses) + delimiter
+ print >>configfile, "SIGNINGTESTURLS=" + delimiter + " ".join(signingnodeaddresses) + delimiter
+ print >>configfile, "MERGESECONDARYTESTURLS=" + delimiter + " ".join(mergesecondarynodeaddresses) + delimiter
+ print >>configfile, "MERGEPRIMARYTESTURLS=" + delimiter + " ".join([]) + delimiter
print >>configfile, "BASEURL=" + delimiter + config["baseurl"] + delimiter
configfile.close()
diff --git a/tools/testcase1.py b/tools/testcase1.py
index 6a12301..63be2e1 100755
--- a/tools/testcase1.py
+++ b/tools/testcase1.py
@@ -165,18 +165,50 @@ def correct_tree_size(expected):
return False
return True
+import readconfig
+
+def mergestatus(configfile, localconfigfile):
+ localconfig = readconfig.read_config(localconfigfile)
+ config = readconfig.verify_and_read_config(configfile, localconfig["logadminkey"])
+
+ paths = localconfig["paths"]
+ mergenodes = config.get("mergenodes", [])
+ mergedb = paths["mergedb"]
+ sthfile = mergedb + "/sth"
+ currentsizefile = mergedb + "/fetched"
+
+ sth = json.loads(open(sthfile, "r").read())
+ currentsize = json.loads(open(currentsizefile, "r").read())
+
+ print >>sys.stderr, currentsize["index"]+1,
+
+ for mergenode in mergenodes:
+ if mergenode["name"] == config["primarymergenode"]:
+ continue
+ verifiedfile = mergedb + "/verified." + mergenode["name"]
+ try:
+ tree = json.loads(open(verifiedfile, "r").read())
+ print >>sys.stderr, tree["tree_size"],
+ except (IOError, ValueError):
+ pass
+ print >>sys.stderr, sth["tree_size"],
+ print
+
+
def merge(expected=None, wait=0):
+ rv = subprocess.call([toolsdir + "/merge", "--config", testdir + "/catlfish-test.cfg",
+ "--localconfig", testdir + "/catlfish-test-local-merge.cfg"])
+ if rv:
+ return rv
for i in range(10):
- rv = subprocess.call([toolsdir + "/merge", "--config", testdir + "/catlfish-test.cfg",
- "--localconfig", testdir + "/catlfish-test-local-merge.cfg"])
- if rv:
- return rv
+ mergestatus(testdir + "/catlfish-test.cfg", testdir + "/catlfish-test-local-merge.cfg")
if i < wait:
sleep(1)
continue
if correct_tree_size(expected):
return 0
- return 0
+ sleep(1)
+ return 1
mergeresult = merge(expected=0, wait=3)
assert_equal(mergeresult, 0, "merge", quiet=True, fatal=True)