| 114 | } |
| 115 | |
| 116 | TEST(FeatureStoreMgrTest, AsyncFeatureStoreMgrTest) { |
| 117 | for (int64_t i = 0; i < NUM1; ++i) { |
| 118 | global_queue_result[i] = false; |
| 119 | } |
| 120 | |
| 121 | ModelConfig config; |
| 122 | config.read_thread_num = 5; |
| 123 | config.update_thread_num = 2; |
| 124 | config.feature_store_type = "unknown"; |
| 125 | |
| 126 | auto mgr = new AsyncFeatureStoreMgr(&config, &TestThreadRun); |
| 127 | // worker threads |
| 128 | std::vector<std::unique_ptr<std::thread>> threads; |
| 129 | threads.resize(10); |
| 130 | for (int i = 0; i < 10; ++i) { |
| 131 | threads[i].reset(new std::thread(&WorkThreadRun, mgr, i * NUM2, i * NUM2 + NUM3)); |
| 132 | } |
| 133 | |
| 134 | for (int i = 0; i < 10; ++i) { |
| 135 | threads[i]->join(); |
| 136 | } |
| 137 | |
| 138 | delete mgr; |
| 139 | |
| 140 | for (int64_t i = 0; i < NUM1-1; ++i) { |
| 141 | EXPECT_TRUE(global_queue_result[i]); |
| 142 | } |
| 143 | EXPECT_FALSE(global_queue_result[NUM1-1]); |
| 144 | |
| 145 | EXPECT_TRUE(1); |
| 146 | } |
| 147 | |
| 148 | |
| 149 | } // namespace processor |