Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prometheus unit test #1461

Merged
merged 17 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions exporters/prometheus/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,64 @@ cc_library(
"@com_github_jupp0r_prometheus_cpp//pull",
],
)

cc_library(
name = "prometheus_test_helper",
hdrs = [
"test/prometheus_test_helper.h",
],
tags = ["prometheus"],
deps = [
"//api",
"//sdk:headers",
"//sdk/src/trace",
],
)

cc_test(
name = "prometheus_exporter_test",
srcs = [
"test/exporter_test.cc",
],
tags = [
"prometheus",
"test",
],
deps = [
":prometheus_exporter",
":prometheus_test_helper",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "prometheus_collector_test",
srcs = [
"test/collector_test.cc",
],
tags = [
"prometheus",
"test",
],
deps = [
":prometheus_collector",
":prometheus_test_helper",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "prometheus_exporter_utils_test",
srcs = [
"test/exporter_utils_test.cc",
],
tags = [
"prometheus",
"test",
],
deps = [
":prometheus_exporter_utils",
":prometheus_test_helper",
"@com_google_googletest//:gtest_main",
],
)
11 changes: 11 additions & 0 deletions exporters/prometheus/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ if(WITH_METRICS_PREVIEW)
TEST_PREFIX exporter.
TEST_LIST ${testname})
endforeach()
else()
foreach(testname exporter_test collector_test exporter_utils_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
prometheus_exporter prometheus-cpp::pull)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX exporter.
TEST_LIST ${testname})
endforeach()
endif()
Loading