diff options
author | Clark Laughlin <clark.laughlin@linaro.org> | 2015-05-29 08:03:42 -0400 |
---|---|---|
committer | Clark Laughlin <clark.laughlin@linaro.org> | 2015-05-29 08:03:42 -0400 |
commit | d53660d4233e476dcc142c4168b7143af61930b1 (patch) | |
tree | faebbe0547456373ca8f4a0ef02b972f445e3c66 | |
parent | 770a53049991589b49a4353d7d91c7f12fa77540 (diff) |
Instead of creating new unique Test nodes for every Run, reuse existing, matching Test nodes
and jsut create relationships to them from each Run. Instead of storing test duration and
status on the Test node, store it as a property of the relationship beween the test Run and
the Test
-rw-r--r-- | tempest-pull/app/neo4j.py | 28 | ||||
-rw-r--r-- | web-app/server.go | 18 | ||||
-rw-r--r-- | web-app/static/detail.html | 4 |
3 files changed, 27 insertions, 23 deletions
diff --git a/tempest-pull/app/neo4j.py b/tempest-pull/app/neo4j.py index fc9156c..881e84d 100644 --- a/tempest-pull/app/neo4j.py +++ b/tempest-pull/app/neo4j.py @@ -24,6 +24,7 @@ class Neo4JDatabase(object): os_name = "%s/%s" % (os_distro, os_version) OS_node = graph.find_one("OS", "name", os_name) if not OS_node: + print "creating new OS node: %s" % os_name OS_node = Node("OS", name=os_name, distro=os_distro, version=os_version) graph.create(OS_node) @@ -32,6 +33,7 @@ class Neo4JDatabase(object): device = bundle.metadata["lava_testdef_metadata"]["devices"] Device_node = graph.find_one("Device", "name", device) if not Device_node: + print "creating new Device node: %s" % device Device_node = Node("Device", name=device) graph.create(Device_node) @@ -40,6 +42,7 @@ class Neo4JDatabase(object): devstack_branch = bundle.metadata["lava_job_attributes"]["devstack-branch"] Branch_node = graph.find_one("Branch", "name", devstack_branch) if not Branch_node: + print "creating new Branch node: %s" % devstack_branch Branch_node = Node("Branch", name=devstack_branch) graph.create(Branch_node) @@ -65,22 +68,23 @@ class Neo4JDatabase(object): Device_relationship = Relationship(TempestRun_node, "ON", Device_node) graph.create(TempestRun_node, OS_relationship, Branch_relationship, Device_relationship) - # create all of the tests and relate them back to the tempest node + # find the necessary test nodes (or create missing ones) and relate them back + # to the tempest node for test_set in [bundle.failing_tests, bundle.passing_tests, bundle.skipped_tests]: if test_set: print "adding tests" for test in test_set: - Test_node = Node("Test", test["status"], \ - name=test["name"], \ - full_name=test["fullname"], \ - status=test["status"], \ - time=test["time"], \ - test_class=test["class"], \ - test_category=test["category"]) - if test["status"] == "skip": - Test_node.properties["reason"] = test["reason"] + Test_node = graph.find_one("Test", "full_name", test["fullname"]) + if not Test_node: + print "creating new Test node: %s" % test["fullname"] + Test_node = Node("Test", \ + name=test["name"], \ + full_name=test["fullname"], \ + test_class=test["class"], \ + test_category=test["category"]) Test_relationship = Relationship(TempestRun_node, \ - "HAS_TEST", Test_node, status=test["status"]) + "HAS_TEST", Test_node, status=test["status"], time=test["time"]) + if test["status"] == "skip": + Test_relationship.properties["reason"] = test["reason"] graph.create(Test_node, Test_relationship) - diff --git a/web-app/server.go b/web-app/server.go index 4b72ba6..e577e0b 100644 --- a/web-app/server.go +++ b/web-app/server.go @@ -452,15 +452,15 @@ func Results_Tempest_Job_Failures(w http.ResponseWriter, r *http.Request) { Test_Name string `json:"t.name"` Test_Category string `json:"t.test_category"` Test_FullName string `json:"t.full_name"` - Test_Status string `json:"t.status"` + Test_Status string `json:"r.status"` Test_Class string `json:"t.test_class"` - Duration string `json:"t.time"` + Duration string `json:"r.time"` }{} cq := neoism.CypherQuery{ - Statement: `MATCH (n:Tempest:Run)-[:HAS_TEST {status:"fail"}]-(t:Test) + Statement: `MATCH (n:Tempest:Run)-[r:HAS_TEST {status:"fail"}]-(t:Test) WHERE n.lava_job = {job} - RETURN t.name, t.status, t.time, t.full_name, t.test_category, t.test_class, t.reason`, + RETURN t.name, r.status, r.time, t.full_name, t.test_category, t.test_class`, Parameters: neoism.Props{"job" : job}, Result: &res, } @@ -495,16 +495,16 @@ func Results_Tempest_Job_Skipped(w http.ResponseWriter, r *http.Request) { Test_Name string `json:"t.name"` Test_Category string `json:"t.test_category"` Test_FullName string `json:"t.full_name"` - Test_Status string `json:"t.status"` + Test_Status string `json:"r.status"` Test_Class string `json:"t.test_class"` - Duration string `json:"t.time"` - Reason string `json:"t.reason"` + Duration string `json:"r.time"` + Reason string `json:"r.reason"` }{} cq := neoism.CypherQuery{ - Statement: `MATCH (n:Tempest:Run)-[:HAS_TEST {status:"skip"}]-(t:Test) + Statement: `MATCH (n:Tempest:Run)-[r:HAS_TEST {status:"skip"}]-(t:Test) WHERE n.lava_job = {job} - RETURN t.name, t.status, t.time, t.full_name, t.test_category, t.test_class, t.reason`, + RETURN t.name, r.status, r.time, t.full_name, t.test_category, t.test_class, r.reason`, Parameters: neoism.Props{"job" : job}, Result: &res, } diff --git a/web-app/static/detail.html b/web-app/static/detail.html index 456e666..f5d93ed 100644 --- a/web-app/static/detail.html +++ b/web-app/static/detail.html @@ -66,7 +66,7 @@ $(function() { }, { "title" : "Test Category", "data" : "t\\.test_category" }, { "title" : "Test Name", "data" : "t\\.name" }, - { "title" : "Duration", "data" : "t\\.time" } + { "title" : "Duration", "data" : "r\\.time" } ], "order": [[2, 'asc']] }); @@ -93,7 +93,7 @@ $(function() { "columns": [ { "title" : "Test Category", "data" : "t\\.test_category" }, { "title" : "Test Name", "data" : "t\\.name" }, - { "title" : "Reason", "data" : "t\\.reason" } + { "title" : "Reason", "data" : "r\\.reason" } ], "order": [[1, 'asc']] }); |