From 5f24e3c41370b7e2438f1af72853f37c62baba10 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Sun, 3 Mar 2019 19:24:13 +0100 Subject: [PATCH] added some testenv utilities --- test/data/extract-cache-entries.py | 9 +++++++++ test/data/update-test-db.py | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/data/extract-cache-entries.py create mode 100644 test/data/update-test-db.py diff --git a/test/data/extract-cache-entries.py b/test/data/extract-cache-entries.py new file mode 100644 index 00000000..ee50cdd1 --- /dev/null +++ b/test/data/extract-cache-entries.py @@ -0,0 +1,9 @@ +import json + +with open('router-info.json') as f: + db = json.loads(f.read()) + +cache = dict([(k, db[k]) for k in db if k.startswith('classifier:')]) + +with open('cached-entries.json', 'w') as f: + f.write(json.dumps(cache)) diff --git a/test/data/update-test-db.py b/test/data/update-test-db.py new file mode 100644 index 00000000..e9a1532e --- /dev/null +++ b/test/data/update-test-db.py @@ -0,0 +1,16 @@ +import json +import os +import redis + + +r = redis.StrictRedis(host="test-dashboard02.geant.org") + +d = {} +for k in r.keys(): + print(k) + d[k.decode('utf-8')] = r.get(k).decode('utf-8') + +data_filename = os.path.join(os.path.dirname(__file__), "router-info.json") + +with open(data_filename, "w") as f: + f.write(json.dumps(d)) -- GitLab