def main():
    """Run the script."""
    arg_parser = argparse.ArgumentParser(description=__doc__)
    arg_parser.add_argument("--include", type=str, action="append",
                            help="Directory to search for IDL import files")
    arg_parser.add_argument("--install-dir", dest="install_dir", required=True,
                            help="Directory to search for MongoDB binaries")
    arg_parser.add_argument("-v", "--verbose", action="count", help="Enable verbose logging")
    arg_parser.add_argument("api_version", metavar="API_VERSION", help="API Version to check")
    args = arg_parser.parse_args()

    class FakeArgs:
        """Fake argparse.Namespace-like class to pass arguments to _update_config_vars."""

        def __init__(self):
            self.INSTALL_DIR = args.install_dir  # pylint: disable=invalid-name
            self.command = ""

    # pylint: disable=protected-access
    configure_resmoke._update_config_vars(FakeArgs())
    configure_resmoke._set_logging_config()

    # Configure Fixture logging.
    loggers.configure_loggers()
    loggers.new_job_logger(sys.argv[0], 0)
    logging.basicConfig(level=logging.WARNING)
    logging.getLogger(LOGGER_NAME).setLevel(logging.DEBUG if args.verbose else logging.INFO)

    command_sets = {}
    command_sets["mongod"] = list_commands_for_api(args.api_version, "mongod", args.install_dir)
    command_sets["mongos"] = list_commands_for_api(args.api_version, "mongos", args.install_dir)
    command_sets["idl"] = set(get_command_definitions(args.api_version, os.getcwd(), args.include))
    remove_skipped_commands(command_sets)
    assert_command_sets_equal(args.api_version, command_sets)
Example #2
0
 def test_job_logger(self):
     loggers.BUILDLOGGER_SERVER.new_build_id.return_value = 78
     logger = loggers.new_job_logger("dummy_test_kind", 55)
     self.assertEqual(loggers._BUILD_ID_REGISTRY[55], 78)
     self.assertEqual(logger.parent, loggers.ROOT_EXECUTOR_LOGGER)