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 = "FilePersistentCacheTest",
    srcs = ["FilePersistentCacheTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        ":TestUtil",
        "//folly/executors:manual_executor",
        "//folly/futures:barrier",
        "//wangle/client/persistence:file",
    ],
)

cpp_unittest(
    name = "LRUPersistentCacheTest",
    srcs = ["LRUPersistentCacheTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        "//folly:memory",
        "//folly/executors:manual_executor",
        "//folly/futures:core",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/synchronization:baton",
        "//wangle/client/persistence:lru_persistent_cache",
    ],
)

cpp_library(
    name = "TestUtil",
    srcs = ["TestUtil.cpp"],
    headers = [
        "Mocks.h",
        "TestUtil.h",
    ],
    deps = [
        "//folly/testing:test_util",
    ],
    exported_deps = [
        "//folly:memory",
        "//folly:optional",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/portability:unistd",
        "//wangle/client/persistence:file",
        "//wangle/client/persistence:persistent_cache",
    ],
)

cpp_unittest(
    name = "PersistentCacheCommonTest",
    srcs = ["PersistentCacheCommonTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        "//folly/executors:manual_executor",
        "//folly/portability:gtest",
        "//wangle/client/persistence:persistent_cache_common",
    ],
)
