diff --git a/core/app_config/AppConfig.h b/core/app_config/AppConfig.h index 72d8339123..bde8099bbf 100644 --- a/core/app_config/AppConfig.h +++ b/core/app_config/AppConfig.h @@ -534,6 +534,7 @@ class AppConfig { friend class InputContainerStdioUnittest; friend class BatcherUnittest; friend class EnterpriseSLSClientManagerUnittest; + friend class FlusherRunnerUnittest; #endif }; diff --git a/core/unittest/sender/FlusherRunnerUnittest.cpp b/core/unittest/sender/FlusherRunnerUnittest.cpp index 076b51fb07..9c2b751d66 100644 --- a/core/unittest/sender/FlusherRunnerUnittest.cpp +++ b/core/unittest/sender/FlusherRunnerUnittest.cpp @@ -31,6 +31,10 @@ class FlusherRunnerUnittest : public ::testing::Test { void TestPushToHttpSink(); protected: + static void SetUpTestCase() { + AppConfig::GetInstance()->mSendRequestGlobalConcurrency = 10; + } + void TearDown() override { SenderQueueManager::GetInstance()->Clear(); HttpSink::GetInstance()->mQueue.Clear(); @@ -47,8 +51,6 @@ void FlusherRunnerUnittest::TestDispatch() { flusher->SetMetricsRecordRef("name", "1"); flusher->Init(Json::Value(), tmp); - AppConfig::GetInstance()->mSendRequestGlobalConcurrency = 10; - auto item = make_unique("content", 10, flusher.get(), flusher->GetQueueKey()); auto realItem = item.get(); flusher->PushToQueue(std::move(item));