Ejemplo n.º 1
0
 def test_value_with_hidden_platform_and_tesst(self):
     webkit_trunk = Branch.create_if_possible('webkit-trunk',
                                              'WebKit trunk')
     some_platform = Platform.create_if_possible('some-platform',
                                                 'Some Platform')
     hidden_platform = Platform.create_if_possible('hidden-platform',
                                                   'Hidden Platform')
     hidden_platform.hidden = True
     hidden_platform.put()
     Test.update_or_insert('some-test', webkit_trunk, some_platform)
     Test.update_or_insert('some-test', webkit_trunk, hidden_platform)
     Test.update_or_insert('other-test', webkit_trunk, some_platform)
     Test.update_or_insert('other-test', webkit_trunk, hidden_platform)
     Test.update_or_insert('hidden-test', webkit_trunk, some_platform)
     Test.update_or_insert('hidden-test', webkit_trunk, hidden_platform)
     hidden_test = Test.get_by_key_name('hidden-test')
     hidden_test.hidden = True
     hidden_test.put()
     self.assertEqual(DashboardJSONGenerator().value()['platformToId'],
                      {'Some Platform': some_platform.id})
     self.assertEqual(
         DashboardJSONGenerator().value()['testToId'], {
             'some-test': Test.get_by_key_name('some-test').id,
             'other-test': Test.get_by_key_name('other-test').id
         })
Ejemplo n.º 2
0
    def test_value_single_platform(self):
        webkit_trunk = Branch.create_if_possible('webkit-trunk',
                                                 'WebKit trunk')
        some_platform = Platform.create_if_possible('some-platform',
                                                    'Some Platform')
        self.assertEqual(
            DashboardJSONGenerator().value(), {
                'defaultBranch': 'WebKit trunk',
                'branchToId': {
                    'WebKit trunk': webkit_trunk.id
                },
                'platformToId': {
                    'Some Platform': some_platform.id
                },
                'testToId': {},
            })

        Test.update_or_insert('some-test', webkit_trunk, some_platform)
        self.assertEqual(
            DashboardJSONGenerator().value(), {
                'defaultBranch': 'WebKit trunk',
                'branchToId': {
                    'WebKit trunk': webkit_trunk.id
                },
                'platformToId': {
                    'Some Platform': some_platform.id
                },
                'testToId': {
                    'some-test': Test.get_by_key_name('some-test').id
                },
            })
Ejemplo n.º 3
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        try:
            payload = json.loads(self.request.body)
            hide = payload['hide']
        except:
            self.response.out.write("Failed to parse the payload: %s" % self.request.body)
            return

        if 'platform' in payload:
            model = Platform.get_by_key_name(payload['platform'])
        elif 'test' in payload:
            model = Test.get_by_key_name(payload['test'])
        else:
            self.response.out.write('Not supported')
            return

        if not model:
            self.response.out.write('Could not find the model')
            return

        model.hidden = hide
        model.put()
        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
Ejemplo n.º 4
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        try:
            payload = json.loads(self.request.body)
            hide = payload['hide']
        except:
            self.response.out.write("Failed to parse the payload: %s" %
                                    self.request.body)
            return

        if 'platform' in payload:
            model = Platform.get_by_key_name(payload['platform'])
        elif 'test' in payload:
            model = Test.get_by_key_name(payload['test'])
        else:
            self.response.out.write('Not supported')
            return

        if not model:
            self.response.out.write('Could not find the model')
            return

        model.hidden = hide
        model.put()
        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
Ejemplo n.º 5
0
    def post(self, task):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        if task != 'run':
            try:
                payload = json.loads(self.request.body)
                merge = payload.get('merge', '')
                into = payload.get('into', '')
            except:
                self.response.out.write("Failed to parse the payload: %s" %
                                        self.request.body)
                return

            if merge == into or not Test.get_by_key_name(
                    merge) or not Test.get_by_key_name(into):
                self.response.out.write('Invalid test names')
                return

            taskqueue.add(url='/admin/merge-tests/run',
                          params={
                              'merge': merge,
                              'into': into
                          },
                          target='model-manipulator')
            self.response.out.write('OK')
            return

        merge = Test.get_by_key_name(self.request.get('merge'))
        into = Test.get_by_key_name(self.request.get('into'))

        branches_and_platforms_to_update = into.merge(merge)
        if branches_and_platforms_to_update == None:
            # FIXME: This message is invisible. Need to store this somewhere and let the admin page pull it.
            self.response.out.write(
                'Cannot merge %s into %s. There are conflicting results.' %
                (merge.name, into.name))
            return

        for branch_id, platform_id in branches_and_platforms_to_update:
            schedule_runs_update(into.id, branch_id, platform_id)

        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
