From 2564ee383cc371d60dbcaac2f1c9839ec36622f3 Mon Sep 17 00:00:00 2001 From: abingcbc Date: Mon, 30 Dec 2024 14:23:06 +0800 Subject: [PATCH] fix --- core/runner/sink/http/HttpSink.cpp | 16 ---------------- core/runner/sink/http/HttpSink.h | 3 --- core/unittest/pipeline/HttpSinkMock.h | 4 ---- 3 files changed, 23 deletions(-) diff --git a/core/runner/sink/http/HttpSink.cpp b/core/runner/sink/http/HttpSink.cpp index fbeb4b2589..0213edd166 100644 --- a/core/runner/sink/http/HttpSink.cpp +++ b/core/runner/sink/http/HttpSink.cpp @@ -44,7 +44,6 @@ HttpSink* HttpSink::GetInstance() { } bool HttpSink::Init() { -#ifndef APSARA_UNIT_TEST_MAIN mClient = curl_multi_init(); if (mClient == nullptr) { LOG_ERROR(sLogger, ("failed to init http sink", "failed to init curl multi client")); @@ -71,13 +70,9 @@ bool HttpSink::Init() { mThreadRes = async(launch::async, &HttpSink::Run, this); return true; -#else - return HttpSinkMock::GetInstance()->Init(); -#endif } void HttpSink::Stop() { -#ifndef APSARA_UNIT_TEST_MAIN mIsFlush = true; if (!mThreadRes.valid()) { return; @@ -88,9 +83,6 @@ void HttpSink::Stop() { } else { LOG_WARNING(sLogger, ("http sink", "forced to stopped")); } -#else - HttpSinkMock::GetInstance()->Stop(); -#endif } void HttpSink::Run() { @@ -125,14 +117,6 @@ void HttpSink::Run() { } } -bool HttpSink::AddRequest(std::unique_ptr&& request) { -#ifndef APSARA_UNIT_TEST_MAIN - return Sink::AddRequest(std::move(request)); -#else - return HttpSinkMock::GetInstance()->AddRequest(std::move(request)); -#endif -} - bool HttpSink::AddRequestToClient(unique_ptr&& request) { curl_slist* headers = nullptr; CURL* curl = CreateCurlHandler(request->mMethod, diff --git a/core/runner/sink/http/HttpSink.h b/core/runner/sink/http/HttpSink.h index 4285692ce7..a6ce67d882 100644 --- a/core/runner/sink/http/HttpSink.h +++ b/core/runner/sink/http/HttpSink.h @@ -38,9 +38,6 @@ class HttpSink : public Sink { bool Init() override; void Stop() override; - // rewrite for unittest - bool AddRequest(std::unique_ptr&& request); - private: HttpSink() = default; ~HttpSink() = default; diff --git a/core/unittest/pipeline/HttpSinkMock.h b/core/unittest/pipeline/HttpSinkMock.h index 991bbdb720..3016f56e1d 100644 --- a/core/unittest/pipeline/HttpSinkMock.h +++ b/core/unittest/pipeline/HttpSinkMock.h @@ -77,10 +77,6 @@ class HttpSinkMock : public HttpSink { } } - bool AddRequest(std::unique_ptr&& request) { - return Sink::AddRequest(std::move(request)); - } - std::vector& GetRequests() { std::lock_guard lock(mMutex); return mRequests;