Skip to content

Commit

Permalink
Merge pull request redpanda-data#24153 from oleiman/bazel/enterprise-…
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
oleiman authored Nov 19, 2024
2 parents c521d46 + c3bdc5b commit ada3f7a
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/v/kafka/client/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ redpanda_test_cc_library(
implementation_deps = [
],
include_prefix = "kafka/client/test",
visibility = ["//visibility:public"],
deps = [
"//src/v/kafka/client",
"//src/v/redpanda/tests:fixture",
Expand Down
98 changes: 98 additions & 0 deletions src/v/kafka/server/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -658,3 +658,101 @@ redpanda_cc_btest(
"@seastar//:testing",
],
)

redpanda_cc_btest(
name = "alter_config_test",
timeout = "short",
srcs = [
"alter_config_test.cc",
],
cpu = "1",
tags = ["exclusive"],
deps = [
"//src/v/config",
"//src/v/container:fragmented_vector",
"//src/v/kafka/client",
"//src/v/kafka/protocol",
"//src/v/kafka/protocol:alter_configs",
"//src/v/kafka/protocol:create_topics",
"//src/v/kafka/protocol:describe_configs",
"//src/v/kafka/protocol:incremental_alter_configs",
"//src/v/kafka/protocol:metadata",
"//src/v/kafka/server",
"//src/v/kafka/server/tests:topic_properties_helpers",
"//src/v/model",
"//src/v/test_utils:scoped_config",
"//src/v/test_utils:seastar_boost",
"@abseil-cpp//absl/container:flat_hash_map",
"@boost//:test",
"@seastar",
"@seastar//:testing",
],
)

redpanda_cc_btest(
name = "produce_consume_test",
timeout = "moderate",
srcs = [
"produce_consume_test.cc",
],
cpu = "1",
tags = ["exclusive"],
deps = [
":kafka_test_utils",
"//src/v/container:fragmented_vector",
"//src/v/kafka/client",
"//src/v/kafka/protocol",
"//src/v/kafka/protocol:fetch",
"//src/v/kafka/protocol:produce",
"//src/v/kafka/server",
"//src/v/model",
"//src/v/random:generators",
"//src/v/redpanda/tests:fixture",
"//src/v/storage:record_batch_builder",
"//src/v/test_utils:seastar_boost",
"@boost//:test",
"@seastar",
"@seastar//:testing",
],
)

redpanda_cc_gtest(
name = "group_tx_compaction_test",
timeout = "moderate",
srcs = [
"group_tx_compaction_test.cc",
],
cpu = 1,
deps = [
"//src/v/config",
"//src/v/kafka/server",
"//src/v/model/tests:random",
"//src/v/raft",
"//src/v/redpanda/tests:fixture_gtest",
"//src/v/test_utils:gtest",
"//src/v/test_utils:scoped_config",
"@googletest//:gtest",
],
)

redpanda_cc_gtest(
name = "fetch_test",
timeout = "short",
srcs = [
"fetch_test.cc",
],
cpu = 1,
deps = [
"//src/v/kafka/protocol",
"//src/v/kafka/server",
"//src/v/model",
"//src/v/redpanda/tests:fixture",
"//src/v/resource_mgmt:io_priority",
"//src/v/test_utils:gtest",
"//src/v/test_utils:seastar_boost",
"@boost//:test",
"@fmt",
"@seastar",
"@seastar//:testing",
],
)
4 changes: 0 additions & 4 deletions src/v/kafka/server/tests/alter_config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
#include "kafka/protocol/errors.h"
#include "kafka/protocol/incremental_alter_configs.h"
#include "kafka/protocol/metadata.h"
#include "kafka/protocol/schemata/alter_configs_request.h"
#include "kafka/protocol/schemata/describe_configs_request.h"
#include "kafka/protocol/schemata/describe_configs_response.h"
#include "kafka/protocol/schemata/incremental_alter_configs_request.h"
#include "kafka/server/handlers/topics/types.h"
#include "kafka/server/rm_group_frontend.h"
#include "kafka/server/tests/topic_properties_helpers.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/kafka/server/tests/produce_consume_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
#include "kafka/client/transport.h"
#include "kafka/protocol/errors.h"
#include "kafka/protocol/fetch.h"
#include "kafka/protocol/offset_for_leader_epoch.h"
#include "kafka/protocol/produce.h"
#include "kafka/protocol/wire.h"
#include "kafka/server/handlers/produce.h"
#include "kafka/server/snc_quota_manager.h"
#include "kafka/server/tests/delete_records_utils.h"
#include "kafka/server/tests/offset_for_leader_epoch_utils.h"
#include "kafka/server/tests/produce_consume_utils.h"
#include "model/fundamental.h"
#include "model/timeout_clock.h"
Expand Down
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",
],
)
19 changes: 19 additions & 0 deletions src/v/security/audit/tests/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("//bazel:test.bzl", "redpanda_cc_btest")

redpanda_cc_btest(
name = "audit_test",
timeout = "short",
srcs = ["audit_log_test.cc"],
cpu = 1,
memory = "256MiB",
deps = [
"//src/v/cluster",
"//src/v/kafka/client/test:fixture",
"//src/v/redpanda/tests:fixture",
"//src/v/security/audit",
"//src/v/security/audit:types",
"//src/v/test_utils:seastar_boost",
"@boost//:test",
"@seastar",
],
)
4 changes: 2 additions & 2 deletions src/v/security/audit/tests/audit_log_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ FIXTURE_TEST(test_audit_init_phase, kafka_client_fixture) {
/// with auditing disabled, calls to enqueue should be no-ops
const auto n_events = pending_audit_events(audit_mgr.local()).get();
audit_mgr
.invoke_on_all([](sa::audit_log_manager& m) {
for (auto i = 0; i < 20; ++i) {
.invoke_on_all([]([[maybe_unused]] sa::audit_log_manager& m) {
for ([[maybe_unused]] int i = 0; i < 20; ++i) {
BOOST_ASSERT(m.enqueue_authn_event(make_random_authn_options()));
}
})
Expand Down
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 ada3f7a

Please sign in to comment.