From 3a837efc32b1c08cd8f891238640f53633758980 Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Mon, 29 Jan 2018 18:51:15 +0100
Subject: [PATCH] fix tests

---
 CMakeModules/testing_cpp.cmake                  | 6 ++++--
 common/cpp/include/unittests/MockIO.h           | 2 +-
 worker/api/cpp/unittests/test_server_broker.cpp | 6 +++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/CMakeModules/testing_cpp.cmake b/CMakeModules/testing_cpp.cmake
index 08b832cd5..fb082f7f9 100644
--- a/CMakeModules/testing_cpp.cmake
+++ b/CMakeModules/testing_cpp.cmake
@@ -12,6 +12,10 @@ if (BUILD_TESTS)
         set(gtest_SOURCE_DIR $ENV{gtest_SOURCE_DIR})
     endif ()
     message(STATUS "Will look for google test at ${gtest_SOURCE_DIR}")
+    if (CMAKE_COMPILER_IS_GNUCXX)
+        include(CodeCoverage)
+        APPEND_COVERAGE_COMPILER_FLAGS()
+    endif()
 endif ()
 
 function(gtest target test_source_files linktarget)
@@ -42,8 +46,6 @@ function(gtest target test_source_files linktarget)
         message(STATUS "Added test 'test-${target}'")
 
         if (CMAKE_COMPILER_IS_GNUCXX)
-            include(CodeCoverage)
-            APPEND_COVERAGE_COMPILER_FLAGS()
             set(COVERAGE_EXCLUDES "*/unittests/*" "*/3d_party/*" )
             if (ARGN)
                 set(COVERAGE_EXCLUDES ${COVERAGE_EXCLUDES} ${ARGN})
diff --git a/common/cpp/include/unittests/MockIO.h b/common/cpp/include/unittests/MockIO.h
index d739483fa..fbe0b9510 100644
--- a/common/cpp/include/unittests/MockIO.h
+++ b/common/cpp/include/unittests/MockIO.h
@@ -24,7 +24,7 @@ class MockIO : public IO {
     }
 
     MOCK_CONST_METHOD3(GetDataFromFile_t,
-                       uint8_t*(const std::string& fname, uint64_t fsize, IOErrors* err));
+                       uint8_t* (const std::string& fname, uint64_t fsize, IOErrors* err));
     MOCK_CONST_METHOD2(FilesInFolder,
                        FileInfos(
                            const std::string& folder, IOErrors
diff --git a/worker/api/cpp/unittests/test_server_broker.cpp b/worker/api/cpp/unittests/test_server_broker.cpp
index f9cbca9a4..6e083a32d 100644
--- a/worker/api/cpp/unittests/test_server_broker.cpp
+++ b/worker/api/cpp/unittests/test_server_broker.cpp
@@ -73,8 +73,8 @@ TEST_F(ServerDataBrokerTests, GetNextReturnsErrorOnWrongInput) {
 
 TEST_F(ServerDataBrokerTests, GetNextUsesCorrectUri) {
     EXPECT_CALL(mock_http_client, Get("test/next?database=database", _)).WillOnce(DoAll(
-        SetArgPointee<1>(WorkerErrorCode::kOK),
-        Return("")));
+                SetArgPointee<1>(WorkerErrorCode::kOK),
+                Return("")));
     data_broker->GetNext(&info, nullptr);
 }
 
@@ -152,7 +152,7 @@ TEST_F(ServerDataBrokerTests, GetNextCallsReadFromFile) {
 
 
     EXPECT_CALL(mock_io, GetDataFromFile_t("relative_path/base_name", 100, _)).
-        WillOnce(DoAll(SetArgPointee<2>(IOErrors::kReadError), testing::Return(nullptr)));
+    WillOnce(DoAll(SetArgPointee<2>(IOErrors::kReadError), testing::Return(nullptr)));
 
     FileData data;
     data_broker->GetNext(&info, &data);
-- 
GitLab