Example #1
0
def main():
    try:
        args = parse_options()
    except Exception as e:
        print_usage_error(path.basename(__file__), e)
        exit(2)
    try:
        conn = connect(host=args.postgres_server, user=args.postgres_username,
                       password=args.postgres_password,
                       database=args.postgres_database,
                       port=args.postgres_port)
        replaces = {'@PSCHEMANAME': args.postgres_schema,
                    '@PUSER': args.postgres_username,
                    '@MSERVER': args.mssql_server,
                    '@MPORT': args.mssql_port,
                    '@MUSER': args.mssql_username,
                    '@MPASSWORD': args.mssql_password,
                    '@MDATABASE': args.mssql_database,
                    '@MSCHEMANAME': args.mssql_schema}
        tests = run_tests('tests/postgresql/*.sql', conn, replaces)
        print_report(tests['total'], tests['ok'], tests['errors'])
        if tests['errors'] != 0:
            exit(5)
        else:
            exit(0)
    except Exception as e:
        print_error(e)
        exit(3)
Example #2
0
def main():
    try:
        args = parse_options()
    except Exception as e:
        print_usage_error(path.basename(__file__), e)
        exit(2)
    try:
        conn = connect(host=args.postgres_server,
                       user=args.postgres_username,
                       password=args.postgres_password,
                       database=args.postgres_database,
                       port=args.postgres_port)
        replaces = {
            '@PSCHEMANAME': args.postgres_schema,
            '@PUSER': args.postgres_username,
            '@MSERVER': args.mssql_server,
            '@MPORT': args.mssql_port,
            '@MUSER': args.mssql_username,
            '@MPASSWORD': args.mssql_password,
            '@MDATABASE': args.mssql_database,
            '@MSCHEMANAME': args.mssql_schema
        }
        tests = run_tests('tests/postgresql/*.sql', conn, replaces)
        print_report(tests['total'], tests['ok'], tests['errors'])
        if tests['errors'] != 0:
            exit(5)
        else:
            exit(0)
    except Exception as e:
        print_error(e)
        exit(3)
Example #3
0
def main():
    try:
        args = parse_options()
    except Exception as e:
        print_usage_error(path.basename(__file__), e)
        exit(2)
    try:
        conn = connect(host=args.postgres_server,
                       user=args.postgres_username,
                       password=args.postgres_password,
                       database=args.postgres_database,
                       port=args.postgres_port)
        if args.debugging or args.unattended_debugging:
            curs = conn.cursor()
            curs.execute("SELECT pg_backend_pid()")
            print("Backend PID = %d" % curs.fetchone()[0])
            if not args.unattended_debugging:
                print("Press any key to launch tests.")
                raw_input()
        replaces = {
            '@PSCHEMANAME': args.postgres_schema,
            '@PUSER': args.postgres_username,
            '@MSERVER': args.mssql_server,
            '@MPORT': args.mssql_port,
            '@MUSER': args.mssql_username,
            '@MPASSWORD': args.mssql_password,
            '@MDATABASE': args.mssql_database,
            '@MSCHEMANAME': args.mssql_schema,
            '@TDSVERSION': args.tds_version
        }
        tests = run_tests('tests/postgresql/*.sql', conn, replaces,
                          'postgresql', args.debugging,
                          args.unattended_debugging)
        print_report(tests['total'], tests['ok'], tests['errors'])
        logs = get_logs_path(conn, 'postgresql')
        if (tests['errors'] != 0
                or args.unattended_debugging) and not args.debugging:
            for fpath in logs:
                print_info("=========== Content of %s ===========" % fpath)
                with open(fpath, "r") as f:
                    print(f.read())
        if tests['errors'] != 0:
            exit(5)
        else:
            exit(0)
    except Exception as e:
        print_error(e)
        exit(3)
Example #4
0
def main():
    try:
        args = parse_options()
    except Exception as e:
        print_usage_error(path.basename(__file__), e)
        exit(2)
    try:
        conn = connect(server=args.server, user=args.username,
                       password=args.password, database=args.database,
                       port=args.port)
        replaces = {'@SCHEMANAME': args.schema}
        tests = run_tests('tests/mssql/*.sql', conn, replaces, 'mssql')
        print_report(tests['total'], tests['ok'], tests['errors'])
        if tests['errors'] != 0:
            exit(5)
        else:
            exit(0)
    except Exception as e:
        print_error(e)
        exit(3)
Example #5
0
def main():
    try:
        args = parse_options()
    except Exception as e:
        print_usage_error(path.basename(__file__), e)
        exit(2)
    try:
        # For our tests, tds_version 7.1 is enough
        conn = connect(server=args.server, user=args.username,
                       password=args.password, database=args.database,
                       port=args.port, tds_version='7.1')
        replaces = {'@SCHEMANAME': args.schema}
        tests = run_tests('tests/mssql/*.sql', conn, replaces, 'mssql')
        print_report(tests['total'], tests['ok'], tests['errors'])
        if tests['errors'] != 0:
            exit(5)
        else:
            exit(0)
    except Exception as e:
        print_error(e)
        exit(3)