summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-07-08 13:21:31 +0200
committerLinus Nordberg <linus@nordu.net>2016-07-11 15:37:01 +0200
commite43a199b241d74f7a5ad046139a318576cdf21b6 (patch)
tree7ebff1330aa9cdd1a44947c864f08da8f1ca48aa /tools
parent3d4a9fdd338713c2f63da2b92940904762878d98 (diff)
Fix bugs in old tests. Add tests for merge takeover.
submitcert.py was not exiting with error code when cert submission failed. compileconfig.py was generating duplicate node names when Erlang nodes have several servers
Diffstat (limited to 'tools')
-rwxr-xr-xtools/compileconfig.py14
-rwxr-xr-xtools/submitcert.py10
2 files changed, 17 insertions, 7 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index 777a12f..d9ac740 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -350,19 +350,19 @@ def gen_config(nodename, config, localconfig):
def gen_testmakefile(config, testmakefile, machines):
configfile = open(testmakefile, "w")
- frontendnodenames = [node["name"] for node in config["frontendnodes"]]
- storagenodenames = [node["name"] for node in config["storagenodes"]]
- signingnodenames = [node["name"] for node in config["signingnodes"]]
- mergenodenames = [node["name"] for node in config["mergenodes"]]
- erlangnodenames = frontendnodenames + storagenodenames + signingnodenames + \
- filter(lambda name: name != config["primarymergenode"], mergenodenames)
+ frontendnodenames = set([node["name"] for node in config["frontendnodes"]])
+ storagenodenames = set([node["name"] for node in config["storagenodes"]])
+ signingnodenames = set([node["name"] for node in config["signingnodes"]])
+ mergenodenames = set([node["name"] for node in config["mergenodes"]])
+ erlangnodenames = frontendnodenames | storagenodenames | signingnodenames | \
+ set(filter(lambda name: name != config["primarymergenode"], mergenodenames))
frontendnodeaddresses = [node["publicaddress"] for node in config["frontendnodes"]]
storagenodeaddresses = [node["address"] for node in config["storagenodes"]]
signingnodeaddresses = [node["address"] for node in config["signingnodes"]]
mergenodeaddresses = [node["address"] for node in config["mergenodes"] if node["name"] != config["primarymergenode"]]
- print >>configfile, "NODES=" + " ".join(frontendnodenames+storagenodenames+signingnodenames+mergenodenames)
+ print >>configfile, "NODES=" + " ".join(frontendnodenames|storagenodenames|signingnodenames|mergenodenames)
print >>configfile, "ERLANGNODES=" + " ".join(erlangnodenames)
print >>configfile, "MACHINES=" + " ".join([str(e) for e in range(1, machines+1)])
print >>configfile, "TESTURLS=" + " ".join(frontendnodeaddresses+storagenodeaddresses+signingnodeaddresses+mergenodeaddresses)
diff --git a/tools/submitcert.py b/tools/submitcert.py
index 7719dc2..c443cf4 100755
--- a/tools/submitcert.py
+++ b/tools/submitcert.py
@@ -182,11 +182,15 @@ print ncerts, "certs"
certs = get_all_certificates(certfiles)
+errors = 0
+
(result, timing) = submitcert(certs.next())
if result != None:
nsubmitted += 1
(leafcert, issuer_key_hash, sct) = result
save_sct(sct, sth, leafcert, issuer_key_hash)
+else:
+ errors += 1
if args.pre_warm:
select.select([], [], [], 3.0)
@@ -205,6 +209,8 @@ try:
nsubmitted += 1
(leafcert, issuer_key_hash, sct) = result
save_sct(sct, sth, leafcert, issuer_key_hash)
+ else:
+ errors += 1
deltatime = datetime.datetime.now() - starttime
deltatime_f = deltatime.seconds + deltatime.microseconds / 1000000.0
rate = nsubmitted / deltatime_f
@@ -216,3 +222,7 @@ try:
except KeyboardInterrupt:
p.terminate()
p.join()
+
+if errors:
+ print >> sys.stderr, errors, "errors encountered, exiting with error code"
+ sys.exit(1)