Misc fixes for weird issues...

This commit is contained in:
Alexandre Aubin 2019-05-14 17:00:37 +00:00
parent 7d43b3d4ad
commit 3052185415

View file

@ -88,7 +88,7 @@ class AppCIResult(db.Model):
commit = db.Column(db.String(64), nullable=True) commit = db.Column(db.String(64), nullable=True)
def __repr__(self): def __repr__(self):
return '<AppTestResults %s>' % self.date return '<AppCIResult %s>' % self.date
def init(): def init():
pass pass
@ -131,6 +131,10 @@ class AppCI():
cleaned_json = cleaned_json.replace("Binary", '"?"') cleaned_json = cleaned_json.replace("Binary", '"?"')
j = json.loads(cleaned_json) j = json.loads(cleaned_json)
for test_summary in j: for test_summary in j:
if test_summary["app"] is None:
print("No app to parse in test_summary ? : %s" % test_summary)
continue
if (test_summary["arch"], test_summary["branch"]) != (cibranch.arch, cibranch.branch): if (test_summary["arch"], test_summary["branch"]) != (cibranch.arch, cibranch.branch):
continue continue
@ -139,6 +143,9 @@ class AppCI():
test_results[test] = bool(int(result)) if result in [ "1", "0" ] else None test_results[test] = bool(int(result)) if result in [ "1", "0" ] else None
app = App.query.filter_by(name=test_summary["app"]).first() app = App.query.filter_by(name=test_summary["app"]).first()
if app is None:
print("Couldnt found corresponding app object for %s, skipping" % test_summary["app"])
continue
date = datetime.datetime.fromtimestamp(test_summary["timestamp"]) date = datetime.datetime.fromtimestamp(test_summary["timestamp"])
existing_test = AppCIResult.query \ existing_test = AppCIResult.query \
@ -146,7 +153,13 @@ class AppCI():
.filter_by(date = date) \ .filter_by(date = date) \
.first() .first()
if existing_test and existing_test.app is None:
print("Uh erasing old weird buggy record")
db.session.delete(existing_test)
existing_test = None
if not existing_test: if not existing_test:
print("New record for app %s" % str(app))
results = AppCIResult(app = app, results = AppCIResult(app = app,
branch = cibranch, branch = cibranch,
level = test_summary["level"], level = test_summary["level"],