Don't require testgroup and testfailure id to be specified ahead of time
authorJonathan Griffin <jgriffin@mozilla.com>
Tue, 10 May 2011 11:23:23 -0700
changeset 21 23504c802bdf7307dbe1d363b7af38d9d23a1322
parent 20 63d1f3038009f9e28049b52ee295d8a81628c6fc
child 22 7f4b65dc2f00d3e638b15100df3f53ae9e552cac
push id22
push userjgriffin@mozilla.com
push dateTue, 10 May 2011 18:23:37 +0000
Don't require testgroup and testfailure id to be specified ahead of time
mozautoeslib/autolog.py
--- a/mozautoeslib/autolog.py
+++ b/mozautoeslib/autolog.py
@@ -69,18 +69,16 @@ class AutologProduct(object):
     self.productname = productname
 
 
 class AutologTestFailure(object):
 
   def __init__(self, test=None, logurl=None, testgroup_id=None,
                testsuite_id=None, id=None,
                duration=None, **kwargs):
-    assert(testgroup_id is not None)
-    assert(testsuite_id is not None)
     self.test = test
     self.logurl = logurl
     self.testgroup_id = testgroup_id
     self.testsuite_id = testsuite_id
     self.errors = []
     self.dirty = True
     self.id = id
     self.duration = duration
@@ -107,17 +105,16 @@ class AutologTestFailure(object):
 
     return testfailure
 
 class AutologTestSuite(object):
 
   def __init__(self, cmdline=None, testsuite=None, passed=0,
                failed=0, todo=0, elapsedtime=None, testgroup_id=None,
                id=None):
-    assert(testgroup_id is not None)
     self.testgroup_id = testgroup_id
     self.testfailures = []
     self.id = id
     self.cmdline = cmdline
     self.testsuite = testsuite
     self.passed = passed
     self.failed = failed
     self.todo = todo
@@ -335,27 +332,30 @@ class AutologTestGroup(object):
       if not self.id:
         self.id = testgroup_id
         json.update({ 'testgroup_id': self.id })
         self._add_doc(json, self.testgroup_doc_type, self.id)
       self.dirty = False
 
     for testsuite in self.testsuites:
       if testsuite.dirty:
+        testsuite.testgroup_id = self.id
         json = testsuite.json_encode()
         self.addCommonProperties(json)
         testsuite_id = self._add_doc(json, self.testsuite_doc_type, testsuite.id)
 
         if not testsuite.id:
           testsuite.id = testsuite_id
           json.update({ 'testsuite_id': testsuite.id })
           self._add_doc(json, self.testsuite_doc_type, testsuite.id)
 
         for testfailure in testsuite.testfailures:
           if testfailure.dirty:
+            testfailure.testgroup_id = self.id
+            testfailure.testsuite_id = testsuite.id
             json = testfailure.json_encode()
             self.addCommonProperties(json)
             testfailure_id = self._add_doc(json, self.testfailure_doc_type, testfailure.id)
             if not testfailure.id:
               testfailure.id = testfailure_id
             testfailure.dirty = False
 
         testsuite.dirty = False