def main():
    try:
        global logger
        global dist_name
        logger = cm.function_logger(logging.DEBUG, logging.DEBUG)
        if sys.version_info < (3, 6):
            raise Exception(
                "To run run-intg-test.py script you must have Python 3.6 or latest. Current version info: "
                + sys.version_info)
        cm.read_property_files()
        if not cm.validate_property_readings():
            raise Exception(
                "Property file doesn't have mandatory key-value pair. Please verify the content of the property file "
                "and the format")

        # get properties assigned to local variables
        pom_path = DIST_POM_PATH
        engine = cm.db_engine.upper()
        db_meta_data = get_db_meta_data(engine)
        distribution_path = DISTRIBUTION_PATH

        # construct database configuration
        cm.construct_db_config(db_meta_data)
        # clone the repository
        cm.clone_repo()
        # set the custom testng.xml or the product testng.xml
        #set_custom_testng()

        if cm.test_mode == "WUM":
            dist_name = cm.get_dist_name_wum()

        elif cm.test_mode == "RELEASE":
            cm.checkout_to_tag()
            dist_name = cm.get_dist_name(pom_path)
            cm.get_latest_released_dist()
        elif cm.test_mode == "SNAPSHOT":
            dist_name = cm.get_dist_name(pom_path)
            # build the distribution for snapshot test mode
            cm.build_snapshot_dist(distribution_path)

        db_names = configure_product()
        if db_names is None or not db_names:
            raise Exception("Failed the product configuring")

        cm.setup_databases(db_names, db_meta_data)
        if cm.product_id == "product-apim":
            module_path = Path(cm.workspace + "/" + cm.product_id + "/" +
                               'modules/api-import-export')
            cm.build_module(module_path)
        intg_module_path = Path(cm.workspace + "/" + cm.product_id + "/" +
                                INTEGRATION_PATH)
        cm.build_module(intg_module_path)
        save_test_output()
        cm.create_output_property_fle()
    except Exception as e:
        logger.error("Error occurred while running the run-intg.py script",
                     exc_info=True)
    except BaseException as e:
        logger.error("Error occurred while doing the configuration",
                     exc_info=True)
Esempio n. 2
0
def main():
    try:
        global logger
        global dist_name
        logger = cm.function_logger(logging.DEBUG, logging.DEBUG)
        if sys.version_info < (3, 6):
            raise Exception(
                "To run run-intg-test.py script you must have Python 3.6 or latest. Current version info: " + sys.version_info)
        cm.read_property_files()
        if not cm.validate_property_readings():
            raise Exception(
                "Property file doesn't have mandatory key-value pair. Please verify the content of the property file "
                "and the format")

        # get properties assigned to local variables
        pom_path = DIST_POM_PATH
        engine = cm.db_engine.upper()
        db_meta_data = get_db_meta_data(engine)
        distribution_path = DISTRIBUTION_PATH

        # construct the database configurations
        cm.construct_db_config(db_meta_data)

        # clone the repository
        cm.clone_repo()

        if cm.test_mode == "RELEASE":
            cm.checkout_to_tag()
            # product name retrieve from product pom files
            dist_name = cm.get_dist_name(pom_path)
            # build the product without test once to make samples and required artifacts to be available.
            build_source_without_tests(cm.workspace + "/" + cm.product_id + "/")
            cm.get_latest_released_dist()
        elif cm.test_mode == "SNAPSHOT":
            # product name retrieve from product pom files
            dist_name = cm.get_dist_name(pom_path)
            cm.build_snapshot_dist(distribution_path)
        elif cm.test_mode == "WUM":
            dist_name = cm.get_dist_name_wum()

        # populate databases
        db_names = configure_product()
        if db_names is None or not db_names:
            raise Exception("Failed the product configuring")
        cm.setup_databases(db_names, db_meta_data)
        # run integration tests
        # Buld Common module
        add_environmental_variables()
        module_path = Path(cm.workspace + "/" + cm.product_id + "/" + 'modules/integration/tests-common')
        cm.build_module(module_path)
        intg_module_path = Path(cm.workspace + "/" + cm.product_id + "/" + INTEGRATION_PATH)
        cm.build_module(intg_module_path)
        save_test_output()
        cm.create_output_property_fle()
    except Exception as e:
        logger.error("Error occurred while running the run-intg.py script", exc_info=True)
    except BaseException as e:
        logger.error("Error occurred while doing the configuration", exc_info=True)
Esempio n. 3
0
def main():
    try:
        global logger
        global dist_name
        logger = cm.function_logger(logging.DEBUG, logging.DEBUG)
        if sys.version_info < (3, 6):
            raise Exception(
                "To run run-intg-test.py script you must have Python 3.6 or latest. Current version info: " + sys.version_info)
        cm.read_property_files()
        if not cm.validate_property_readings():
            raise Exception(
                "Property file doesn't have mandatory key-value pair. Please verify the content of the property file "
                "and the format")

        # get properties assigned to local variables
        pom_path = DIST_POM_PATH
        engine = cm.db_engine.upper()
        db_meta_data = get_db_meta_data(engine)
        distribution_path = DISTRIBUTION_PATH
        artifact_report_paths = ARTIFACT_REPORTS_PATHS
        testng_dest = TESTNG_DIST_XML_PATH
        testng_svr_mgt_dest = TESTNG_SERVER_MGT_DIST

        # construct database configuration
        cm.construct_db_config(db_meta_data)
        # clone the repository
        cm.clone_repo()
        # set the custom testng.xml or the product testng.xml
        cm.set_custom_testng(testng_dest, testng_svr_mgt_dest)

        if cm.test_mode == "WUM":
            dist_name = cm.get_dist_name_wum()
        elif cm.test_mode == "RELEASE":
            cm.checkout_to_tag()
            dist_name = cm.get_dist_name(pom_path)
            cm.get_latest_released_dist()
        elif cm.test_mode == "SNAPSHOT":
            dist_name = cm.get_dist_name(pom_path)
            # build the distribution for snapshot test mode
            cm.build_snapshot_dist(distribution_path)

        db_names = configure_product()
        if db_names is None or not db_names:
            raise Exception("Failed the product configuring")

        cm.setup_databases(db_names, db_meta_data)
        # add Database environment Variables
        add_environmental_variables()
        if cm.test_mode == "WUM":
            support_nexus_build_file_path = os.path.join(cm.workspace,'uat-nexus-settings.xml')
            intg_module_path = Path(cm.workspace + "/" + cm.product_id + "/modules/integration")
            shutil.copy(support_nexus_build_file_path,intg_module_path)
            # indetity_repo_path = Path(cm.workspace + "/identity-inbound-auth-oauth")
            # cm.build_module_support(intg_module_path,indetity_repo_path)
            cm.build_module_support(intg_module_path)
        else:
            intg_module_path = os.path.join(cm.workspace,cm.product_id,INTEGRATION_PATH)
            cm.build_module(intg_module_path)   
        cm.save_test_output(artifact_report_paths)
        cm.create_output_property_fle()
    except Exception as e:
        logger.error("Error occurred while running the run-intg.py script", exc_info=True)
    except BaseException as e:
        logger.error("Error occurred while doing the configuration", exc_info=True)