def handle(self, *args, **options):
        ResultData.objects.all().delete()
        Benchmark.objects.all().delete()
        BenchmarkGroupSummary.objects.all().delete()

        errors = []

        for testjob in TestJob.objects.all():
            if testjob.data:
                try:
                    data = testjob.data.file.read()
                    tester = testjob.get_tester()
                    test_results = tester.parse_test_results(data)
                    testjob.results_loaded = False
                    store_testjob_data(testjob, test_results)
                    step('.')
                except IOError as ex:
                    step('F')
                    errors.append('%s FAILED (%s)' % (testjob.id,ex))

        finish()
        if errors:
            print('')
            print('Errors:')
            print('-------')
            print('')
            for error in errors:
                print(error)
Example #2
0
    def test_result_data_with_benchmark_group(self):
        result = G(Result, manifest=MANIFEST())
        testjob = N(TestJob, result=result, status='Complete')
        test_results = [
            {
                'benchmark_group':
                'foo',
                'benchmark_name':
                'bar',
                'subscore': [
                    {
                        'name': 'test1',
                        'measurement': 1
                    },
                    {
                        'name': 'test1',
                        'measurement': 2
                    },
                ]
            },
        ]

        store_testjob_data(testjob, test_results)
        self.assertEqual(BenchmarkGroup.objects.count(), 2)  # foo + /

        benchmark_group = BenchmarkGroup.objects.order_by('id').last()
        benchmark = Benchmark.objects.order_by('id').last()
        self.assertEqual(benchmark.group, benchmark_group)
Example #3
0
    def test_result_data(self):
        result = G(Result, manifest=MANIFEST())
        testjob = N(TestJob, result=result, status='Complete')
        test_results = [
            {
                'benchmark_name':
                'bar',
                'subscore': [
                    {
                        'name': 'test1',
                        'measurement': 1
                    },
                    {
                        'name': 'test1',
                        'measurement': 2
                    },
                ]
            },
        ]
        store_testjob_data(testjob, test_results)

        self.assertEqual(TestJob.objects.count(), 1)
        self.assertEqual(Benchmark.objects.count(), 1)
        self.assertEqual(ResultData.objects.count(), 1)

        result_data = ResultData.objects.order_by('id').last()
        self.assertEqual(result_data.values, [1, 2])
        self.assertEqual(result_data.benchmark.name, 'bar')
Example #4
0
 def __create_test_job__(self, result, env, data):
     environment, _ = benchmarks_models.Environment.objects.get_or_create(identifier=env)
     testjob = benchmarks_models.TestJob.objects.create(
         id='J' + str(result.build_id) + '_' + result.name + '_' + env,
         result=result,
         status='Complete',
         initialized=True,
         completed=True,
         data=data,
         testrunnerclass='ArtJenkinsTestResults',
         testrunnerurl=result.build_url,
         environment=environment,
         created_at=result.created_at,
     )
     testrunner = testjob.get_tester()
     json_data = testjob.data.read()
     test_results = testrunner.parse_test_results(json_data)
     tasks.store_testjob_data(testjob, test_results)
Example #5
0
    def test_result_data_with_benchmark_group(self):
        result = G(Result, manifest__manifest=MINIMAL_XML)
        testjob = N(TestJob, result=result, status='Complete')
        test_results = [
            {
                'benchmark_group': 'foo',
                'benchmark_name': 'bar',
                'subscore': [
                    { 'name': 'test1', 'measurement': 1 },
                    { 'name': 'test1', 'measurement': 2 },
                ]
            },
        ]


        store_testjob_data(testjob, test_results)
        self.assertEqual(BenchmarkGroup.objects.count(), 2)  # foo + /

        benchmark_group = BenchmarkGroup.objects.order_by('id').last()
        benchmark = Benchmark.objects.order_by('id').last()
        self.assertEqual(benchmark.group, benchmark_group)
Example #6
0
    def test_result_data(self):
        result = G(Result, manifest__manifest=MINIMAL_XML)
        testjob = N(TestJob, result=result, status='Complete')
        test_results = [
            {
                'benchmark_name': 'bar',
                'subscore': [
                    { 'name': 'test1', 'measurement': 1 },
                    { 'name': 'test1', 'measurement': 2 },
                ]
            },
        ]
        store_testjob_data(testjob, test_results)

        self.assertEqual(TestJob.objects.count(), 1)
        self.assertEqual(Benchmark.objects.count(), 1)
        self.assertEqual(ResultData.objects.count(), 1)

        result_data = ResultData.objects.order_by('id').last()
        self.assertEqual(result_data.values, [1,2])
        self.assertEqual(result_data.benchmark.name, 'bar')
Example #7
0
 def __create_test_job__(self, result, env, data):
     environment, _ = benchmarks_models.Environment.objects.get_or_create(
         identifier=env)
     spl = urlparse.urlsplit(result.build_url)
     runnerurl = "%s://%s/job/%s/%s/" % (spl.scheme, spl.netloc,
                                         result.name, result.build_number)
     testjob = benchmarks_models.TestJob.objects.create(
         id='J' + str(result.build_id) + '_' + result.name + '_' + env,
         result=result,
         status='Complete',
         initialized=True,
         completed=True,
         data=data,
         testrunnerclass='ArtJenkinsTestResults',
         testrunnerurl=runnerurl,
         environment=environment,
         created_at=result.created_at,
     )
     testrunner = testjob.get_tester()
     json_data = testjob.data.read()
     test_results = testrunner.parse_test_results(json_data)
     tasks.store_testjob_data(testjob, test_results)