Skip to content

Commit

Permalink
bazel: Refactor test fixture rules to support gtest
Browse files Browse the repository at this point in the history
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
  • Loading branch information
oleiman committed Nov 19, 2024
1 parent 6f30a8c commit 26e0c75
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 9 deletions.
32 changes: 29 additions & 3 deletions src/v/redpanda/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
load("//bazel:test.bzl", "redpanda_test_cc_library")

redpanda_test_cc_library(
name = "fixture_base",
implementation_deps = [
],
include_prefix = "redpanda/tests",
visibility = ["//visibility:private"],
deps = [
"//src/v/redpanda:application",
"//src/v/storage/tests:disk_log_builder",
"//src/v/test_utils:fixture",
],
)

redpanda_test_cc_library(
name = "fixture",
hdrs = [
Expand All @@ -10,9 +23,22 @@ redpanda_test_cc_library(
include_prefix = "redpanda/tests",
visibility = ["//visibility:public"],
deps = [
":fixture_base",
"//src/v/cloud_storage/tests:s3_imposter",
"//src/v/redpanda:application",
"//src/v/storage/tests:disk_log_builder",
"//src/v/test_utils:seastar_boost",
],
)

redpanda_test_cc_library(
name = "fixture_gtest",
hdrs = [
"fixture.h",
],
implementation_deps = [
],
include_prefix = "redpanda/tests",
visibility = ["//visibility:public"],
deps = [
":fixture_base",
"//src/v/cloud_storage/tests:s3_imposter_gtest",
],
)
27 changes: 21 additions & 6 deletions src/v/test_utils/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
load("//bazel:test.bzl", "redpanda_test_cc_library")

redpanda_test_cc_library(
name = "fixture",
hdrs = [
"async.h",
"fixture.h",
"logs.h",
"test_macros.h",
"tmp_dir.h",
],
include_prefix = "test_utils",
visibility = ["//visibility:public"],
deps = [
"//src/v/base",
"//src/v/model",
"//src/v/storage",
"@seastar//:testing",
],
)

redpanda_test_cc_library(
name = "gtest",
srcs = [
Expand All @@ -16,9 +35,7 @@ redpanda_test_cc_library(
include_prefix = "test_utils",
visibility = ["//visibility:public"],
deps = [
"//src/v/base",
"//src/v/model",
"//src/v/storage",
":fixture",
"@fmt",
"@googletest//:gtest",
"@seastar",
Expand All @@ -41,9 +58,7 @@ redpanda_test_cc_library(
include_prefix = "test_utils",
visibility = ["//visibility:public"],
deps = [
"//src/v/base",
"//src/v/model",
"//src/v/storage",
"//src/v/test_utils:fixture",
"@seastar//:testing",
],
)
Expand Down

0 comments on commit 26e0c75

Please sign in to comment.