Query test names from elasticsearch
authorvarac <varacanero@zeromail.org>
Tue, 18 Apr 2017 12:54:48 +0000 (14:54 +0200)
committervarac <varacanero@zeromail.org>
Tue, 18 Apr 2017 12:54:48 +0000 (14:54 +0200)
elastic/generate-config.py
elastic/query/test_names.json [new file with mode: 0644]

index 44cc083..abb8d7c 100755 (executable)
@@ -1,32 +1,10 @@
 #!/usr/bin/env python3
 
 import pystache
+import requests
+import json
 
-#print(pystache.render('Hi {{person}}!', {'person': 'Mom'}))
-
-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"
-    ]
-
+URL='https://moose.leap.se:9200'
 
 
 # Generate visualizations
@@ -75,5 +53,15 @@ def generate_dashboards():
 
 # Main
 
+# Get all test names
+with open('./query/test_names.json') as f:
+    response = requests.get(URL + '/_search', data=f)
+    buckets = response.json()['aggregations']['test_names']['buckets']
+
+tests = []
+for d in buckets:
+    name = d['key']
+    tests.append(name)
+
 generate_dashboards()
 generate_visualizations()
diff --git a/elastic/query/test_names.json b/elastic/query/test_names.json
new file mode 100644 (file)
index 0000000..08f57a3
--- /dev/null
@@ -0,0 +1,39 @@
+{
+  "size": 0,
+  "query": {
+    "bool": {
+      "must": [
+        {
+          "query_string": {
+            "analyze_wildcard": true,
+            "query": "commit_info.project:soledad AND commit_info.branch='master' AND machine_info.host='weasel'"
+          }
+        },
+        {
+          "range": {
+            "datetime": {
+              "gte": 1483225200000,
+              "lte": 1492518132409,
+              "format": "epoch_millis"
+            }
+          }
+        }
+      ],
+      "must_not": []
+    }
+  },
+  "_source": {
+    "excludes": []
+  },
+  "aggs": {
+    "test_names": {
+      "terms": {
+        "field": "name",
+        "size": 100,
+        "order": {
+          "_count": "desc"
+        }
+      }
+    }
+  }
+}