Skip to content

Commit

Permalink
Disable test on prometheus-cpp which not need (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored May 2, 2022
1 parent c1e6e16 commit 13ac5c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ if(WITH_PROMETHEUS)
if(NOT prometheus-cpp_FOUND)
message("Trying to use local prometheus-cpp from submodule")
if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/prometheus-cpp/.git)
set(SAVED_ENABLE_TESTING ${ENABLE_TESTING})
set(ENABLE_TESTING OFF)
add_subdirectory(third_party/prometheus-cpp)
set(ENABLE_TESTING ${SAVED_ENABLE_TESTING})
else()
message(
FATAL_ERROR
Expand Down Expand Up @@ -361,7 +364,7 @@ if(BUILD_TESTING)
${CMAKE_BINARY_DIR}/lib/libgmock.a)
elseif(WIN32)
# Make sure we are always bootsrapped with vcpkg on Windows
find_package(GTest)
find_package(GTest REQUIRED)
if(NOT (GTEST_FOUND OR GTest_FOUND))
install_windows_deps()
find_package(GTest REQUIRED)
Expand Down
24 changes: 13 additions & 11 deletions exporters/prometheus/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
foreach(testname prometheus_exporter_test prometheus_collector_test
prometheus_exporter_utils_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
prometheus_exporter_deprecated prometheus-cpp::pull)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX exporter.
TEST_LIST ${testname})
endforeach()
if(WITH_METRICS_PREVIEW)
foreach(testname prometheus_exporter_test prometheus_collector_test
prometheus_exporter_utils_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
prometheus_exporter_deprecated prometheus-cpp::pull)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX exporter.
TEST_LIST ${testname})
endforeach()
endif()

0 comments on commit 13ac5c3

Please sign in to comment.