Skip to content
Browse files

Merge pull request #80 from mozilla/stage-fix-2

Stage fix 2
  • Loading branch information...
2 parents 1d78cfb + 1eb8605 commit 942b1b233db8a43e48e6bf504b6ff2414fe6b0a1 @jeads jeads committed Dec 17, 2012
View
3 datazilla/controller/admin/metrics/perftest_metrics.py
@@ -5,8 +5,7 @@
from datazilla.controller.admin.push_walker import extend_ref_data
SAFE_TESTS = set([
- 'tp5', 'tsvg', 'tsvg_opacity', 'tdhtml', 'tdhtml_nochrome',
- 'tsvgr'
+ 'tp5', 'tsvg', 'tsvg_opacity', 'tsvgr'
])
BRANCHES_NOT_ALLOWED = set([
View
7 datazilla/controller/admin/refdata/objectstore_refdata.py
@@ -23,10 +23,11 @@ def get_json_blob(project, id):
ptm = PerformanceTestRefDataModel(project)
blob = ptm.get_object_json_blob(id)
ptm.disconnect()
+
if blob:
- return blob[0]["json_blob"]
- else:
- return None
+ return blob[0]
+
+ return {}
def get_error_detail_count(project, startdate, enddate):
View
95 datazilla/model/base.py
@@ -126,9 +126,8 @@ def get_branch_list(self, branch=None):
# if a branch was specified, limit the list to only that branch
# TODO: make a separate select for this case, instead of all
branch_list = self.get_all_branches()
-
if branch:
- branch_list=[x for x in branch_list if x["name"] == branch]
+ branch_list=[x for x in branch_list if x["name"] == branch or x["alt_name"] == branch]
if len(branch_list) < 1:
self.println("Branch not found: {0}".format(branch))
return
@@ -137,14 +136,16 @@ def get_branch_list(self, branch=None):
def get_branch_uri(self, branch=None):
+ data = []
+
if branch:
proc = 'hgmozilla.selects.get_branch_uri'
data = self.hg_ds.dhub.execute(
proc=proc,
debug_show=self.DEBUG,
- placeholders=[branch],
+ placeholders=[branch, branch],
return_type='tuple',
)
else:
@@ -258,7 +259,7 @@ def get_branch_pushlog_by_revision(
proc=push_id_proc,
debug_show=self.DEBUG,
return_type='tuple',
- placeholders=[revision, branch_name]
+ placeholders=[revision, branch_name, branch_name]
)
if not push_data:
@@ -289,6 +290,9 @@ def get_branch_pushlog_by_revision(
placeholders=[ push_id, after_boundary, branch_id ]
)
+ del push_data[0]['branch_id']
+ del push_data[0]['node']
+
#Combine all of the requested push data
pushlog = pushes_before_data + push_data + pushes_after_data
@@ -438,7 +442,7 @@ def get_node_from_revision(self, revision, branch):
proc=proc,
debug_show=self.DEBUG,
return_type='tuple',
- placeholders=[revision, branch]
+ placeholders=[revision, branch, branch]
)
node = {}
@@ -1147,6 +1151,8 @@ def store_test_data(self, json_data, error=None):
debug_show=self.DEBUG
)
+ return self._get_last_insert_id()
+
def retrieve_test_data(self, limit):
"""
@@ -1179,7 +1185,8 @@ def load_test_data(self, data):
machine_id = self._get_or_create_machine_id(data, os_id)
# Insert build and test_run data.
- build_id = self._set_build_data(data, product_id)
+ build_id = self._get_or_create_build_id(data, product_id)
+
test_run_id = self._set_test_run_data(
data,
test_id,
@@ -1442,37 +1449,6 @@ def _set_option_data(self, data, test_run_id):
'set_test_option_values', placeholders, executemany=True)
- def _set_build_data(self, data, product_id):
- """Inserts build data into the db and returns build ID."""
- machine = data['test_machine']
- build = data['test_build']
-
- self.sources["perftest"].dhub.execute(
- proc='perftest.inserts.set_build_data',
- placeholders=[
- product_id,
- build['id'],
- machine['platform'],
- build['revision'],
- # TODO: Need to get the build type into the json
- 'opt',
- # TODO: need to get the build date into the json
- utils.get_now_timestamp(),
- build['id']
- ],
- debug_show=self.DEBUG
- )
-
- # Get the build id
- id_iter = self.sources["perftest"].dhub.execute(
- proc='perftest.selects.get_build_id',
- placeholders=[build['id']],
- debug_show=self.DEBUG,
- return_type='iter')
-
- return id_iter.get_column_data('id')
-
-
def _set_test_run_data(self, data, test_id, build_id, machine_id):
"""Inserts testrun data into the db and returns test_run id."""
@@ -1521,6 +1497,51 @@ def _get_last_insert_id(self, source="perftest"):
).get_column_data('id')
+ def _get_or_create_build_id(self, data, product_id):
+ """Inserts build data into the db or if the build already exists
+ it returns the build id."""
+ machine = data['test_machine']
+ build = data['test_build']
+
+ build_type = 'opt'
+
+ placeholders=[
+ product_id,
+ build['id'],
+ machine['platform'],
+ build['revision'],
+ # TODO: Need to get the build type into the json
+ build_type,
+ # TODO: need to get the build date into the json
+ utils.get_now_timestamp(),
+
+ #These params confirm identity in a nested select
+ product_id,
+ build['id'],
+ machine['platform'],
+ build_type
+ ]
+
+ self.sources["perftest"].dhub.execute(
+ proc='perftest.inserts.set_build_data',
+ debug_show=self.DEBUG,
+ placeholders=placeholders
+ )
+
+ build_iter = self.sources["perftest"].dhub.execute(
+ proc='perftest.selects.get_build_data',
+ debug_show=self.DEBUG,
+ return_type='iter',
+ placeholders=[
+ product_id, build['id'], machine['platform'], build_type
+ ]
+ )
+
+ id = build_iter.get_column_data('id')
+
+ return id
+
+
def _get_or_create_machine_id(self, data, os_id):
"""
Given a TestData instance, returns the test id from the db.
View
34 datazilla/model/sql/hgmozilla.json
@@ -17,7 +17,10 @@
"host":"master_host"
},
"get_all_branches":{
- "sql":"SELECT id, name, uri FROM branches",
+ "sql":"SELECT b.id, b.name, bm.alt_name, b.uri
+ FROM branches AS b
+ LEFT JOIN branch_map AS bm
+ ON b.name = bm.name",
"host":"read_host"
},
"get_all_pushlogs":{
@@ -51,10 +54,12 @@
p.date,
c.node,
b.id AS 'branch_id',
- b.name
+ b.name,
+ bm.alt_name
FROM pushlogs AS p
LEFT JOIN changesets AS c ON p.id = c.pushlog_id
LEFT JOIN branches AS b ON p.branch_id = b.id
+ LEFT JOIN branch_map AS bm ON b.name = bm.name
WHERE REP0 AND ( p.date >= ? AND p.date <= ?)
ORDER BY b.name, p.date ASC",
"host":"master_host"
@@ -68,28 +73,33 @@
p.user,
c.node,
b.id AS 'branch_id',
- b.name
+ b.name AS 'branch_name'
FROM pushlogs AS p
LEFT JOIN changesets AS c ON p.id = c.pushlog_id
LEFT JOIN branches AS b ON p.branch_id = b.id
- WHERE INSTR(c.node, ?) AND b.name = ?",
+ LEFT JOIN branch_map AS bm ON b.name = bm.name
+ WHERE INSTR(c.node, ?) AND (b.name = ? OR bm.alt_name = ?)",
"host":"read_host"
},
"get_branch_uri":{
- "sql":"SELECT b.name, b.uri
+ "sql":"SELECT b.name, bm.alt_name, b.uri
FROM branches AS b
- WHERE b.name = ?",
+ LEFT JOIN branch_map AS bm
+ ON b.name = bm.name
+ WHERE b.name = ? OR bm.alt_name = ?",
"host":"read_host"
},
"get_all_branch_uris":{
- "sql":"SELECT b.name, b.uri
- FROM branches AS b",
+ "sql":"SELECT b.name, bm.alt_name, b.uri
+ FROM branches AS b
+ LEFT JOIN branch_map AS bm
+ ON b.name = bm.name",
"host":"read_host"
},
@@ -138,10 +148,12 @@
p.date,
c.node,
b.id AS 'branch_id',
- b.name
+ b.name,
+ bm.alt_name
FROM pushlogs AS p
LEFT JOIN changesets AS c ON p.id = c.pushlog_id
LEFT JOIN branches AS b ON p.branch_id = b.id
+ LEFT JOIN branch_map AS bm ON b.name = bm.name
WHERE REP0
ORDER BY b.name, p.date ASC",
"host":"master_host"
@@ -154,12 +166,14 @@
p.user,
b.id AS 'branch_id',
b.name,
+ bm.alt_name,
c.node,
c.desc
FROM pushlogs AS p
LEFT JOIN changesets AS c ON p.id = c.pushlog_id
LEFT JOIN branches AS b ON p.branch_id = b.id
- WHERE INSTR(node, ?) AND b.name = ?",
+ LEFT JOIN branch_map AS bm ON b.name = bm.name
+ WHERE INSTR(node, ?) AND (b.name = ? OR bm.alt_name = ?)",
"host":"master_host"
}
View
8 datazilla/model/sql/objectstore.json
@@ -58,7 +58,13 @@
"get_json_blob":{
- "sql":"SELECT json_blob, error_msg, error_flag FROM `objectstore` WHERE `id` = ?",
+ "sql":"SELECT json_blob,
+ error_msg,
+ error_flag,
+ processed_flag,
+ date_loaded,
+ test_run_id
+ FROM `objectstore` WHERE `id` = ?",
"host":"read_host"
},
View
35 datazilla/model/sql/perftest.json
@@ -209,9 +209,15 @@
SELECT ?, ?, ?, ?, ?, ?
FROM DUAL
WHERE NOT EXISTS (
- SELECT `test_build_id`
+ SELECT `product_id`,
+ `test_build_id`,
+ `processor`,
+ `build_type`
FROM `build`
- WHERE `test_build_id` = ?
+ WHERE `product_id` = ? AND
+ `test_build_id` = ? AND
+ `processor` = ? AND
+ `build_type` = ?
)",
"host":"master_host"
@@ -569,6 +575,23 @@
"host":"read_host"
},
+ "get_build_data":{
+
+ "sql":"SELECT `id`,
+ `product_id`,
+ `test_build_id`,
+ `processor`,
+ `revision`,
+ `build_type`,
+ `build_date`
+ FROM build
+ WHERE `product_id` = ? AND
+ `test_build_id` = ? AND
+ `processor` = ? AND
+ `build_type` = ?",
+
+ "host":"master_host"
+ },
"get_product_data":{
"sql":"SELECT `id`, `product`, `branch`, `version`, `default_product` FROM `product`",
@@ -638,14 +661,6 @@
"host":"read_host"
},
- "get_build_id":{
-
- "sql":"SELECT `id`
- FROM `build`
- WHERE `test_build_id` = ?",
-
- "host":"read_host"
- },
"get_test_id":{
"sql":"SELECT `id`
View
22 datazilla/model/sql/template_schema/schema_hgmozilla.sql.tmpl
@@ -45,6 +45,28 @@ INSERT INTO `branches` (`name`, `uri`) VALUES ('Firefox','mozilla-central'),('Tr
/*!40000 ALTER TABLE `branches` ENABLE KEYS */;
UNLOCK TABLES;
+DROP TABLE IF EXISTS `branch_map`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `branch_map` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(45) NOT NULL,
+ `alt_name` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `key_name` (`name`),
+ KEY `key_alt_name` (`alt_name`)
+) ENGINE={engine} DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `branches`
+--
+LOCK TABLES `branch_map` WRITE;
+/*!40000 ALTER TABLE `branch_map` DISABLE KEYS */;
+INSERT INTO branch_map (`name`, `alt_name`) VALUES ('Try', 'Try-Non-PGO'), ('Firefox', 'Firefox-Non-PGO'), ('Fx-Team', 'Fx-Team-Non-PGO'), ('Ionmonkey', 'Ionmonkey-Non-PGO'), ('Mozilla-Inbound', 'Mozilla-Inbound-Non-PGO'),('Profiling', 'Profiling-Non-PGO'),('Services-Central', 'Services-Central-Non-PGO');
+/*!40000 ALTER TABLE `branch_map` ENABLE KEYS */;
+UNLOCK TABLES;
+
--
-- Table structure for table `changesets`
--
View
2 datazilla/model/sql/template_schema/schema_perftest.sql.tmpl
@@ -104,7 +104,7 @@ CREATE TABLE `build` (
KEY `build_date_key` (`build_date`),
KEY `revision_key` (`revision`),
KEY `fk_build_product` (`product_id`),
- UNIQUE KEY `unique_build` (`test_build_id`),
+ UNIQUE KEY `unique_build` (`product_id`, `test_build_id`, `processor`, `build_type`),
CONSTRAINT `fk_build_product` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`)
) ENGINE={engine} DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
View
2 datazilla/webapp/apps/datazilla/management/commands/post_json.py
@@ -103,13 +103,15 @@ def handle(self, *args, **options):
path = '/%s/api/load_test' % (project)
uri = 'https://%s%s' % (host, path)
+
params = {
'oauth_version': "1.0",
'oauth_nonce': oauth.generate_nonce(),
'oauth_timestamp': int(time.time()),
'user': project,
'data': urllib.quote(json_data)
}
+
#There is no requirement for the token in two-legged
#OAuth but we still need the token object.
token = oauth.Token(key="", secret="")
View
12 datazilla/webapp/apps/datazilla/refdata/objectstore_views.py
@@ -1,4 +1,5 @@
import json
+import re
from django.http import HttpResponse
from datazilla.controller.admin.refdata import objectstore_refdata
from .view_utils import get_range, REQUIRE_DAYS_AGO, API_CONTENT_TYPE
@@ -37,8 +38,17 @@ def get_json_blob(request, project, id):
"""Return a count of all objectstore entries with error"""
blob = objectstore_refdata.get_json_blob(project, id)
+
if blob:
- return HttpResponse(blob, content_type=API_CONTENT_TYPE)
+
+ if not re.search('Malformed JSON', blob['error_msg'] or ""):
+ # If we don't have malformed json load it so we can return
+ # a single json data structure with all fields present including
+ # json_blob. Malformed json will be returned as an escaped string.
+ blob['json_blob'] = json.loads(blob['json_blob'])
+
+ return HttpResponse(json.dumps(blob), content_type=API_CONTENT_TYPE)
+
else:
return HttpResponse("Id not found: {0}".format(id), status=404)
View
10 datazilla/webapp/apps/datazilla/views.py
@@ -124,14 +124,22 @@ def set_test_data(request, project=""):
try:
dm = PerformanceTestModel(project)
- dm.store_test_data(unquoted_json_data, error)
+ id = dm.store_test_data(unquoted_json_data, error)
dm.disconnect()
except Exception as e:
status = 500
result = {"status": "Unknown error", "message": str(e)}
else:
+
+ location = "/{0}/refdata/objectstore/json_blob/{1}".format(
+ project, str(id)
+ )
+
+ result['url'] = request.build_absolute_uri(location)
+
if not error:
status = 200
+
return HttpResponse(json.dumps(result), mimetype=APP_JS, status=status)
View
258 datazilla/webapp/static/js/metric_summary/MetricGridComponent.js
@@ -30,9 +30,7 @@ var MetricGridComponent = new Class({
},
initializeGrid: function(ev, data){
-
- if(_.isEmpty(data)){
- }else{
+ if(!_.isEmpty(data)){
this.view.initializeGrid(data);
}
}
@@ -68,7 +66,9 @@ var MetricGridView = new Class({
this.gridValuesClassSel = '.su-grid-values';
this.tableContainerSel = '#su_table_container';
+ this.lockTableSel = '#su_lock_table';
this.gridContainerSel = '#su_grid_container';
+ this.gridBoundarySel = '#su_boundary';
this.gridScrollMultiplier = 1.5;
this.gridScrollContainer = '#su_grid_scroll_container';
@@ -103,14 +103,14 @@ var MetricGridView = new Class({
var columns, rows = [];
- if(data){
+ if(this.data){
columns = this.getAlphabeticalSortKeys(
- data.summary_by_platform
+ this.data.summary_by_platform
);
rows = this.getAlphabeticalSortKeys(
- data.summary_by_test
+ this.data.summary_by_test
);
$(this.testSuiteDashboardContainerSel).css(
@@ -120,47 +120,16 @@ var MetricGridView = new Class({
if( (columns.length === 1) && (rows.length === 1) ){
//If there's only one column and one row there's no need
//for the grid. Expand the table to 100% of the panel
- $(this.gridContainerSel).css('display', 'none');
- $(this.gridSel).css('display', 'none');
- $(this.gridScrollContainer).css('display', 'none');
- $(this.guidearrowClassSel).css('display', 'none');
-
- //Expand table
- MS_PAGE.testPagesComponent.view.expandTable();
-
- var initializeValue = "";
-
- if(data.tests[test] && data.tests[test][platform]){
- initializeValue = data.tests[ rows[0] ][ columns[0] ]['pass']['percent'];
- }
-
- var initializeCell = this.getValueCell(
- columns[0],
- rows[0],
- initializeValue
- );
-
- //Trigger initialize event for the one column/row
- this._triggerEvent(
- this.gridMouseoverEvent, initializeCell
- );
-
+ this._expandTable(this.data, rows[0], columns[0]);
return;
}
}
+ //Set the column headers
+ this._buildGridHeaders(columns);
var columnTitle, rowTitle = "";
- for(var i=0; i<columns.length; i++){
-
- columnTitle = columns[i];
- var columnCell = this.getColumnHeaderCell(columnTitle);
-
- $(this.gridColumnHeaderClassSel).append(columnCell);
-
- }
-
var cellWidth = parseInt(
$('.' + this.gridColumnHeaderClass).css('width')
);
@@ -171,6 +140,7 @@ var MetricGridView = new Class({
//Set width of container of individual cells
$(this.gridValuesClassSel).css('width', valueRowWidth);
+
//Set width of container of column labels
$(this.gridColumnHeaderClassSel).css('width', valueRowWidth);
@@ -180,70 +150,15 @@ var MetricGridView = new Class({
//The width of the scroll container needs to be set dynamically
//based on the width of all of the rows, row headers, and cell width
- $(this.gridScrollContainer).css(
- 'width', cellWidth + valueRowWidth + headerWidth
- );
+ var containerWidth = cellWidth + valueRowWidth + headerWidth;
- for(var r=0; r<rows.length; r++){
-
- rowTitle = rows[r];
- var rowCell = this.getRowHeaderCell(rowTitle);
- $(this.gridRowHeaderClassSel).append(rowCell);
-
- for(var c=0; c<columns.length; c++){
+ $(this.gridScrollContainer).css('width', containerWidth);
+ $(this.gridBoundarySel).css('width', containerWidth);
- var columnTitle = columns[c];
- var cell;
- if(data.tests[rowTitle][columnTitle]){
- var value = data.tests[rowTitle][columnTitle]['pass']['percent'];
- cell = this.getValueCell(columnTitle, rowTitle, value);
+ //Build the grid of cells
+ this._buildGrid(rows, columns, this.data);
- //This event is only fired once to load a table the
- //first time the page loads.
- if(this.triggerDefaultEvent){
-
- var platform = MS_PAGE.refData.platform;
- var test = MS_PAGE.refData.test;
- var initializeValue = "";
-
- if(data.tests[test] && data.tests[test][platform]){
- initializeValue = data.tests[test][platform]['pass']['percent'];
- }
-
- if(initializeValue){
- //URL has test/platform specified, initialize
- //table to requested data target
- var initializeCell = this.getValueCell(
- platform,
- test,
- initializeValue
- );
-
- this._triggerEvent(
- this.gridMouseoverEvent, initializeCell
- );
-
- //Lock the table to the data requested
- MS_PAGE.testPagesComponent.view.lockTable();
-
- }else {
- //No target table use first defined cell
- this._triggerEvent(
- this.gridMouseoverEvent, cell
- );
- }
-
- this.triggerDefaultEvent = false;
- }
-
- }else{
- cell = this.getValueCell("");
- }
-
- $(this.gridValuesClassSel).append(cell);
- }
- }
},
getColumnHeaderCell: function(columnTitle){
@@ -335,17 +250,140 @@ var MetricGridView = new Class({
}else if(event.type == 'click'){
- this._triggerEvent(
- this.gridClickEvent, cellEl
- );
+ var checked = $(this.lockTableSel).attr('checked');
+
+ if(checked){
+ //table is locked but user has clicked a cell, keep the
+ //lock on but change the table to correspnd to the selected
+ //cell
+ var eventData = this._getCellClickEventData(cellEl);
+ MS_PAGE.testPagesComponent.initializeTestPages(
+ this.gridClickEvent, eventData, true
+ );
+
+ } else {
+ this._triggerEvent(
+ this.gridClickEvent, cellEl
+ );
+ }
}
},
showNoDataMessage: function(){
$(this.gridSpinnerSel).css('display', 'none');
$(this.testSuiteDashboardContainerSel).css('display', 'none');
},
+ _expandTable: function(data, test, platform){
+
+ //Hide grid containers
+ $(this.gridContainerSel).css('display', 'none');
+ $(this.gridSel).css('display', 'none');
+ $(this.gridScrollContainer).css('display', 'none');
+ $(this.guidearrowClassSel).css('display', 'none');
+
+ //Expand table
+ MS_PAGE.testPagesComponent.view.expandTable();
+
+ //Set the table initialization value
+ var initializeValue = "";
+
+ if(data.tests[test] && data.tests[test][platform]){
+ initializeValue = data.tests[test][platform]['pass']['percent'];
+ }
+
+ var initializeCell = this.getValueCell(
+ platform, test, initializeValue
+ );
+
+ //Trigger initialize event for the one column/row
+ this._triggerEvent(
+ this.gridMouseoverEvent, initializeCell
+ );
+
+ },
+ _buildGridHeaders: function(columns){
+
+ for(var i=0; i<columns.length; i++){
+
+ columnTitle = columns[i];
+ var columnCell = this.getColumnHeaderCell(columnTitle);
+
+ $(this.gridColumnHeaderClassSel).append(columnCell);
+ }
+ },
+ _buildGrid: function(rows, columns, data){
+
+ for(var r=0; r<rows.length; r++){
+
+ rowTitle = rows[r];
+ var rowCell = this.getRowHeaderCell(rowTitle);
+ $(this.gridRowHeaderClassSel).append(rowCell);
+
+ for(var c=0; c<columns.length; c++){
+
+ var columnTitle = columns[c];
+ var cell;
+
+ if(data.tests[rowTitle][columnTitle]){
+ var value = data.tests[rowTitle][columnTitle]['pass']['percent'];
+ cell = this.getValueCell(columnTitle, rowTitle, value);
+
+ //This event is only fired once to load a table the
+ //first time the page loads.
+ if(this.triggerDefaultEvent){
+
+ var platform = MS_PAGE.refData.platform;
+ var test = MS_PAGE.refData.test;
+ var initializeValue = "";
+
+ if(data.tests[test] && data.tests[test][platform]){
+ initializeValue = data.tests[test][platform]['pass']['percent'];
+ }
+
+ if(initializeValue){
+ //URL has test/platform specified, initialize
+ //table to requested data target
+ var initializeCell = this.getValueCell(
+ platform,
+ test,
+ initializeValue
+ );
+
+ this._triggerEvent(
+ this.gridMouseoverEvent, initializeCell
+ );
+
+ //Lock the table to the data requested
+ MS_PAGE.testPagesComponent.view.lockTable();
+
+ }else {
+ //No target table use first defined cell
+ this._triggerEvent(
+ this.gridMouseoverEvent, cell
+ );
+ }
+
+ this.triggerDefaultEvent = false;
+ }
+
+ }else{
+ cell = this.getValueCell("");
+ }
+
+ $(this.gridValuesClassSel).append(cell);
+ }
+ }
+
+ },
_triggerEvent: function(eventType, cell){
+ var eventData = this._getCellClickEventData(cell);
+
+ $(this.eventContainerSel).trigger(
+ eventType, eventData
+ );
+ },
+ _getCellClickEventData: function(cell){
+
var titles = JSON.parse( $(cell).attr(this.dataTitlesAttr) );
var data = {};
@@ -358,19 +396,19 @@ var MetricGridView = new Class({
}
- if(!_.isEmpty(data)){
+ var eventData = {};
- var eventData = {
+ if(!_.isEmpty(data)){
+ eventData = {
'test':titles.row_title,
'platform':titles.column_title,
'platform_info':this.data.tests[titles.row_title][titles.column_title]['platform_info'],
'data':data
- };
-
- $(this.eventContainerSel).trigger(
- eventType, eventData
- );
+ }
}
+
+ return eventData;
+
},
_interpolateColor: function(pBegin, pEnd, pStep, pMax){
View
16 datazilla/webapp/static/js/metric_summary/TestPagesComponent.js
@@ -19,12 +19,9 @@ var TestPagesComponent = new Class({
this.model = new TestPagesModel('#TestPagesModel',{});
},
- initializeTestPages: function(ev, data){
-
- if(_.isEmpty(data)){
-
- }else{
- this.view.initializeTestPages(data);
+ initializeTestPages: function(ev, data, ignoreLock){
+ if(!_.isEmpty(data)){
+ this.view.initializeTestPages(ev, data, ignoreLock);
}
}
});
@@ -92,12 +89,13 @@ var TestPagesView = new Class({
);
},
- initializeTestPages: function(event, eventData){
+ initializeTestPages: function(event, eventData, ignoreLock){
var checked = $(this.lockTableSel).attr('checked');
- //User has locked the table
- if(checked){
+ //User has locked the table and caller has not specified
+ //ignore lock
+ if(checked && !ignoreLock){
return;
}
View
155 datazilla/webapp/static/js/metric_summary/TrendLineComponent.js
@@ -38,13 +38,17 @@ var TrendLineComponent = new Class({
this.tickDisplayDates = {};
+ this.trendLineAdapters = {
+ 'least_squares_fit':this.getLeastSquaresFit
+ };
+
//Holds all event data received. It's used for
//reloading all series data with updated pushes
//before and after values.
this.eventData = [];
- this.pushesBefore = 20;
- this.pushesAfter = 5;
+ this.pushesBefore = 25;
+ this.pushesAfter = 10;
//true indicates push retrieval in progress
//false indicates more pushes can be retrieved
@@ -72,7 +76,7 @@ var TrendLineComponent = new Class({
},
'yaxis': {
- 'autoscaleMargin':0.1
+ 'autoscaleMargin':0.3
},
'series': {
@@ -129,6 +133,10 @@ var TrendLineComponent = new Class({
'keyup', _.bind(this._handlePushAroundInput, this)
);
+ $(this.view.trendLineDisplaySel).bind(
+ 'change', _.bind(this.redrawTrendLine, this)
+ );
+
//Set the push counts in the HTML
this.view.setPushCounts(this.pushesBefore, this.pushesAfter);
@@ -138,10 +146,15 @@ var TrendLineComponent = new Class({
_.bind(this.clickTableCB, this)
);
+ //Initialize the push selection range to empty strings
+ this.view.setPushRange("", "", "");
+
},
clickTableCB: function(event, eventData){
+
this.simulatedTableCBClick = true;
$(eventData).click();
+
},
initializeTrend: function(event, eventData){
@@ -175,7 +188,6 @@ var TrendLineComponent = new Class({
var pushCounts = this.view.getPushCounts();
-
for(var i=0; i<this.trendLineOrder.length; i++){
var key = this.trendLineOrder[i];
@@ -197,12 +209,16 @@ var TrendLineComponent = new Class({
}
},
setGetPushState: function(){
+
this.getPushState = true;
this.view.setGetPushState();
+
},
unsetGetPushState: function(){
+
this.getPushState = false;
this.view.unsetGetPushState();
+
},
loadTrendData: function(data, response, eventData){
@@ -227,6 +243,9 @@ var TrendLineComponent = new Class({
chartData[this.failSeriesIndex] = failDataset;
chartData[this.noMetricsDataSeriesIndex] = noDataDataset;
+ var displayType = $(this.view.trendLineDisplaySel).val();
+ trendAdapter = this.trendLineAdapters[displayType];
+
/****
* This loop populates chartData for flot. Data types that need to
* be colored/treated differently (pass, fail, no data, trend data)
@@ -262,7 +281,10 @@ var TrendLineComponent = new Class({
var failDatumIndex = 0;
var noDataDatumIndex = 0;
+ var trendMeanValue = 0;
+
var metricsData = [];
+ var trendAdapterValues = [[], []];
for(var j=0; j<this.trendLines[key]['data'].length; j++){
@@ -290,10 +312,16 @@ var TrendLineComponent = new Class({
metricsData[0]['pages'][this.trendLines[key]['pagename'] ];
//Metrics data is available set trend datum
+ trendMeanValue = parseInt(pageData.trend_mean);
var trendDatumIndex = chartData[trendIndex].data.push(
- [ j, parseInt(pageData.trend_mean) ]
+ [ j, trendMeanValue ]
) - 1;
+ if(trendAdapter){
+ trendAdapterValues[0].push(j);
+ trendAdapterValues[1].push(trendMeanValue);
+ }
+
this.seriesIndexToKey[trendIndex][trendDatumIndex] = key;
if( pageData.test_evaluation === true ){
@@ -355,7 +383,7 @@ var TrendLineComponent = new Class({
//Set flot seriesIndex and dataIndex attributes
flotItem.seriesIndex = this.failSeriesIndex;
- flotItem.dataIndex =
+ flotItem.dataIndex =
this.trendLines[key].datapoint_plot_location.point_index;
}
@@ -370,7 +398,7 @@ var TrendLineComponent = new Class({
this.seriesIndexToKey[this.noMetricsDataSeriesIndex][noDataDatumIndex] = key;
}
- }
+ } //end data for loop
//Set the series_index for the datapoint plot location
if(targetRevisionType === 'pass'){
@@ -387,55 +415,82 @@ var TrendLineComponent = new Class({
//Store the rgb alpha for hover events
this.trendLines[key].rgb_alpha = rgbAlpha;
- }
+ //If a trend data adapter has been selected
+ //use it to process the trend data and set the chartData
+ //to display to the adapter's return value
+ if(trendAdapter){
+ var adaptedLine = trendAdapter(
+ trendAdapterValues[0], trendAdapterValues[1]
+ );
+
+ chartData[trendIndex].data = adaptedLine;
+ }
+ } //end trend line for loop
+
+ //Hide the per-push spinner
+ this.unsetGetPushState();
+
+ //Display the chart
+ this.view.displayDashboard();
//Initialize the plot with the chartData
this.plot = $.plot(
$(this.view.chartContainerSel),
chartData,
this.chartOptions);
+ //Set hover datum to the revision of interest.
+ //Tell hoverPlot to not highlight datum hovered
+ //by passing the boolean "true" parameter. There is
+ //an issue in flot that causes the first highlighted
+ //point to be off on the y-axis. This is a work around.
+ this._hoverPlot({}, {}, flotItem, true);
+
//Draw a circle around the target revisions that the
//page is loaded on to help the user find their push
//of interest
this.view.drawCircleAroundDataPoints(targetRevisions, this.plot);
- //Hide the per-push spinner
- this.unsetGetPushState();
- //Display the chart
- this.view.displayDashboard();
- //Set hover datum to revision of interest
- this._hoverPlot({}, {}, flotItem);
+
+ },
+ redrawTrendLine: function(){
+
+ this.loadTrendData([], {});
},
getFailDataset: function(){
+
return {
'data':[],
'points': { 'show': true },
'color': MS_PAGE.failColor
};
},
getPassDataset: function(){
+
return {
'data':[],
'points': { 'show': true },
'color': MS_PAGE.passColor
};
},
getNoDataDataset: function(){
+
return {
'data':[],
'points': { 'show': true },
'color': this.view.trendLineColor
};
},
getTrendLineDataset: function(){
+
return {
'data':[],
'lines': { 'show': true },
'color': this.view.trendLineColor
};
},
convertTimestampToDate: function(unixTimestamp, getHMS){
+
var dateObj = new Date(unixTimestamp * 1000);
var dateString = dateObj.getFullYear() + '-' +
this.padNumber((dateObj.getMonth() + 1), 10, '0') + '-' +
@@ -461,6 +516,7 @@ var TrendLineComponent = new Class({
return n;
},
formatLabel: function(label, series){
+
return this.tickDisplayDates[label] || "";
},
closeDataSeries: function(event){
@@ -494,6 +550,7 @@ var TrendLineComponent = new Class({
}
}else if(event.type === 'mouseout'){
+
var key = this._getKeyFromEventTarget(event.target);
if(key){
@@ -523,9 +580,49 @@ var TrendLineComponent = new Class({
}
//Redraw trend lines
- this.loadTrendData([], {});
+ this.redrawTrendLine();
+ },
+ getLeastSquaresFit: function(valuesX, valuesY){
+
+ var sumX = 0;
+ var sumY = 0;
+ var sumXY = 0;
+ var sumXX = 0;
+ var x = 0;
+ var y = 0;
+ var count = 0;
+
+ var totalValues = valuesX.length;
+ if(totalValues === 0){
+ return [];
+ }
+
+ for(var i=0; i < totalValues; i++){
+ x = valuesX[i];
+ y = valuesY[i];
+
+ sumX += x;
+ sumY += y;
+ sumXX += x*x;
+ sumXY += x*y;
+ }
+
+ //Calculate m and b for: y = m*x + b
+ var m = (totalValues*sumXY - sumX*sumY) / (totalValues*sumXX - sumX*sumX);
+ var b = (sumY/totalValues) - (m*sumX)/totalValues;
+
+ var lsfLine = [];
+
+ for(var i=0; i < totalValues; i++){
+ x = valuesX[i];
+ y = x*m + b;
+ lsfLine.push([x, y]);
+ }
+
+ return lsfLine;
},
_handlePushAroundInput: function(event){
+
if(event.keyCode === 13){
if(this.getPushState === false){
this.getPushes();
@@ -568,7 +665,7 @@ var TrendLineComponent = new Class({
this.view.setPushRange(rangeBegin, rangeEnd, url);
},
- _hoverPlot: function(event, pos, item){
+ _hoverPlot: function(event, pos, item, noHighlight){
if(item){
@@ -580,8 +677,11 @@ var TrendLineComponent = new Class({
}
//Highlight the datapoint that the datum info is initialized to
- this.plot.unhighlight();
- this.plot.highlight(item.seriesIndex, item.datapoint);
+ //ignore if caller specifies noHighlight
+ if(!noHighlight){
+ this.plot.unhighlight();
+ this.plot.highlight(item.seriesIndex, item.datapoint);
+ }
if(item.dataIndex === undefined){
//dataIndex must be defined to proceed
@@ -592,9 +692,9 @@ var TrendLineComponent = new Class({
if(key != this.hoverLegendKey){
var lastKey = this.hoverLegendKey || key;
- //User has hovered directly from a point on series a
- //to a point on series b, we need to set the point on
- //series a back to the appropriate background color
+ //User has hovered directly from a point on series "a"
+ //to a point on series "b", we need to set the point on
+ //series "a" back to the appropriate background color
if(this.trendLines[lastKey] != undefined){
this.view.unhighlightLegend(
this.trendLines[lastKey].rgb_alpha,
@@ -806,6 +906,7 @@ var TrendLineView = new Class({
this.pushesBeforeSel = '#su_pushes_before';
this.pushesAfterSel = '#su_pushes_after';
this.getPushSpinnerSel = '#su_get_pushes_spinner';
+ this.trendLineDisplaySel = '#su_trend_line_display';
this.pushRangeBeginSel = '#su_push_range_begin';
this.pushRangeEndSel = '#su_push_range_end';
@@ -845,16 +946,17 @@ var TrendLineView = new Class({
this.dashboardDisplayed = false;
-
- //Set the pushes around revision
+ //Set the pushes around revision text
$(this.pushesAroundRevisionSel).text(MS_PAGE.refData.revision);
},
displayDashboard: function(){
+
if(this.dashboardDisplayed === false){
$(this.pushlogSpinnerSel).css('display', 'none');
$(this.pushlogDashboardSel).css('display', 'block');
}
+
},
setGetPushState: function(){
@@ -868,8 +970,10 @@ var TrendLineView = new Class({
},
showNoDataMessage: function(){
+
$(this.pushlogSpinnerSel).css('display', 'none');
$(this.pushlogDashboardSel).css('display', 'none');
+
},
drawCircleAroundDataPoints: function(targetRevisions, plot){
@@ -1023,9 +1127,12 @@ var TrendLineView = new Class({
}
},
getSeriesId: function(key){
+
return this.legendIdPrefix + key;
+
},
highlightLegend: function(el){
+
if(el){
$(el).css('background-color', '#FFFFFF');
} else {
@@ -1052,6 +1159,7 @@ var TrendLineView = new Class({
return rgbAlpha;
},
closeDataSeries: function(key){
+
$('#' + this.legendIdPrefix + key).remove();
delete(this.displayedSeriesLabel[key]);
},
@@ -1069,6 +1177,7 @@ var TrendLineView = new Class({
},
getPushCounts: function(){
+
var counts = {};
counts.before = $(this.pushesBeforeSel).val();
counts.after = $(this.pushesAfterSel).val();
View
2 datazilla/webapp/static/js/metric_summary/metric-summary-min.js
1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
10 datazilla/webapp/templates/metrics.summary.html
@@ -133,16 +133,20 @@
<h2 style="margin-left:185px;">Revision Pushlog</h2>
<div style="margin-left:185px; margin-bottom:50px;">
- <div style="margin-top:5px;" class="css-left">Pushes around <span id="su_pushes_around_rev"></span>: before<input id="su_pushes_before" type="text" size="3" maxlength="3" style="margin-left:3px; margin-right:5px;"/>after:<input id="su_pushes_after" type="text" size="3" maxlength="3" style="margin-left:3px; margin-right:3px;"/></div><button id="su_get_pushes" style="margin-left:8px; margin-top:3px;" class="css-left">Get Pushes</button><div id="su_get_pushes_spinner" style="margin-left:3px; display:none;" class="su-small-spinner css-left"></div>
+ <select id="su_trend_line_display" size="1" style="margin-right:10px; margin-top:8px;" class="css-left">
+ <option value="least_squares_fit">Least Squares Fit</option>
+ <option value="no_fit">No Fit</option>
+ </select>
+ <div style="margin-top:5px;" class="css-left">Pushes before:<input id="su_pushes_before" type="text" size="3" maxlength="3" style="margin-left:3px; margin-right:5px;"/>after:<input id="su_pushes_after" type="text" size="3" maxlength="3" style="margin-left:3px; margin-right:6px;"/><span id="su_pushes_around_rev"></span></div><button id="su_get_pushes" style="margin-left:8px; margin-top:3px;" class="css-left">Get Pushes</button><div id="su_get_pushes_spinner" style="margin-left:3px; display:none;" class="su-small-spinner css-left"></div>
</div>
<div class="ui-helper-clearfix"></div>
<div id="su_graph_detail_container_1" class="ui-widget css-left" style="width:135px; overflow-y:auto; height:380px; display:block;"></div>
<div class="su-vertical-text">Mean (milliseconds)</div>
<div id="su_trendline_plot" style="margin-left:30px; margin-bottom:20px; height:350px; width:600px;" class="css-left"></div>
- <div style="width:250px; position:absolute; left:740px; top:900px; opacity:0.6;" class="ui-widget ui-corner-all arrow_box_up">
- <div style="margin-top:10px; margin-bottom:10px; margin-left:10px; margin-right:10px;">Tip: Select a row above to load a test page series. Mouse over data points to load push info below. Click a point to lock.</div>
+ <div style="width:235px; position:absolute; left:770px; top:900px; opacity:0.6;" class="ui-widget ui-corner-all arrow_box_up css-left">
+ <div style="margin:10px;">Tip: Select a row above to load a test page series. Mouse over data points to load push info below. Click a point to lock.</div>
</div>
<div style="overflow-y:auto; height: 380px; margin-left:3px; width:220px;" class="css-left">
<div id="su_datum_revision" style="width:187px; text-align:right;" class="ui-state-highlight ui-corner-all su-datum-info-panel css-right su-large-text"></div>
View
4 tests/conftest.py
@@ -207,7 +207,7 @@ def pytest_funcarg__plm(request):
request._pyfuncitem.session.pushlog_name,
out=sys.stdout, verbosity=2)
- request.addfinalizer(partial(truncate, plm, ["branches"]))
+ request.addfinalizer(partial(truncate, plm, ["branches", "branch_map"]))
return plm
@@ -245,5 +245,5 @@ def pytest_funcarg__plrdm(request):
plrdm = PushLogRefDataModel(
request._pyfuncitem.session.pushlog_name)
- request.addfinalizer(partial(truncate, plrdm, ["branches"]))
+ request.addfinalizer(partial(truncate, plrdm, ["branches", "branch_map"]))
return plrdm
View
4 tests/controller/refdata/test_objectstore_refdata.py
@@ -103,7 +103,9 @@ def test_get_json_blob(ptm):
result = objectstore_refdata.get_json_blob(ptm.project, 1)
- assert badblob == result
+ assert badblob == result['json_blob']
+ assert 'Y' == result['error_flag']
+ assert None == result['test_run_id']
def test_get_json_blob_bad_id(ptm):
View
43 tests/model/test_performance_test_model.py
@@ -265,16 +265,17 @@ def test_get_or_create_machine_id_no_name(ptm):
assert str(e.value) == "Missing data: ['test_machine']['name']."
-def test_set_build_data(ptm):
+def test_get_or_create_build_id(ptm):
"""Inserts data into the build table."""
data = TestData(perftest_data())
product_id = ptm._get_or_create_product_id(data)
- build_id = ptm._set_build_data(data, product_id)
+ build_id = ptm._get_or_create_build_id(data, product_id)
row_data = ptm.sources["perftest"].dhub.execute(
- proc="perftest_test.selects.build", placeholders=[build_id])[0]
+ proc="perftest_test.selects.build",
+ placeholders=[build_id])[0]
assert row_data["test_build_id"] == data["test_build"]["id"]
assert row_data["product_id"] == product_id
@@ -288,42 +289,42 @@ def test_set_existing_build_data(ptm):
product_id = ptm._get_or_create_product_id(data)
- first_build_id = ptm._set_build_data(data, product_id)
+ first_build_id = ptm._get_or_create_build_id(data, product_id)
# perform another insert so that last_insert_id changes
# second call to perftest_data() will have a new build ID
- ptm._set_build_data(TestData(perftest_data()), product_id)
+ ptm._get_or_create_build_id(TestData(perftest_data()), product_id)
- # using the original data, so should return first build id
- build_id = ptm._set_build_data(data, product_id)
+ # using the original data, so should return same build id
+ build_id = ptm._get_or_create_build_id(data, product_id)
assert build_id == first_build_id
-def test_set_build_data_no_test_machine(ptm):
+def test_get_or_create_build_id_no_test_machine(ptm):
"""Raises TestDataError if there is no 'test_machine' key in data."""
with pytest.raises(TestDataError) as e:
- ptm._set_build_data(
+ ptm._get_or_create_build_id(
TestData({"test_build": {"id": "12345", "revision": "deadbeef"}}),
None
)
assert str(e.value) == "Missing data: ['test_machine']."
-def test_set_build_data_no_test_build(ptm):
+def test_get_or_create_build_id_no_test_build(ptm):
"""Raises TestDataError if there is no 'test_build' key in data."""
with pytest.raises(TestDataError) as e:
- ptm._set_build_data(
+ ptm._get_or_create_build_id(
TestData({"test_machine": {"platform": "arm"}}), None)
assert str(e.value) == "Missing data: ['test_build']."
-def test_set_build_data_no_platform(ptm):
+def test_get_or_create_build_id_no_platform(ptm):
"""Raises TestDataError if 'test_machine' is missing 'platform' key."""
with pytest.raises(TestDataError) as e:
- ptm._set_build_data(
+ ptm._get_or_create_build_id(
TestData(
{
"test_build": {"id": "12345", "revision": "deadbeef"},
@@ -336,10 +337,10 @@ def test_set_build_data_no_platform(ptm):
assert str(e.value) == "Missing data: ['test_machine']['platform']."
-def test_set_build_data_no_build_id(ptm):
+def test_get_or_create_build_id_no_build_id(ptm):
"""Raises TestDataError if 'test_machine' is missing 'platform' key."""
with pytest.raises(TestDataError) as e:
- ptm._set_build_data(
+ ptm._get_or_create_build_id(
TestData(
{
"test_build": {"revision": "deadbeef"},
@@ -361,7 +362,7 @@ def test_set_test_run_data(ptm):
product_id = ptm._get_or_create_product_id(data)
machine_id = ptm._get_or_create_machine_id(data, os_id)
- build_id = ptm._set_build_data(data, product_id)
+ build_id = ptm._get_or_create_build_id(data, product_id)
test_run_id = ptm._set_test_run_data(data, test_id, build_id, machine_id)
@@ -396,7 +397,7 @@ def test_set_option_data(ptm):
product_id = ptm._get_or_create_product_id(data)
machine_id = ptm._get_or_create_machine_id(data, os_id)
- build_id = ptm._set_build_data(data, product_id)
+ build_id = ptm._get_or_create_build_id(data, product_id)
test_run_id = ptm._set_test_run_data(data, test_id, build_id, machine_id)
# Try to set the option data
@@ -428,7 +429,7 @@ def test_set_extension_data(ptm):
product_id = ptm._get_or_create_product_id(data)
machine_id = ptm._get_or_create_machine_id(data, os_id)
- build_id = ptm._set_build_data(data, product_id)
+ build_id = ptm._get_or_create_build_id(data, product_id)
test_run_id = ptm._set_test_run_data(data, test_id, build_id, machine_id)
@@ -463,7 +464,7 @@ def test_set_test_values(ptm):
product_id = ptm._get_or_create_product_id(data)
machine_id = ptm._get_or_create_machine_id(data, os_id)
- build_id = ptm._set_build_data(data, product_id)
+ build_id = ptm._get_or_create_build_id(data, product_id)
test_run_id = ptm._set_test_run_data(data, test_id, build_id, machine_id)
@@ -497,7 +498,7 @@ def test_set_test_aux_data(ptm):
product_id = ptm._get_or_create_product_id(data)
machine_id = ptm._get_or_create_machine_id(data, os_id)
- build_id = ptm._set_build_data(data, product_id)
+ build_id = ptm._get_or_create_build_id(data, product_id)
test_run_id = ptm._set_test_run_data(data, test_id, build_id, machine_id)
@@ -626,7 +627,7 @@ def test_get_test_reference_data(ptm):
product_id = ptm._get_or_create_product_id(data)
machine_id = ptm._get_or_create_machine_id(data, os_id)
- build_id = ptm._set_build_data(data, product_id)
+ build_id = ptm._get_or_create_build_id(data, product_id)
test_run_id = ptm._set_test_run_data(data, test_id, build_id, machine_id)
json_data = json.loads( ptm.get_test_reference_data('{0}-refdata'.format(ptm.project)) )
View
11 tests/model/test_pushlog_model.py
@@ -11,6 +11,11 @@ def get_branch_id(plm):
branch = plm.get_branch_list("Firefox")
return branch[0]["id"]
+def get_alt_name_branch_id(plm):
+ """Use the Firefox-Non-PGO branch to retrieve id"""
+ branch = plm.get_branch_list("Firefox-Non-PGO")
+ return branch[0]["id"]
+
def test_branches(plm):
"""
@@ -30,6 +35,12 @@ def test_single_branch(plm):
assert len(branches) == 1
+def test_single_alt_name_branch(plm):
+ """Test get_branch_list with an alt_name branch that exists."""
+ branches = plm.get_branch_list("Firefox-Non-PGO")
+
+ assert len(branches) == 1
+
def test_single_branch_not_found(plm):
"""Test the get_branch_list method with non-existent branch."""
View
12 tests/webapp/refdata/test_objectstore_views.py
@@ -141,15 +141,15 @@ def test_get_json_blob(ptm, client, monkeypatch):
rj = response.json
- assert rj["test_machine"] == exp_tm
+ assert rj['json_blob']['test_machine'] == exp_tm
# these ids can vary
- del(rj["test_build"]["id"])
+ del(rj['json_blob']['test_build']['id'])
- assert rj["test_build"] == exp_tb
- assert rj["testrun"] == exp_tr
- assert rj["results_aux"] == exp_ra
- assert rj["results"] == exp_res
+ assert rj['json_blob']['test_build'] == exp_tb
+ assert rj['json_blob']['testrun'] == exp_tr
+ assert rj['json_blob']['results_aux'] == exp_ra
+ assert rj['json_blob']['results'] == exp_res
def test_get_json_blob_bad_id(ptm, client, monkeypatch):
View
10 tests/webapp/refdata/test_pushlog_views.py
@@ -34,9 +34,6 @@ def mock_get_not_referenced(project, startdate, enddate, branches):
"branches": None,
}
- print response.json
- print exp
-
assert response.json == exp
@@ -102,6 +99,7 @@ def mock_plrdm():
response = client.get("/refdata/pushlog/db_size/")
- assert response.json == [
- {"size_mb": "0.13", "db_name": "{0}_hgmozilla_1".format(plrdm.project)},
- ]
+ for r in response.json:
+
+ assert r['size_mb'] > 0
+ assert r['db_name'] == "{0}_hgmozilla_1".format(plrdm.project)
View
4 tests/webapp/test_views.py
@@ -13,9 +13,7 @@ def test_happy(self, client, ptm):
proc="objectstore_test.selects.all")[0]
assert json.loads(row_data["json_blob"]) == {"test": "foo"}
- assert response.json == {
- u"size": 15, u"status": u"well-formed JSON stored"}
-
+ assert response.json['status'] == u"well-formed JSON stored"
def test_no_oauth(self, client):
"""Trying to set test data without OAuth creds results in an error."""

0 comments on commit 942b1b2

Please sign in to comment.
Something went wrong with that request. Please try again.