示例#1
0
    def test_simple(self):
        self._stage(
            TWO_COMPLETED_SHARDS, {
                '0/output.json': {
                    'result0': ['bar', 'baz'],
                },
                '1/output.json': {
                    'result1': {
                        'foo': 'bar'
                    }
                }
            })

        output_json_file = os.path.join(self.temp_dir, 'output.json')
        exit_code = standard_isolated_script_merge.StandardIsolatedScriptMerge(
            output_json_file, self.summary, self.test_files)

        self.assertEquals(0, exit_code)
        self.assertEquals([
            [{
                'result0': [
                    'bar',
                    'baz',
                ],
            }, {
                'result1': {
                    'foo': 'bar',
                },
            }],
        ], self.merge_test_results_args)
示例#2
0
    def test_simple(self):

        results = [{
            'result0': ['bar', 'baz'],
        }, {
            'result1': {
                'foo': 'bar'
            }
        }]
        json_files = [
            os.path.join(self.temp_dir, 'input0.json'),
            os.path.join(self.temp_dir, 'input1.json')
        ]

        for result, json_file in itertools.izip(results, json_files):
            with open(json_file, 'w') as f:
                json.dump(result, f)

        output_json_file = os.path.join(self.temp_dir, 'output.json')
        exit_code = standard_isolated_script_merge.StandardIsolatedScriptMerge(
            output_json_file, json_files)

        self.assertEquals(0, exit_code)
        self.assertEquals([
            [{
                'result0': [
                    'bar',
                    'baz',
                ],
            }, {
                'result1': {
                    'foo': 'bar',
                },
            }],
        ], self.merge_test_results_args)
示例#3
0
    def test_no_jsons(self):
        json_files = []
        output_json_file = os.path.join(self.temp_dir, 'output.json')
        exit_code = standard_isolated_script_merge.StandardIsolatedScriptMerge(
            output_json_file, json_files)

        self.assertEquals(0, exit_code)
        self.assertEquals([[]], self.merge_test_results_args)
示例#4
0
def main(raw_args):

    parser = merge_api.ArgumentParser()
    args = parser.parse_args(raw_args)

    # TODO(jmadill): Merge QPA files into one. http://anglebug.com/5236

    return standard_isolated_script_merge.StandardIsolatedScriptMerge(
        args.output_json, args.summary_json, args.jsons_to_merge)
示例#5
0
    def test_missing_shard(self):
        self._stage(TWO_COMPLETED_SHARDS, {
            '0/output.json': {
                'successes': ['fizz', 'baz'],
            },
        })
        output_json_file = os.path.join(self.temp_dir, 'output.json')
        standard_isolated_script_merge.StandardIsolatedScriptMerge(
            output_json_file, self.summary, self.test_files)

        with open(output_json_file, 'r') as f:
            results = json.load(f)
            self.assertEquals(results['successes'], ['fizz', 'baz'])
            self.assertEquals(results['failures'], [])
            self.assertTrue(results['valid'])
            self.assertEquals(results['global_tags'], ['UNRELIABLE_RESULTS'])
            self.assertEquals(results['missing_shards'], [1])
示例#6
0
    def test_success_and_failure(self):
        self._stage(
            TWO_COMPLETED_SHARDS, {
                '0/output.json': {
                    'successes': ['fizz', 'baz'],
                },
                '1/output.json': {
                    'successes': ['buzz', 'bar'],
                    'failures': ['failing_test_one']
                }
            })

        output_json_file = os.path.join(self.temp_dir, 'output.json')
        standard_isolated_script_merge.StandardIsolatedScriptMerge(
            output_json_file, self.summary, self.test_files)

        with open(output_json_file, 'r') as f:
            results = json.load(f)
            self.assertEquals(results['successes'],
                              ['fizz', 'baz', 'buzz', 'bar'])
            self.assertEquals(results['failures'], ['failing_test_one'])
            self.assertTrue(results['valid'])