Ejemplo n.º 1
0
    def test_patch_location_6(self):
        image_tag = 'Adobe-Consulting-Services-acs-aem-commons-358605962'
        manual_results = ['Partial', 'No', 'Partial']
        files_changed = ['bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/asset/AssetIngestor.java',
                         'bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/FileAssetIngestorTest.'
                         'java',
                         'bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/S3AssetIngestorTest.java']
        tag_language = 'java'
        build_error = {'AssertionError': 7}
        files = ['358605962-orig.log', '358617230-orig.log', 'cloc.csv', 'diff.txt']

        # check the diffs for CODE, BUILD, TEST
        conf_code, conf_build, conf_test = self.check_diff(files_changed)
        # get classification for this test
        testcase_results = self.classify_diff_location(conf_code, conf_build, conf_test)

        artifacts_folder = "artifacts/"
        for found_tag in listdir(artifacts_folder):
            if found_tag == image_tag:
                file_path = join(artifacts_folder, found_tag)
                failed_log = process_logs(file_path, files)
                error, build_lang = detect_lang(failed_log, quiet=1)
                error_dict, userdefined, confidence = process_error(build_lang.get('language', None), failed_log)
                break

        self.assertEqual(tag_language, build_lang['language'])
        self.assertEqual(build_error, error_dict)
        self.assertListEqual(manual_results, testcase_results)
Ejemplo n.º 2
0
    def test_patch_location_4(self):  # ImmobilienScout24-deadcode4j-108400124
        image_tag = 'ImmobilienScout24-deadcode4j-108400124'
        manual_results = ['No', 'No', 'Yes']
        files_changed = ['src/test/java/de/is24/deadcode4j/plugin/IT_PuttingItAllTogether.java']
        tag_language = 'java'
        build_error = {'ArgumentsAreDifferent': 1}
        files = ['108400124-orig.log', '108470682-orig.log', 'cloc.csv', 'diff.txt']

        # check the diffs for CODE, BUILD, TEST
        conf_code, conf_build, conf_test = self.check_diff(files_changed)
        # get classification for this test
        testcase_results = self.classify_diff_location(conf_code, conf_build, conf_test)

        artifacts_folder = "artifacts/"
        for found_tag in listdir(artifacts_folder):
            if found_tag == image_tag:
                file_path = join(artifacts_folder, found_tag)
                failed_log = process_logs(file_path, files)
                error, build_lang = detect_lang(failed_log, quiet=1)
                error_dict, userdefined, confidence = process_error(build_lang.get('language', None), failed_log)
                break

        self.assertEqual(tag_language, build_lang['language'])
        self.assertEqual(build_error, error_dict)
        self.assertListEqual(manual_results, testcase_results)
Ejemplo n.º 3
0
    def test_patch_location_5(self):  # openpnp-openpnp-213669200
        image_tag = 'openpnp-openpnp-213669200'
        manual_results = ['Yes', 'No', 'No']
        files_changed = ['src/main/java/org/openpnp/util/OpenCvUtils.java']
        tag_language = 'java'
        build_error = {'NullPointerException': 1}
        files = ['213669200-orig.log', '213670270-orig.log', 'cloc.csv', 'diff.txt']

        # check the diffs for CODE, BUILD, TEST
        conf_code, conf_build, conf_test = self.check_diff(files_changed)
        # get classification for this test
        testcase_results = self.classify_diff_location(conf_code, conf_build, conf_test)

        artifacts_folder = "artifacts/"
        for found_tag in listdir(artifacts_folder):
            if found_tag == image_tag:
                file_path = join(artifacts_folder, found_tag)
                failed_log = process_logs(file_path, files)
                error, build_lang = detect_lang(failed_log, quiet=1)
                error_dict, userdefined, confidence = process_error(build_lang.get('language', None), failed_log)
                break

        self.assertEqual(tag_language, build_lang['language'])
        self.assertEqual(build_error, error_dict)
        self.assertListEqual(manual_results, testcase_results)
Ejemplo n.º 4
0
    def test_patch_location_3(self):  # stagemonitor-stagemonitor-131427161
        image_tag = 'stagemonitor-stagemonitor-131427161'
        manual_results = ['No', 'No', 'Yes']
        files_changed = [
            'stagemonitor/stagemonitor-jdbc/src/test/java/org/stagemonitor/jdbc/ConnectionMonitoringTransformerTest.'
            'java']
        tag_language = 'java'
        files = ['131427161-orig.log', '131433669-orig.log', 'cloc.csv', 'diff.txt']
        build_error = {'NullPointerException': 1, 'AssertionError': 1}

        # check the diffs for CODE, BUILD, TEST
        conf_code, conf_build, conf_test = self.check_diff(files_changed)
        # get classification for this test
        testcase_results = self.classify_diff_location(conf_code, conf_build, conf_test)

        artifacts_folder = "artifacts/"
        for found_tag in listdir(artifacts_folder):
            if found_tag == image_tag:
                file_path = join(artifacts_folder, found_tag)
                failed_log = process_logs(file_path, files)
                error, build_lang = detect_lang(failed_log, quiet=1)
                error_dict, userdefined, confidence = process_error(build_lang.get('language', None), failed_log)
                break

        self.assertEqual(tag_language, build_lang['language'])
        self.assertEqual(build_error, error_dict)
        self.assertListEqual(manual_results, testcase_results)