diff options
author | Magnus Ahltorp <map@kth.se> | 2017-02-07 16:29:46 +0100 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2017-02-07 21:22:52 +0100 |
commit | 142b19cda6f9c6133c3559f320bb96b10447fb3b (patch) | |
tree | b96a7d2f23502ff0486ee4ea541af348ccf51d72 /tools/testcase1.py | |
parent | 70a87a1d878106aa97205507c3cd3eb9ba1667f2 (diff) |
Improve start and stop of Erlang nodes
Diffstat (limited to 'tools/testcase1.py')
-rwxr-xr-x | tools/testcase1.py | 42 |
1 files changed, 37 insertions, 5 deletions
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) |