コード例 #1
0
 def test_get_past_benchmarks(self):
     doc, doc2, doc3, doc4 = self.make_benchmarks()
     bundle = Bundle(doc3)
     past_tests = list(bundle.get_past_tests())
     past_ben = bundle.get_past_benchmarks(
         provider_name='AWS', past_results=past_tests)
     self.assertEqual(past_ben, [1])
コード例 #2
0
 def test_generate_chart_data(self):
     doc, doc2, doc3, doc4 = self.make_benchmarks()
     bundle = Bundle(doc3)
     chart = bundle.generate_chart_data()
     expected = json.dumps(
         {
             "labels": ["33", "44"],
             "datasets": [
                 {
                     "borderColor": "#4B98D9",
                     "lineTension": 0.1,
                     "label": "AWS (2.00 avg  1.00 sd)",
                     "borderWidth": 2,
                     "backgroundColor": "#4B98D9",
                     "data": [1.0, 3.0],
                     "fill": False,
                 },
                 {
                     "borderColor": "#56CE65",
                     "lineTension": 0.1,
                     "label": "Azure (2.00 avg  0.00 sd)",
                     "borderWidth": 2,
                     "backgroundColor": "#56CE65",
                     "data": [2, None],
                     "fill": False,
                 }
             ],
             "title": "Terasort Benchmark Chart  (Units: secs  "
                      "Direction: asc)"
         })
     self.assertEqual(chart, expected)
コード例 #3
0
 def test_get_past_benchmarks(self):
     doc, doc2, doc3, doc4 = self.make_benchmarks()
     bundle = Bundle(doc3)
     past_tests = list(bundle.get_past_tests())
     past_ben = bundle.get_past_benchmarks(provider_name='AWS',
                                           past_results=past_tests)
     self.assertEqual(past_ben, [1, 2])
コード例 #4
0
ファイル: test_bundle.py プロジェクト: marcoceppi/cwr-status
 def test_generate_chart_data(self):
     doc, doc2, doc3, doc4 = self.make_benchmarks()
     bundle = Bundle(doc3)
     chart = bundle.generate_chart_data()
     expected = ('{"series": [{"data": [1, 2, 3], "name": "AWS"}], '
                 '"yaxis_title": "secs", "title": "terasort"}')
     print chart
     self.assertEqual(chart, expected)
コード例 #5
0
 def test_generate_chart_data(self):
     doc, doc2, doc3, doc4 = self.make_benchmarks()
     bundle = Bundle(doc3)
     chart = bundle.generate_chart_data()
     expected = ('{"series": [{"data": [1, 2, 3], "name": "AWS"}], '
                 '"yaxis_title": "secs", "title": "terasort"}')
     print chart
     self.assertEqual(chart, expected)
コード例 #6
0
 def test_result(self):
     doc = make_doc()
     bundle = Bundle(bundle=doc)
     results = self.make_results(1)
     doc['test'] = {'results': results}
     bundle.add_test_result(doc)
     test = bundle.test_result()
     self.assertEqual(test, doc['test'])
コード例 #7
0
 def test_get_past_test(self):
     doc = make_doc(count=1)
     update_data(self.ds, doc)
     doc2 = copy.deepcopy(doc)
     doc2['_id'] = 'foo'
     doc2['date'] = '2'
     update_data(self.ds, doc2)
     bundle = Bundle(bundle=doc2)
     past_test = list(bundle.get_past_tests())
     self.assertEqual(past_test, [doc])
コード例 #8
0
 def test_get_past_test(self):
     doc = make_doc(count=1)
     update_data(self.ds, doc)
     doc2 = copy.deepcopy(doc)
     doc2['_id'] = 'foo'
     doc2['date'] = '2'
     update_data(self.ds, doc2)
     bundle = Bundle(bundle=doc2)
     past_test = list(bundle.get_past_tests())
     self.assertEqual(past_test, [doc])
