Exemple #1
0
    def test_get_group_counts(self):
        self.assertEqual(rpc_interface.get_num_groups(['job_name']), 2)

        counts = rpc_interface.get_group_counts(['job_name'])
        groups = counts['groups']
        self.assertEqual(len(groups), 2)
        group1, group2 = groups

        self.assertEqual(group1['group_count'], 2)
        self.assertEqual(group1['job_name'], 'myjob1')
        self.assertEqual(group2['group_count'], 1)
        self.assertEqual(group2['job_name'], 'myjob2')

        extra = {'extra': 'kernel_hash'}
        counts = rpc_interface.get_group_counts(['job_name'],
                                                header_groups=[('job_name',)],
                                                extra_select_fields=extra)
        groups = counts['groups']
        self.assertEqual(len(groups), 2)
        group1, group2 = groups

        self.assertEqual(group1['group_count'], 2)
        self.assertEqual(group1['header_indices'], [0])
        self.assertEqual(group1['extra'], 'mykernel1')
        self.assertEqual(group2['group_count'], 1)
        self.assertEqual(group2['header_indices'], [1])
        self.assertEqual(group2['extra'], 'mykernel2')
    def test_get_group_counts(self):
        self.assertEquals(rpc_interface.get_num_groups(['job_name']), 2)

        counts = rpc_interface.get_group_counts(['job_name'])
        groups = counts['groups']
        self.assertEquals(len(groups), 2)
        group1, group2 = groups

        self.assertEquals(group1['group_count'], 2)
        self.assertEquals(group1['job_name'], 'myjob1')
        self.assertEquals(group2['group_count'], 1)
        self.assertEquals(group2['job_name'], 'myjob2')

        extra = {'extra': 'kernel_hash'}
        counts = rpc_interface.get_group_counts(['job_name'],
                                                header_groups=[('job_name', )],
                                                extra_select_fields=extra)
        groups = counts['groups']
        self.assertEquals(len(groups), 2)
        group1, group2 = groups

        self.assertEquals(group1['group_count'], 2)
        self.assertEquals(group1['header_indices'], [0])
        self.assertEquals(group1['extra'], 'mykernel1')
        self.assertEquals(group2['group_count'], 1)
        self.assertEquals(group2['header_indices'], [1])
        self.assertEquals(group2['extra'], 'mykernel2')
Exemple #3
0
 def test_quoting_fields(self):
     # ensure fields with special characters are properly quoted throughout
     rpc_interface.add_test_label('hyphen-label')
     rpc_interface.get_group_counts(
         ['test_attribute_hyphen-attr', 'test_label_hyphen-label',
          'machine_label_hyphen-label',
          'iteration_result_hyphen-result'],
         test_attribute_fields=['hyphen-attr'],
         test_label_fields=['hyphen-label'],
         machine_label_fields=['hyphen-label'],
         iteration_result_fields=['hyphen-result'])
 def test_quoting_fields(self):
     # ensure fields with special characters are properly quoted throughout
     rpc_interface.add_test_label('hyphen-label')
     rpc_interface.get_group_counts(
             ['test_attribute_hyphen-attr', 'test_label_hyphen-label',
              'machine_label_hyphen-label',
              'iteration_result_hyphen-result'],
             test_attribute_fields=['hyphen-attr'],
             test_label_fields=['hyphen-label'],
             machine_label_fields=['hyphen-label'],
             iteration_result_fields=['hyphen-result'])
Exemple #5
0
    def test_grouping_with_machine_label_fields(self):
        self._setup_machine_labels()

        counts = rpc_interface.get_group_counts(['machine_label_label1'],
                                                machine_label_fields=['label1'])
        groups = counts['groups']
        self.assertEqual(len(groups), 2)
        self.assertEqual(groups[0]['machine_label_label1'], None)
        self.assertEqual(groups[0]['group_count'], 2)
        self.assertEqual(groups[1]['machine_label_label1'], 'label1')
        self.assertEqual(groups[1]['group_count'], 1)
    def test_grouping_with_machine_label_fields(self):
        self._setup_machine_labels()

        counts = rpc_interface.get_group_counts(
            ['machine_label_label1'], machine_label_fields=['label1'])
        groups = counts['groups']
        self.assertEquals(len(groups), 2)
        self.assertEquals(groups[0]['machine_label_label1'], None)
        self.assertEquals(groups[0]['group_count'], 2)
        self.assertEquals(groups[1]['machine_label_label1'], 'label1')
        self.assertEquals(groups[1]['group_count'], 1)