Ejemplo n.º 6
0
 def test_value_with_hidden_platform_and_tesst(self):
     webkit_trunk = Branch.create_if_possible('webkit-trunk', 'WebKit trunk')
     some_platform = Platform.create_if_possible('some-platform', 'Some Platform')
     hidden_platform = Platform.create_if_possible('hidden-platform', 'Hidden Platform')
     hidden_platform.hidden = True
     hidden_platform.put()
     Test.update_or_insert('some-test', webkit_trunk, some_platform)
     Test.update_or_insert('some-test', webkit_trunk, hidden_platform)
     Test.update_or_insert('other-test', webkit_trunk, some_platform)
     Test.update_or_insert('other-test', webkit_trunk, hidden_platform)
     Test.update_or_insert('hidden-test', webkit_trunk, some_platform)
     Test.update_or_insert('hidden-test', webkit_trunk, hidden_platform)
     hidden_test = Test.get_by_key_name('hidden-test')
     hidden_test.hidden = True
     hidden_test.put()
     self.assertEqual(DashboardJSONGenerator().value()['platformToId'], {'Some Platform': some_platform.id})
     self.assertEqual(DashboardJSONGenerator().value()['testToId'],
         {'some-test': Test.get_by_key_name('some-test').id, 'other-test': Test.get_by_key_name('other-test').id})
Ejemplo n.º 7
0
 def execute(id):
     test = Test.get_by_key_name(testName)
     returnValue = None
     if not test:
         test = Test(id=id, name=testName, key_name=testName)
         returnValue = test
     if branch.key() not in test.branches:
         test.branches.append(branch.key())
     if platform.key() not in test.platforms:
         test.platforms.append(platform.key())
     test.put()
     return returnValue
Ejemplo n.º 8
0
 def test_value_two_platforms(self):
     webkit_trunk = Branch.create_if_possible('webkit-trunk', 'WebKit trunk')
     some_platform = Platform.create_if_possible('some-platform', 'Some Platform')
     other_platform = Platform.create_if_possible('other-platform', 'Other Platform')
     Test.update_or_insert('some-test', webkit_trunk, some_platform)
     Test.update_or_insert('some-test', webkit_trunk, other_platform)
     self.assertEqual(DashboardJSONGenerator().value(), {
         'defaultBranch': 'WebKit trunk',
         'branchToId': {'WebKit trunk': webkit_trunk.id},
         'platformToId': {'Some Platform': some_platform.id, 'Other Platform': other_platform.id},
         'testToId': {'some-test': Test.get_by_key_name('some-test').id},
     })
Ejemplo n.º 9
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8';

        merge = Test.get_by_key_name(self.request.get('merge'))
        into = Test.get_by_key_name(self.request.get('into'))
        if not merge or not into:
            self.response.out.write('Invalid test names')
            return

        mergedResults = TestResult.all()
        mergedResults.filter('name =', merge.name)
        for result in mergedResults:
            result.name = into.name
            result.put()

        # Just flush everyting since we rarely merge tests and we need to flush
        # dashboard, manifest, and all runs for this test here.
        memcache.flush_all()

        deleteModelWithNumericIdHolder(merge)

        self.response.out.write('OK')
Ejemplo n.º 10
0
    def post(self, task):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        if task != 'run':
            try:
                payload = json.loads(self.request.body)
                merge = payload.get('merge', '')
                into = payload.get('into', '')
            except:
                self.response.out.write("Failed to parse the payload: %s" % self.request.body)
                return

            if merge == into or not Test.get_by_key_name(merge) or not Test.get_by_key_name(into):
                self.response.out.write('Invalid test names')
                return

            taskqueue.add(url='/admin/merge-tests/run', params={'merge': merge, 'into': into}, target='model-manipulator')
            self.response.out.write('OK')
            return

        merge = Test.get_by_key_name(self.request.get('merge'))
        into = Test.get_by_key_name(self.request.get('into'))

        branches_and_platforms_to_update = into.merge(merge)
        if branches_and_platforms_to_update == None:
            # FIXME: This message is invisible. Need to store this somewhere and let the admin page pull it.
            self.response.out.write('Cannot merge %s into %s. There are conflicting results.' % (merge.name, into.name))
            return

        for branch_id, platform_id in branches_and_platforms_to_update:
            schedule_runs_update(into.id, branch_id, platform_id)

        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
Ejemplo n.º 11
0
    def _addTestIfNeeded(self, testName, branch, platform):

        def execute(id):
            test = Test.get_by_key_name(testName)
            returnValue = None
            if not test:
                test = Test(id=id, name=testName, key_name=testName)
                returnValue = test
            if branch.key() not in test.branches:
                test.branches.append(branch.key())
            if platform.key() not in test.platforms:
                test.platforms.append(platform.key())
            test.put()
            return returnValue
        return createInTransactionWithNumericIdHolder(execute) or Test.get_by_key_name(testName)
Ejemplo n.º 12
0
    def _add_test_if_needed(self, test_name, branch, platform):

        def execute(id):
            test = Test.get_by_key_name(test_name)
            returnValue = None
            if not test:
                test = Test(id=id, name=test_name, key_name=test_name)
                returnValue = test
            if branch.key() not in test.branches:
                test.branches.append(branch.key())
            if platform.key() not in test.platforms:
                test.platforms.append(platform.key())
            test.put()
            return returnValue
        return create_in_transaction_with_numeric_id_holder(execute) or Test.get_by_key_name(test_name)