Dont use json anymore for test array
authorvarac <varacanero@zeromail.org>
Tue, 18 Apr 2017 12:29:42 +0000 (14:29 +0200)
committervarac <varacanero@zeromail.org>
Tue, 18 Apr 2017 12:30:40 +0000 (14:30 +0200)
elastic/generate-config.py

index 31c8e3a..44cc083 100755 (executable)
@@ -1,34 +1,32 @@
 #!/usr/bin/env python3
 
-import json
 import pystache
 
 #print(pystache.render('Hi {{person}}!', {'person': 'Mom'}))
 
-tests_json = '{ "tests":[\
-    {"name": "test_encrypt_raw_10M"},\
-    {"name": "test_encrypt_raw_100k"},\
-    {"name": "test_encrypt_raw_10k"},\
-    {"name": "test_decrypt_raw_100k"},\
-    {"name": "test_decrypt_raw_10M"},\
-    {"name": "test_decrypt_raw_10k"},\
-    {"name": "test_decrypt_raw_1M"},\
-    {"name": "test_decrypt_raw_500k"},\
-    {"name": "test_encrypt_raw_1M"},\
-    {"name": "test_encrypt_raw_500k"},\
-    {"name": "test_initialization"},\
-    {"name": "test_async_create_1000_10k"},\
-    {"name": "test_async_create_100_100k"},\
-    {"name": "test_create_1000_10k"},\
-    {"name": "test_create_100_100k"},\
-    {"name": "test_create_20_500k"},\
-    {"name": "test_decrypt_doc_100k"},\
-    {"name": "test_decrypt_doc_10M"},\
-    {"name": "test_decrypt_doc_10k"},\
-    {"name": "test_decrypt_doc_1M"}\
-    ]}'
-
-tests = json.loads(tests_json)
+tests = [
+    "test_encrypt_raw_10M",
+    "test_encrypt_raw_100k",
+    "test_encrypt_raw_10k",
+    "test_decrypt_raw_100k",
+    "test_decrypt_raw_10M",
+    "test_decrypt_raw_10k",
+    "test_decrypt_raw_1M",
+    "test_decrypt_raw_500k",
+    "test_encrypt_raw_1M",
+    "test_encrypt_raw_500k",
+    "test_initialization",
+    "test_async_create_1000_10k",
+    "test_async_create_100_100k",
+    "test_create_1000_10k",
+    "test_create_100_100k",
+    "test_create_20_500k",
+    "test_decrypt_doc_100k",
+    "test_decrypt_doc_10M",
+    "test_decrypt_doc_10k",
+    "test_decrypt_doc_1M"
+    ]
+
 
 
 # Generate visualizations
@@ -37,8 +35,7 @@ def generate_visualizations():
     template = open(dir + 'template.mustache', 'r').read()
 
     # test_names = tests.
-    for test in tests['tests']:
-        test_name = test['name']
+    for test_name in tests:
         out_file = dir + test_name + '.json'
         print('Generating ' + out_file)
         context = {
@@ -61,14 +58,12 @@ def generate_dashboards():
 
     panels = '['
     count = 0
-    for test in tests['tests']:
-        test_name = test['name']
+    for test_name in tests:
         count += 1
         panels += '{\\"id\\":\\"' + test_name + '\\",\\"panelIndex\\":' + str(count) + ',\\"col\\":1,\\"row\\":' + str(count) + ',\\"size_x\\":6,\\"size_y\\":3,\\"type\\":\\"visualization\\"}, '
     panels = panels[:-2]
     panels += ']'
 
-    print(panels)
     panels_json = { 'panels_json': panels }
     rendered = pystache.render(template, panels_json)
     #print(rendered)