load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("@fbcode_macros//build_defs/lib:re_test_utils.bzl", "re_test_utils")

oncall("fbcode_entropy_wardens_folly")

cpp_unittest(
    name = "SSLSessionCacheDataTest",
    srcs = ["SSLSessionCacheDataTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        ":TestUtil",
        "//folly/json:dynamic",
        "//folly/portability:gtest",
        "//folly/ssl:openssl_ptr_types",
        "//wangle/client/ssl:ssl_session_cache_data",
        "//wangle/client/ssl:ssl_session_cache_utils",
        "//wangle/ssl:ssl_util",
    ],
)

cpp_unittest(
    name = "SSLSessionCallbackTest",
    srcs = ["SSLSessionCallbackTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    test_main = "fbsource//third-party/googletest:gtest_main",
    deps = [
        "//folly/io/async:ssl_context",
        "//folly/portability:gtest",
        "//wangle/client/ssl:ssl_session_callbacks",
    ],
)

cpp_unittest(
    name = "SSLSessionPersistentCacheTest",
    srcs = ["SSLSessionPersistentCacheTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    test_main = "fbsource//third-party/googletest:gtest_main",
    deps = [
        ":TestUtil",
        "//folly:format",
        "//folly:memory",
        "//folly/json:dynamic",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//wangle/client/persistence/test:TestUtil",
        "//wangle/client/ssl:ssl_session_persistent_cache",
    ],
)

cpp_unittest(
    name = "ThreadSafeSSLSessionCacheTest",
    srcs = ["ThreadSafeSSLSessionCacheTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        ":TestUtil",
        "//folly:conv",
        "//folly:memory",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//wangle/client/ssl:threadsafe_cache",
    ],
)

cpp_library(
    name = "TestUtil",
    srcs = ["TestUtil.cpp"],
    headers = [
        "Mocks.h",
        "TestUtil.h",
    ],
    exported_deps = [
        "//folly/portability:gmock",
        "//folly/ssl:openssl_ptr_types",
        "//wangle/client/ssl:ssl_session_callbacks",
    ],
    exported_external_deps = [
        "glog",
    ],
)