Exemple #7
0
    def test_grouping_on_test_label_fields(self):
        num_groups = rpc_interface.get_num_groups(
            ['test_label_testlabel2'], test_label_fields=['testlabel2'])
        self.assertEqual(num_groups, 2)

        counts = rpc_interface.get_group_counts(
            ['test_label_testlabel2'], test_label_fields=['testlabel2'])
        groups = counts['groups']
        self.assertEqual(len(groups), 2)
        self.assertEqual(groups[0]['test_label_testlabel2'], None)
        self.assertEqual(groups[0]['group_count'], 2)
        self.assertEqual(groups[1]['test_label_testlabel2'], 'testlabel2')
        self.assertEqual(groups[1]['group_count'], 1)
Exemple #8
0
    def test_grouping_with_test_attribute_fields(self):
        num_groups = rpc_interface.get_num_groups(
            ['test_attribute_myattr'], test_attribute_fields=['myattr'])
        self.assertEqual(num_groups, 2)

        counts = rpc_interface.get_group_counts(
            ['test_attribute_myattr'], test_attribute_fields=['myattr'])
        groups = counts['groups']
        self.assertEqual(len(groups), num_groups)
        self.assertEqual(groups[0]['test_attribute_myattr'], None)
        self.assertEqual(groups[0]['group_count'], 2)
        self.assertEqual(groups[1]['test_attribute_myattr'], 'myval')
        self.assertEqual(groups[1]['group_count'], 1)
    def test_grouping_with_iteration_result_fields(self):
        num_groups = rpc_interface.get_num_groups(
            ['iteration_result_iresult'], iteration_result_fields=['iresult'])
        self.assertEquals(num_groups, 2)

        counts = rpc_interface.get_group_counts(
            ['iteration_result_iresult'], iteration_result_fields=['iresult'])
        groups = counts['groups']
        self.assertEquals(len(groups), 2)
        self.assertEquals(groups[0]['iteration_result_iresult'], 1)
        self.assertEquals(groups[0]['group_count'], 1)
        self.assertEquals(groups[1]['iteration_result_iresult'], 3)
        self.assertEquals(groups[1]['group_count'], 1)
    def test_grouping_on_test_label_fields(self):
        num_groups = rpc_interface.get_num_groups(
            ['test_label_testlabel2'], test_label_fields=['testlabel2'])
        self.assertEquals(num_groups, 2)

        counts = rpc_interface.get_group_counts(
            ['test_label_testlabel2'], test_label_fields=['testlabel2'])
        groups = counts['groups']
        self.assertEquals(len(groups), 2)
        self.assertEquals(groups[0]['test_label_testlabel2'], None)
        self.assertEquals(groups[0]['group_count'], 2)
        self.assertEquals(groups[1]['test_label_testlabel2'], 'testlabel2')
        self.assertEquals(groups[1]['group_count'], 1)
    def test_grouping_with_test_attribute_fields(self):
        num_groups = rpc_interface.get_num_groups(
            ['test_attribute_myattr'], test_attribute_fields=['myattr'])
        self.assertEquals(num_groups, 2)

        counts = rpc_interface.get_group_counts(
            ['test_attribute_myattr'], test_attribute_fields=['myattr'])
        groups = counts['groups']
        self.assertEquals(len(groups), num_groups)
        self.assertEquals(groups[0]['test_attribute_myattr'], None)
        self.assertEquals(groups[0]['group_count'], 2)
        self.assertEquals(groups[1]['test_attribute_myattr'], 'myval')
        self.assertEquals(groups[1]['group_count'], 1)
    def test_grouping_with_iteration_result_fields(self):
        num_groups = rpc_interface.get_num_groups(
            ['iteration_result_iresult'], iteration_result_fields=['iresult'])
        self.assertEquals(num_groups, 2)

        counts = rpc_interface.get_group_counts(
            ['iteration_result_iresult'], iteration_result_fields=['iresult'])
        groups = counts['groups']
        self.assertEquals(len(groups), 2)
        self.assertEquals(groups[0]['iteration_result_iresult'], 1)
        self.assertEquals(groups[0]['group_count'], 1)
        self.assertEquals(groups[1]['iteration_result_iresult'], 3)
        self.assertEquals(groups[1]['group_count'], 1)