From bad38c31cfc24a79975febbb19df4dd674c9cf8a Mon Sep 17 00:00:00 2001 From: lipanpan03 <41904587+lipanpan03@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:42:57 +0800 Subject: [PATCH] add enable_plugin config (#551) * add enable_plugin config * add enable_plugin config * fix enable_plugin ut * fix enable_plugin ut * fix enable_plugin ut * fix state machine start * fix state machine start * update java client * remove state machine start * remove state machine start * make enable plugin true in ut * make enable plugin true in ut * add hint * add hint --- deps/tugraph-db-client-java | 2 +- include/lgraph/lgraph_exceptions.h | 3 ++- src/core/global_config.cpp | 4 ++++ src/core/global_config.h | 8 ++++++-- src/db/db.cpp | 4 ++++ src/db/db.h | 16 ++++++++++++++++ src/server/lgraph_server.cpp | 11 ++--------- test/integration/ha_client_python_util.py | 18 ++++++++++++------ test/integration/test_algo_v2.py | 2 +- test/integration/test_backup.py | 4 ++-- test/integration/test_cpp_client.py | 2 +- test/integration/test_ha_python_client.py | 10 ++++++---- test/integration/test_java_client_and_ogm.py | 2 +- test/integration/test_procedure.py | 4 ++-- test/integration/test_rest.py | 2 +- test/test_ha.cpp | 10 ++++++---- test/test_ha_base.cpp | 1 + test/test_ha_witness.cpp | 8 ++++---- test/test_lgraph_backup.cpp | 1 + test/test_query.cpp | 1 + test/test_rest_client.cpp | 1 + test/test_restful_base_operation.cpp | 1 + test/test_rpc.cpp | 1 + 23 files changed, 77 insertions(+), 39 deletions(-) diff --git a/deps/tugraph-db-client-java b/deps/tugraph-db-client-java index 059fda24bf..4e64dc431e 160000 --- a/deps/tugraph-db-client-java +++ b/deps/tugraph-db-client-java @@ -1 +1 @@ -Subproject commit 059fda24bf22bf57f7cf7033105c19bdad61e1dd +Subproject commit 4e64dc431e7ccff81d9c7514ddb81c1f6acf281e diff --git a/include/lgraph/lgraph_exceptions.h b/include/lgraph/lgraph_exceptions.h index 8ec1404614..4230ed1fda 100644 --- a/include/lgraph/lgraph_exceptions.h +++ b/include/lgraph/lgraph_exceptions.h @@ -76,7 +76,8 @@ X(ReminderException, "Reminder exception.") \ X(GraphCreateException, "Graph create exception.") \ X(CypherParameterTypeError, "Cypher parameter type error.") \ X(ReachMaximumEid, "Edge eid exceeds the limit.") \ -X(ReachMaximumCompositeIndexField, "The size of composite index fields exceeds the limit.") +X(ReachMaximumCompositeIndexField, "The size of composite index fields exceeds the limit.") \ +X(PluginDisabled, "Plugin disabled!") enum class ErrorCode { #define X(code, msg) code, diff --git a/src/core/global_config.cpp b/src/core/global_config.cpp index 019b16355f..8ef8be9dff 100644 --- a/src/core/global_config.cpp +++ b/src/core/global_config.cpp @@ -213,6 +213,8 @@ fma_common::Configuration lgraph::GlobalConfig::InitConfig // bolt bolt_port = 0; bolt_io_thread_num = 1; + // default disable plugin load/delete + enable_plugin = false; // parse options fma_common::Configuration argparser; @@ -325,5 +327,7 @@ fma_common::Configuration lgraph::GlobalConfig::InitConfig .Comment("Bolt protocol port."); argparser.Add(bolt_io_thread_num, "bolt_io_thread_num", true) .Comment("Number of bolt io threads."); + argparser.Add(enable_plugin, "enable_plugin", true) + .Comment("Enable load/delete procedure."); return argparser; } diff --git a/src/core/global_config.h b/src/core/global_config.h index 0561410fad..08620948c3 100644 --- a/src/core/global_config.h +++ b/src/core/global_config.h @@ -48,7 +48,8 @@ struct BasicConfigs { , max_backup_log_file_size((size_t)1 << 30) , unlimited_token(false) , reset_admin_password(false) - , enable_realtime_count(true) {} + , enable_realtime_count(true) + , enable_plugin(false) {} BasicConfigs(const BasicConfigs &basicConfigs) : db_dir(basicConfigs.db_dir) @@ -76,7 +77,8 @@ struct BasicConfigs { , max_backup_log_file_size(basicConfigs.max_backup_log_file_size) , ft_index_options(basicConfigs.ft_index_options) , unlimited_token(basicConfigs.unlimited_token) - , reset_admin_password(basicConfigs.reset_admin_password) {} + , reset_admin_password(basicConfigs.reset_admin_password) + , enable_plugin(basicConfigs.enable_plugin) {} std::string db_dir; // db int thread_limit; // number of threads, for both rpc and http @@ -133,6 +135,8 @@ struct BasicConfigs { // bolt int bolt_port = 0; int bolt_io_thread_num = 1; + // default disable plugin load/delete + bool enable_plugin = false; }; template diff --git a/src/db/db.cpp b/src/db/db.cpp index 7be394d9c4..ec3285d6e6 100644 --- a/src/db/db.cpp +++ b/src/db/db.cpp @@ -15,6 +15,8 @@ #include "db/db.h" #include "lgraph/lgraph_txn.h" +bool lgraph::AccessControlledDB::enable_plugin = true; + lgraph::AccessControlledDB::AccessControlledDB(ScopedRef&& ref, AccessLevel access_level, const std::string& user) @@ -64,6 +66,7 @@ bool lgraph::AccessControlledDB::LoadPlugin(plugin::Type plugin_type, const std: plugin::CodeType code_type, const std::string& desc, bool is_read_only, const std::string& version) { CheckAdmin(); + CheckLoadOrDeletePlugin(); return graph_->GetPluginManager()->LoadPluginFromCode(plugin_type, user, name, code, filename, code_type, desc, is_read_only, version); } @@ -71,6 +74,7 @@ bool lgraph::AccessControlledDB::LoadPlugin(plugin::Type plugin_type, const std: bool lgraph::AccessControlledDB::DelPlugin(plugin::Type plugin_type, const std::string& user, const std::string& name) { CheckAdmin(); + CheckLoadOrDeletePlugin(); return graph_->GetPluginManager()->DelPlugin(plugin_type, user, name); } diff --git a/src/db/db.h b/src/db/db.h index eed7a58b64..87e92d4d4b 100644 --- a/src/db/db.h +++ b/src/db/db.h @@ -27,6 +27,7 @@ class AccessControlledDB { AutoReadLock graph_ref_lock_; AccessLevel access_level_; std::string user_; + static bool enable_plugin; DISABLE_COPY(AccessControlledDB); @@ -147,6 +148,14 @@ class AccessControlledDB { inline LightningGraph* GetLightningGraph() const { return graph_; } + inline static void SetEnablePlugin(bool enable_plugin_) { + AccessControlledDB::enable_plugin = enable_plugin_; + } + + inline static bool GetEnablePlugin() { + return enable_plugin; + } + private: inline void CheckReadAccess() const { if (access_level_ < AccessLevel::READ) THROW_CODE(Unauthorized, "No read permission."); @@ -163,5 +172,12 @@ class AccessControlledDB { inline void CheckAdmin() const { if (user_ != _detail::DEFAULT_ADMIN_NAME) THROW_CODE(Unauthorized, "Not the admin user."); } + + inline void CheckLoadOrDeletePlugin() const { + if (!enable_plugin) THROW_CODE(PluginDisabled, "No permission to load or delete plugin, " + "please use correct config and restart server!\n" + "This function has security risks, please enable " + "it with caution!"); + } }; } // namespace lgraph diff --git a/src/server/lgraph_server.cpp b/src/server/lgraph_server.cpp index 5a9d2ffe3f..0c23619e57 100644 --- a/src/server/lgraph_server.cpp +++ b/src/server/lgraph_server.cpp @@ -88,6 +88,8 @@ LGraphServer::LGraphServer(std::shared_ptr config) LGraphServer::~LGraphServer() { Stop(false); } int LGraphServer::Start() { + // assign AccessControllerDB enable_plugin + AccessControlledDB::SetEnablePlugin(config_->enable_plugin); // adjust config if (config_->enable_ha && config_->ha_log_dir.empty()) { #if LGRAPH_SHARE_DIR @@ -298,15 +300,6 @@ int LGraphServer::Start() { return Stop(); } LOG_INFO() << "Server started."; - -#ifndef __SANITIZE_ADDRESS__ - const std::string& hostname = fma_common::HardwareInfo::GetHostName(); - const std::string server = "localhost:6091"; - DBManagementClient::GetInstance().Init(hostname, config_->http_port, server); - heartbeat_detect = std::thread([]() { - DBManagementClient::GetInstance().DetectHeartbeat(); - }); -#endif } catch (std::exception &e) { _kill_signal_.Notify(); LOG_WARN() << "Server hit an exception and shuts down abnormally: " << e.what(); diff --git a/test/integration/ha_client_python_util.py b/test/integration/ha_client_python_util.py index a7460864ce..a81854635d 100644 --- a/test/integration/ha_client_python_util.py +++ b/test/integration/ha_client_python_util.py @@ -83,38 +83,44 @@ def start_ha_server(host, db): f"&& cd ha1 && ./lgraph_server --host {host} --port 27072 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " f"--rpc_port 29092 --directory {db} --log_dir " - f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 -c lgraph_ha.json -d start") + f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 --enable_plugin 1" + f" -c lgraph_ha.json -d start") time.sleep(3) os.system(f"mkdir ha2 && cp -r ../../src/server/lgraph_ha.json " f"./lgraph_server ./resource ha2 " f"&& cd ha2 && ./lgraph_server --host {host} --port 27073 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " f"--rpc_port 29093 --directory {db} --log_dir " - f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 -c lgraph_ha.json -d start") + f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 --enable_plugin 1" + f" -c lgraph_ha.json -d start") time.sleep(3) os.system(f"mkdir ha3 && cp -r ../../src/server/lgraph_ha.json " f"./lgraph_server ./resource ha3 " f"&& cd ha3 && ./lgraph_server --host {host} --port 27074 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " f"--rpc_port 29094 --directory {db} --log_dir " - f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 -c lgraph_ha.json -d start") + f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 --enable_plugin 1" + f" -c lgraph_ha.json -d start") time.sleep(10) def restart_ha_server(host, db): os.system(f"cd ha1 && ./lgraph_server --host {host} --port 27072 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " f"--rpc_port 29092 --directory {db} --log_dir " - f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 -c lgraph_ha.json -d start") + f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 --enable_plugin 1" + f" -c lgraph_ha.json -d start") time.sleep(3) os.system(f"cd ha2 && ./lgraph_server --host {host} --port 27073 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " f"--rpc_port 29093 --directory {db} --log_dir " - f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 -c lgraph_ha.json -d start") + f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 --enable_plugin 1" + f" -c lgraph_ha.json -d start") time.sleep(3) os.system(f"cd ha3 && ./lgraph_server --host {host} --port 27074 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " f"--rpc_port 29094 --directory {db} --log_dir " - f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 -c lgraph_ha.json -d start") + f"./log --ha_conf {host}:29092,{host}:29093,{host}:29094 --enable_plugin 1" + f" -c lgraph_ha.json -d start") time.sleep(10) def start_ha_client(host, port, user=DEFAULT_ADMIN_NAME, pwd=DEFAULT_ADMIN_PASS, urls=None): diff --git a/test/integration/test_algo_v2.py b/test/integration/test_algo_v2.py index 7034ea60c7..3435664864 100644 --- a/test/integration/test_algo_v2.py +++ b/test/integration/test_algo_v2.py @@ -6,7 +6,7 @@ log = logging.getLogger(__name__) -SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092", +SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092 --enable_plugin 1", "cleanup_dir":["./testdb"]} CLIENTOPT = {"host":"127.0.0.1:9092", "user":"admin", "password":"73@TuGraph"} diff --git a/test/integration/test_backup.py b/test/integration/test_backup.py index 7398bfa66c..fff888fffb 100644 --- a/test/integration/test_backup.py +++ b/test/integration/test_backup.py @@ -4,10 +4,10 @@ log = logging.getLogger(__name__) -SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --port 7072 --rpc_port 9092 --enable_backup_log true --host 0.0.0.0 --verbose 1 --directory ./testdb", +SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --port 7072 --rpc_port 9092 --enable_plugin 1 --enable_backup_log true --host 0.0.0.0 --verbose 1 --directory ./testdb", "cleanup_dir":["./testdb"]} -SERVEROPT_1 = {"cmd":"./lgraph_server -c lgraph_standalone.json --port 7073 --rpc_port 9093 --enable_backup_log true --host 0.0.0.0 --verbose 1 --directory ./testdb1", +SERVEROPT_1 = {"cmd":"./lgraph_server -c lgraph_standalone.json --port 7073 --rpc_port 9093 --enable_plugin 1 --enable_backup_log true --host 0.0.0.0 --verbose 1 --directory ./testdb1", "cleanup_dir":["./testdb1"]} CLIENTOPT = {"host":"127.0.0.1:9092", "user":"admin", "password":"73@TuGraph"} diff --git a/test/integration/test_cpp_client.py b/test/integration/test_cpp_client.py index d6c78c5dec..1b2d126884 100644 --- a/test/integration/test_cpp_client.py +++ b/test/integration/test_cpp_client.py @@ -15,7 +15,7 @@ class TestCppClient: "cmd" : "./clienttest" } - SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092", + SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092 --enable_plugin 1", "cleanup_dir":["./testdb"]} @pytest.mark.parametrize("build_so", [BUILDOPT], indirect=True) diff --git a/test/integration/test_ha_python_client.py b/test/integration/test_ha_python_client.py index cdca5d82be..3477e5eb86 100644 --- a/test/integration/test_ha_python_client.py +++ b/test/integration/test_ha_python_client.py @@ -245,8 +245,9 @@ def test_follower_restart(self): self.client.logout() os.system(f"cd ha2 && ./lgraph_server --host {self.host} --port 27073 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " - f"--rpc_port 29093 --directory ./db --log_dir " - f"./log --ha_conf {self.host}:29092,{self.host}:29093,{self.host}:29094 -c lgraph_ha.json -d start") + f"--rpc_port 29093 --enable_plugin 1 --directory ./db --log_dir " + f"./log --enable_plugin 1 --ha_conf {self.host}:29092,{self.host}:29093," + f"{self.host}:29094 -c lgraph_ha.json -d start") time.sleep(13) self.client = start_ha_client(self.host, "29092") time.sleep(7) @@ -273,8 +274,9 @@ def test_leader_restart(self): self.client.logout() os.system(f"cd ha1 && ./lgraph_server --host {self.host} --port 27072 --enable_rpc " f"true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " - f"--rpc_port 29092 --directory ./db --log_dir " - f"./log --ha_conf {self.host}:29092,{self.host}:29093,{self.host}:29094 -c lgraph_ha.json -d start") + f"--rpc_port 29092 --enable_plugin 1 --directory ./db --log_dir " + f"./log --enable_plugin 1 --ha_conf {self.host}:29092,{self.host}:29093," + f"{self.host}:29094 -c lgraph_ha.json -d start") time.sleep(13) self.client = start_ha_client(self.host, "29093") time.sleep(7) diff --git a/test/integration/test_java_client_and_ogm.py b/test/integration/test_java_client_and_ogm.py index 0eb59d833a..e0efcdfee0 100644 --- a/test/integration/test_java_client_and_ogm.py +++ b/test/integration/test_java_client_and_ogm.py @@ -7,7 +7,7 @@ "cmd" : "echo run TestJavaClientAndOGM" } -SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092", +SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092 --enable_plugin 1", "cleanup_dir":["./testdb"]} class TestJavaClientAndOGM: diff --git a/test/integration/test_procedure.py b/test/integration/test_procedure.py index 3e16142b7f..276b045f16 100644 --- a/test/integration/test_procedure.py +++ b/test/integration/test_procedure.py @@ -5,10 +5,10 @@ log = logging.getLogger(__name__) -SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092", +SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092 --enable_plugin 1", "cleanup_dir":["./testdb"]} -SERVEROPT_1 = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092", +SERVEROPT_1 = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7072 --rpc_port 9092 --enable_plugin 1", "cleanup_dir":[]} CLIENTOPT = {"host":"127.0.0.1:9092", "user":"admin", "password":"73@TuGraph"} diff --git a/test/integration/test_rest.py b/test/integration/test_rest.py index 72783020a6..b9d3caf448 100644 --- a/test/integration/test_rest.py +++ b/test/integration/test_rest.py @@ -4,7 +4,7 @@ log = logging.getLogger(__name__) -SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7073 --rpc_port 9093", +SERVEROPT = {"cmd":"./lgraph_server -c lgraph_standalone.json --directory ./testdb --port 7073 --rpc_port 9093 --enable_plugin 1", "cleanup_dir":["./testdb"]} RESTTOPT = {"port":"7073", "user":"admin", "password":"73@TuGraph"} diff --git a/test/test_ha.cpp b/test/test_ha.cpp index 6d79378e2f..22ab624c22 100644 --- a/test/test_ha.cpp +++ b/test/test_ha.cpp @@ -31,7 +31,7 @@ class TestHA : public TuGraphTest { "true --enable_ha true --ha_node_offline_ms 5000 " "--ha_node_remove_ms 10000 --ha_snapshot_interval_s -1 " "--rpc_port {} --directory ./db --log_dir " - "./log --ha_conf {} --verbose 1 -c lgraph_ha.json -d start"; + "./log --ha_conf {} --enable_plugin 1 --verbose 1 -c lgraph_ha.json -d start"; #else std::string cmd_f = "mkdir {} && cp -r ../../src/server/lgraph_ha.json " @@ -40,7 +40,8 @@ class TestHA : public TuGraphTest { "true --enable_ha true --ha_node_offline_ms 5000 " "--ha_node_remove_ms 10000 --ha_snapshot_interval_s -1 " "--rpc_port {} --directory ./db --log_dir " - "./log --ha_conf {} --use_pthread 1 --verbose 1 -c lgraph_ha.json -d start"; + "./log --ha_conf {} --enable_plugin 1 --use_pthread 1 --verbose 1 -c " + "lgraph_ha.json -d start"; #endif int rt; @@ -194,13 +195,14 @@ TEST_F(TestHA, HAConsistency) { "cd {} && ./lgraph_server --host {} --port {} --enable_rpc " "true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " "--ha_snapshot_interval_s -1 --rpc_port {} --directory ./db --log_dir " - "./log --ha_conf {} -c lgraph_ha.json -d start"; + "./log --ha_conf {} --enable_plugin 1 -c lgraph_ha.json -d start"; #else cmd_f = "cd {} && ./lgraph_server --host {} --port {} --enable_rpc " "true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 " "--ha_snapshot_interval_s -1 --rpc_port {} --directory ./db --log_dir " - "./log --ha_conf {} --use_pthread 1 --verbose 1 -c lgraph_ha.json -d start"; + "./log --ha_conf {} --enable_plugin 1 --use_pthread 1 --verbose 1 -c " + "lgraph_ha.json -d start"; #endif cmd = FMA_FMT(cmd_f.c_str(), "ha3", host, "27074", "29094", host + ":29092," + host + ":29093," + host + ":29094"); diff --git a/test/test_ha_base.cpp b/test/test_ha_base.cpp index b0b9cea22b..45391f9d1e 100644 --- a/test/test_ha_base.cpp +++ b/test/test_ha_base.cpp @@ -258,6 +258,7 @@ class TestHABase : public TuGraphTest { config->rpc_port = rpc_port; config->enable_ha = true; config->verbose = 1; + config->enable_plugin = true; t.reset(new HaUnitTest(config, n_clients)); fma_common::file_system::RemoveDir(t->config_->db_dir); diff --git a/test/test_ha_witness.cpp b/test/test_ha_witness.cpp index 186e52a526..7a90c9cea4 100644 --- a/test/test_ha_witness.cpp +++ b/test/test_ha_witness.cpp @@ -12,13 +12,13 @@ const char ha_mkdir[] = "mkdir {} && cp -r ../../src/server/lgraph_ha.json " const char server_cmd_f[] = "cd {} && ./lgraph_server --host {} --port {} --enable_rpc " "true --enable_ha true --ha_snapshot_interval_s -1 --ha_node_join_group_s 60 " - "--rpc_port {} --directory ./db --log_dir " + "--rpc_port {} --enable_plugin 1 --directory ./db --log_dir " "./log --ha_conf {} --verbose 1 -c lgraph_ha.json -d start"; const char witness_cmd_f[] = "cd {} && ./lgraph_server --host {} --port {} --enable_rpc " "true --enable_ha true --ha_is_witness 1 " "--ha_snapshot_interval_s -1 --ha_node_join_group_s 60 " - "--rpc_port {} --directory ./db --log_dir " + "--rpc_port {} --enable_plugin 1 --directory ./db --log_dir " "./log --ha_conf {} --verbose 1 " "-c lgraph_ha.json --ha_enable_witness_to_leader {} -d start"; #else @@ -26,10 +26,10 @@ const char server_cmd_f[] = "cd {} && ./lgraph_server --host {} --port {} --enable_rpc " "true --enable_ha true --ha_snapshot_interval_s -1 " "--ha_node_join_group_s 60 --rpc_port {} --directory ./db --log_dir " - "./log --ha_conf {} --use_pthread 1 --verbose 1 -c lgraph_ha.json -d start"; + "./log --enable_plugin 1 --ha_conf {} --use_pthread 1 --verbose 1 -c lgraph_ha.json -d start"; const char witness_cmd_f[] = "cd {} && ./lgraph_server --host {} --port {} --enable_rpc " - "true --enable_ha true --ha_is_witness 1 --ha_snapshot_interval_s -1 " + "true --enable_ha true --enable_plugin 1 --ha_is_witness 1 --ha_snapshot_interval_s -1 " "--ha_node_join_group_s 60 --rpc_port {} --directory ./db --log_dir " "./log --ha_conf {} --use_pthread 1 --verbose 1 -c lgraph_ha.json " "--ha_enable_witness_to_leader {} -d start"; diff --git a/test/test_lgraph_backup.cpp b/test/test_lgraph_backup.cpp index 34d766fbb1..8b03268213 100644 --- a/test/test_lgraph_backup.cpp +++ b/test/test_lgraph_backup.cpp @@ -33,6 +33,7 @@ TEST_F(TestLGraphBackupTool, LGraphBackupTool) { config_->http_port = 17173; config_->rpc_port = 19193; config_->verbose = 2; + config_->enable_plugin = true; std::string username = "admin"; std::string password = "73@TuGraph"; std::string plugin_name = "scan_graph"; diff --git a/test/test_query.cpp b/test/test_query.cpp index f500952b49..0a610f2fd8 100644 --- a/test/test_query.cpp +++ b/test/test_query.cpp @@ -375,5 +375,6 @@ TEST_F(TestQuery, TestCypherFinbench) { set_graph_type(GraphFactory::GRAPH_DATASET_TYPE::MINI_FINBENCH); set_query_type(lgraph::ut::QUERY_TYPE::CYPHER); std::string dir = test_suite_dir_ + "/finbench/cypher"; + lgraph::AccessControlledDB::SetEnablePlugin(true); test_files(dir); } diff --git a/test/test_rest_client.cpp b/test/test_rest_client.cpp index e5f0eb43c9..77696b8d65 100644 --- a/test/test_rest_client.cpp +++ b/test/test_rest_client.cpp @@ -73,6 +73,7 @@ TEST_P(TestRestClient, RestClient) { gconfig->db_dir = db_dir; gconfig->server_key_file = key_path; gconfig->server_cert_file = cert_path; + gconfig->enable_plugin = true; auto StartEmptyServer = [&]() { std::unique_ptr server(new LGraphServer(gconfig)); diff --git a/test/test_restful_base_operation.cpp b/test/test_restful_base_operation.cpp index 08d07ac600..4574f90ba3 100644 --- a/test/test_restful_base_operation.cpp +++ b/test/test_restful_base_operation.cpp @@ -119,6 +119,7 @@ TEST_P(TestRestfulBaseOperation, RestfulBaseOperation) { gconfig->db_dir = db_dir; gconfig->server_key_file = key_path; gconfig->server_cert_file = cert_path; + gconfig->enable_plugin = true; LGraphServer server(gconfig); server.Start(); #endif diff --git a/test/test_rpc.cpp b/test/test_rpc.cpp index 090b27227e..8f2f471f10 100644 --- a/test/test_rpc.cpp +++ b/test/test_rpc.cpp @@ -83,6 +83,7 @@ void on_initialize_rpc_server() { sm_config.rpc_port = 19099; gconfig->ft_index_options.enable_fulltext_index = true; + lgraph::AccessControlledDB::SetEnablePlugin(true); ptr_state_machine = new lgraph::StateMachine(sm_config, gconfig); ptr_rpc_service = new RPCService(ptr_state_machine);