Verify generated visualizations are valid JSONs.
authordrebs <drebs@riseup.net>
Tue, 18 Apr 2017 14:57:12 +0000 (16:57 +0200)
committerdrebs <drebs@riseup.net>
Tue, 18 Apr 2017 14:57:12 +0000 (16:57 +0200)
elastic/generate-config.py

index abb8d7c..9d5358c 100755 (executable)
@@ -23,6 +23,13 @@ def generate_visualizations():
 
         rendered = pystache.render(template, context)
 
+        # verify we generated valid JSON visualizations
+        content = json.loads(rendered)
+        visState = content['visState']
+        searchSourceJSON = content['kibanaSavedObjectMeta']['searchSourceJSON']
+        assert json.loads(visState)
+        assert json.loads(searchSourceJSON)
+
         out = open(out_file, 'w')
         out.write(rendered)
         out.flush()