def test_load_asis(self): conf = config.open_config(arguments.DEFAULT_CONFIG, base_default=False) conf["general"]["evdb"] = "sql" conf["database_sql"]["database"] = "sqlite3" conf["database_amulog"]["source_conf"] = self._path_amulogconf conf["database_sql"]["sqlite3_filename"] = self._path_testdb conf["filter"]["rules"] = "" from logdag import dtutil from logdag.source import evgen_log w_term = self._whole_term size = config.str2dur("1d") el = evgen_log.LogEventLoader(conf) for dt_range in dtutil.iter_term(w_term, size): el.read(dt_range, dump_org=False) am = arguments.ArgumentManager(conf) am.generate(arguments.all_args) from logdag import makedag edge_cnt = 0 for args in am: ldag = makedag.makedag_main(args, do_dump=False) edge_cnt += ldag.number_of_edges() assert edge_cnt > 0
def test_anonymize_restore(self): from amulog import __main__ as amulog_main from amulog import manager targets = amulog_main.get_targets_conf(self._amulog_conf) manager.process_files_online(self._amulog_conf, targets, reset_db=True) from amulog import anonymize am = anonymize.AnonymizeMapper(self._amulog_conf) am.anonymize(self._amulog_conf_anonymize) am.dump() conf = config.open_config(arguments.DEFAULT_CONFIG, base_default=False) conf["general"]["evdb"] = "sql" conf["database_sql"]["database"] = "sqlite3" conf["database_amulog"]["source_conf"] = self._path_amulogconf_anonymize conf["database_amulog"]["use_anonymize_mapping"] = "true" conf["database_amulog"]["given_amulog_database"] = "original" conf["database_sql"]["sqlite3_filename"] = self._path_testdb conf["dag"]["event_detail_cache"] = "false" conf["filter"]["rules"] = "" from logdag import dtutil from logdag.source import evgen_log w_term = self._whole_term size = config.str2dur("1d") el = evgen_log.LogEventLoader(conf) for dt_range in dtutil.iter_term(w_term, size): el.read(dt_range, dump_org=False) am = arguments.ArgumentManager(conf) am.generate(arguments.all_args) from logdag import makedag from logdag import showdag edge_cnt = 0 for args in am: conf["database_amulog"]["source_conf"] = self._path_amulogconf_anonymize ldag = makedag.makedag_main(args, do_dump=False) conf["database_amulog"]["source_conf"] = self._path_amulogconf showdag.show_subgraphs(ldag, "detail", load_cache=False, graph=None) # print(showdag.show_subgraphs(ldag, "detail", # load_cache=False, graph=None)) edge_cnt += ldag.number_of_edges() assert edge_cnt > 0