From 426413ce67416207b5197a31d197b1f99ef163c4 Mon Sep 17 00:00:00 2001 From: liuwentan Date: Wed, 1 Nov 2023 21:32:11 +0800 Subject: [PATCH] [optimize]shrink repository size --- test/ipport_plugin/ipport_plugin_gtest.cpp | 67 ------------------- .../ipport_plugin_table_info.conf | 13 ---- .../index/full_config_index.0000000001 | 3 +- 3 files changed, 1 insertion(+), 82 deletions(-) diff --git a/test/ipport_plugin/ipport_plugin_gtest.cpp b/test/ipport_plugin/ipport_plugin_gtest.cpp index 7002e03..54c449b 100644 --- a/test/ipport_plugin/ipport_plugin_gtest.cpp +++ b/test/ipport_plugin/ipport_plugin_gtest.cpp @@ -459,73 +459,6 @@ TEST_F(IPPortPluginTable, WITH_256SAME_IP) { scan_per_second); } -TEST_F(IPPortPluginTable, TSG_DYN_IPPORT_MAPPING) { - char redis_ip[32] = "127.0.0.1"; - int redis_port = 6379; - int redis_db = 0; - struct log_handle *logger = IPPortPluginTable::logger; - - int ret = write_config_to_redis(redis_ip, redis_port, redis_db, logger); - assert(ret == 0); - - struct maat_options *opts = maat_options_new(); - maat_options_set_redis(opts, redis_ip, redis_port, redis_db); - maat_options_set_logger(opts, log_file, LOG_LEVEL_INFO); - maat_options_set_stat_file(opts, "./stat.log"); - maat_options_set_rule_update_checking_interval_ms(opts, 100); - - struct maat *maat_inst = maat_new(opts, table_info_path); - assert(maat_inst); - maat_options_free(opts); - - int ex_data_counter = 0; - const char *table_name = "TSG_DYN_IPPORT_SUBSCRIBER_MAPPING"; - - int table_id = maat_get_table_id(maat_inst, table_name); - ASSERT_GT(table_id, 0); - - ret = maat_plugin_table_ex_schema_register(maat_inst, table_name, - ipport_plugin_ex_new_cb, - ipport_plugin_ex_free_cb, - ipport_plugin_ex_dup_cb, - 0, &ex_data_counter); - EXPECT_EQ(ret, 0); - - int i = 0; - pthread_t threads[2]; - struct thread_param thread_params[2]; - - for (i = 0; i < 2; i++) { - thread_params[i].maat_inst = maat_inst; - thread_params[i].thread_id = i; - thread_params[i].table_name = table_name; - thread_params[i].port = 45568; - thread_params[i].test_count = PERF_SCAN_COUNT; - thread_params[i].time_elapse_ms = 0; - thread_params[i].logger = logger; - } - - pthread_create(&threads[0], NULL, ipport_plugin_scan_thread, thread_params); - pthread_create(&threads[1], NULL, ipport_plugin_update_thread, thread_params + 1); - - int *is_all_hit = NULL; - long long time_elapse_ms = 0; - long long scan_per_second = 0; - for (i = 0; i < 2; i++) { - pthread_join(threads[i], (void **)&is_all_hit); - time_elapse_ms += thread_params[i].time_elapse_ms; - EXPECT_EQ(*is_all_hit, 1); - *is_all_hit = 0; - free(is_all_hit); - } - maat_free(maat_inst); - - scan_per_second = PERF_SCAN_COUNT * 1000 / time_elapse_ms; - log_info(maat_inst->logger, MODULE_IPPORT_PLUGIN_GTEST, - "IpportPluginScan TSG_DYN_IPPORT_SUBSCRIBER_MAPPING match rate speed %lld lookups/s/thread", - scan_per_second); -} - int main(int argc, char ** argv) { int ret = 0; diff --git a/test/ipport_plugin/ipport_plugin_table_info.conf b/test/ipport_plugin/ipport_plugin_table_info.conf index 1b3fc2b..7d09fb9 100644 --- a/test/ipport_plugin/ipport_plugin_table_info.conf +++ b/test/ipport_plugin/ipport_plugin_table_info.conf @@ -24,18 +24,5 @@ "port1":4, "port2":5 } - }, - { - "table_id":3, - "table_name":"TSG_DYN_IPPORT_SUBSCRIBER_MAPPING", - "table_type":"ipport_plugin", - "valid_column":6, - "custom": { - "item_id":1, - "ip_type":2, - "ip_addr":3, - "port1":4, - "port2":5 - } } ] \ No newline at end of file diff --git a/test/ipport_plugin/test_data/index/full_config_index.0000000001 b/test/ipport_plugin/test_data/index/full_config_index.0000000001 index 5fd2fa4..53f99db 100644 --- a/test/ipport_plugin/test_data/index/full_config_index.0000000001 +++ b/test/ipport_plugin/test_data/index/full_config_index.0000000001 @@ -1,3 +1,2 @@ IPPORT_PLUGIN_WITH_256SAME_IP 196608 test_data/IPPORT_PLUGIN_WITH_256SAME_IP.local -IPPORT_PLUGIN_WITHOUT_SAME_IP 196608 test_data/IPPORT_PLUGIN_WITHOUT_SAME_IP.local -TSG_DYN_IPPORT_SUBSCRIBER_MAPPING 807214 test_data/TSG_DYN_IPPORT_SUBSCRIBER_MAPPING.local \ No newline at end of file +IPPORT_PLUGIN_WITHOUT_SAME_IP 196608 test_data/IPPORT_PLUGIN_WITHOUT_SAME_IP.local \ No newline at end of file