Example #1
0
def main_job(args):
    if args[1] == 'positive_test_pre_action':
        test_pre_action.test_pre_action(args[2], args[3], args[4])
        return

    if args[1] == 'job_stream_test':
        if args[2] == 'positive':
            conf = ReadConfig()
            driver_sequence = conf.Read_Driver_Sequence()
            job_stream_test = Job_stream_test()
            print("driver_sequence:" + driver_sequence)
            ds_node = args[3]
            ds_id = args[4]
            ds_pwd = args[5]
            try:
                job_stream_test.job_stream_positive_test(
                    ds_node, ds_id, ds_pwd, driver_sequence)
            except JobStreamError as e:
                print(e.message)
                sys.exit(1)
        elif args[1] == 'negative':
            Job_stream_test.job_stream_positive_test()
        else:
            print('The test type is not valid')
        return

    if args[1] == 'iw_refresh_test':
        if args[2] == 'positive':
            iw_refresh_db_node = args[3]
            iw_db_user = args[4]
            iw_db_pwd = args[5]
            try:
                iw_test = IWRefresh_test()
                print('positive')
                iw_test.iwefresh_positive_test(iw_refresh_db_node, iw_db_user,
                                               iw_db_pwd)
            except JobStreamError as e:
                print(e.message)
                sys.exit(1)
        elif args[1] == 'negative':
            iw_test = IWRefresh_test()
            iw_test.iwefresh_negative_test()
        else:
            print('The test type is not valid')
        return

    if args[1] == 'asca_control_test':
        uid = args[2]
        pwd = args[3]
        try:
            asca_test = ASCA_test()
            conf = ReadConfig()
            asca_db_node = conf.Read_asca_db_node()
            asca_test.asca_test(asca_db_node, uid, pwd)
        except ASCAControlError as e:
            print(e.message)
            sys.exit(1)
        return

    if args[1] == 'rowcount_test':
        asca_uid = args[2]
        asca_pwd = args[3]
        try:
            rowcount_test = Rowcount_test()
            conf = ReadConfig()
            asca_db_node = conf.Read_asca_db_node()
            Rowcount_test.rowcount_test(asca_db_node, asca_uid, asca_pwd)
        except RowcountError as e:
            print(e.message)
            sys.exit(1)
        return
    else:
        print('The test case is not valid,please check your parameters')
Example #2
0
        '''when the driver is dataStage assign necessary parameter to the driver job '''
        job_stream_params = ['' for i in range(job_stream_count)]
        job_stream_list = get_dependency_job_list(driver_sequence)
        for i in range(len(job_stream_list)):
            param_index = i % job_stream_count
            job_stream_params[param_index] += job_stream_list[i] + ','
            ''' generate other parameters '''
            other_params = dict()
            if input_parameter != '':
                other_params_list = input_parameter.split(',')
                for param in other_params_list:
                    other_params[param.split('=')[0]] = param.split('=')[1]
                print(other_params)
        ''' send the job_stream_params to the driver sequence to run, input other parameters if necessary '''
        DS_Operation.Run_ds_job_on_windows(ds_node, ds_user, ds_pwd,
                                           driver_sequence, job_stream_params,
                                           **other_params)

    #''' if the driver is shell, should trigger the shell script with the necessary parameter '''
    elif driver_type == 'Shell':
        pass
    else:
        pass


if __name__ == "__main__":
    conf = ReadConfig()
    sequence_nm = conf.Read_Driver_Sequence()
    print(get_dependency_job_list(sequence_nm))
    test_pre_action('dev', 'dsdev', 'Jan2019Jan')