def test_args(): """verify schema args are wired up correctly""" parser = argparse.ArgumentParser(prog="mine", description="entry point") subparsers = parser.add_subparsers() schema.build(subparsers) args = parser.parse_args(["schema", "-d", "hello", "-f", "abc"]) assert hasattr(args, "diag_dir") assert hasattr(args, "files")
def test_shema_run(): """validates we don't get a bad exit code""" parser = argparse.ArgumentParser(prog="mine", description="entry point") subparsers = parser.add_subparsers() schema.build(subparsers) test_file_1 = os.path.join(current_dir(__file__), "testdata", "emtpy_file_1.log") test_file_2 = os.path.join(current_dir(__file__), "testdata", "emtpy_file_2.log") args = parser.parse_args(["schema", "-f", "%s,%s" % (test_file_1, test_file_2)]) schema.run(args)
def build(subparsers): """build up subcommands""" help_text = 'Cassandra and DSE Core specific sub-commands' cass_parser = subparsers.add_parser('core', help=help_text) def run(args): if env.DEBUG: print(args) cass_parser.print_help() cass_parser.set_defaults(func=run) cass_sub = cass_parser.add_subparsers(title='DSE Core/Cassandra Commands') bgrep.build(cass_sub) diag.build(cass_sub) gc.build(cass_sub) jarcheck.build(cass_sub) schema.build(cass_sub) slowquery.build(cass_sub) statuslogger.build(cass_sub)