コード例 #9
0
 def test_get_dataset(self):
     provider_names = ['AWS', "GCE"]
     datasets = Bundle._create_initial_datasets(provider_names)
     dataset = Bundle._get_dataset(datasets, 'AWS')
     expected = {
         'borderColor': '#4B98D9',
         'lineTension': 0.1,
         'label': 'AWS',
         'borderWidth': 2,
         'backgroundColor': '#4B98D9',
         'data': [],
         'fill': False
     }
     self.assertEqual(dataset, expected)
コード例 #10
0
def bundle_view(key=None):
    if not key:
        return render_template('404.html', e='Bundle not found.'), 404
    ds = Datastore()
    cwr_result = ds.get_one({'_id': key})
    if not cwr_result:
        return render_template('404.html', e='Bundle not found.'), 404
    bundle = Bundle(cwr_result)
    svg_path = bundle.svg_path()
    bundle_name = bundle.name
    results = bundle.test_result()
    history = None
    chart_data = bundle.generate_chart_data()
    return render_template(
        'bundle.html', bundle_name=bundle_name, results=results,
        svg_path=svg_path, history=history, chart_data=chart_data)
コード例 #11
0
 def test_create_intial_datasets(self):
     provider_names = ['AWS', "GCE"]
     datasets = Bundle._create_initial_datasets(provider_names)
     expected = [
         {
             'borderColor': '#4B98D9',
             'lineTension': 0.1,
             'label': 'AWS',
             'borderWidth': 2,
             'backgroundColor': '#4B98D9',
             'data': [],
             'fill': False
         },
         {
             'borderColor': '#56CE65',
             'lineTension': 0.1,
             'label': 'GCE',
             'borderWidth': 2,
             'backgroundColor': '#56CE65',
             'data': [],
             'fill': False
          }]
     self.assertEqual(datasets, expected)
コード例 #12
0
ファイル: main.py プロジェクト: juju-solutions/cwr-status
def result_by_test_id(key=None):
    if not key:
        return render_template('404.html', e='Bundle not found.'), 404
    test_id = {}
    test_id['_id'] = key
    cwr_result = get_results_by_test_id(test_id)
    if not cwr_result:
        return render_template('404.html', e='Bundle not found.'), 404
    bundle = Bundle(cwr_result[0])
    for result in cwr_result:
        bundle.add_test_result(result)
    svg_path = bundle.svg_path()
    bundle_name = bundle.name
    results = bundle.test_result()
    history = None
    chart_data = bundle.generate_chart_data()
    return render_template(
        'bundle.html', bundle_name=bundle_name, results=results,
        svg_path=svg_path, history=history, chart_data=chart_data)
コード例 #13
0
ファイル: test_bundle.py プロジェクト: marcoceppi/cwr-status
 def test_result(self):
     doc = make_doc()
     doc['test'] = 'foo'
     bundle = Bundle(bundle=doc)
     test = bundle.test_result()
     self.assertEqual(test, doc['test'])
コード例 #14
0
 def test_svg_path(self):
     doc = make_doc()
     doc['svg_path'] = 'foo.svg'
     bundle = Bundle(bundle=doc)
     svg_path = bundle.svg_path()
     self.assertEqual(svg_path, 'http://data.vapour.ws/cwr/foo.svg')
コード例 #15
0
 def test_svg_path_none(self):
     doc = make_doc()
     bundle = Bundle(bundle=doc)
     svg_path = bundle.svg_path()
     self.assertEqual(svg_path, 'No Image')
コード例 #16
0
 def test_result(self):
     doc = make_doc()
     doc['test'] = 'foo'
     bundle = Bundle(bundle=doc)
     test = bundle.test_result()
     self.assertEqual(test, doc['test'])
コード例 #17
0
 def test_svg_path_none(self):
     doc = make_doc()
     bundle = Bundle(bundle=doc)
     svg_path = bundle.svg_path()
     self.assertEqual(svg_path, 'No Image')
コード例 #18
0
 def test_svg_path(self):
     doc = make_doc()
     doc['svg_path'] = 'foo.svg'
     bundle = Bundle(bundle=doc)
     svg_path = bundle.svg_path()
     self.assertEqual(svg_path, 'http://data.vapour.ws/cwr/foo.svg')