diff --git a/src/v/kafka/server/tests/BUILD b/src/v/kafka/server/tests/BUILD index 94f890e6ef74d..73682fa115d98 100644 --- a/src/v/kafka/server/tests/BUILD +++ b/src/v/kafka/server/tests/BUILD @@ -1,4 +1,68 @@ -load("//bazel:test.bzl", "redpanda_cc_btest") +load("//bazel:test.bzl", "redpanda_cc_btest", "redpanda_cc_gtest", "redpanda_test_cc_library") + +redpanda_test_cc_library( + name = "config_response_utils_test_help", + hdrs = [ + "config_response_utils_test_help.h", + ], + implementation_deps = [ + ], + include_prefix = "kafka/server/tests", + deps = [ + "//src/v/kafka/protocol:describe_configs", + "//src/v/kafka/server", + ], +) + +redpanda_test_cc_library( + name = "client_quota_test_helpers", + hdrs = [ + "client_quota_test_helpers.h", + ], + implementation_deps = [ + ], + include_prefix = "kafka/server/tests", + deps = [ + "//src/v/base", + ], +) + +redpanda_test_cc_library( + name = "topic_properties_helpers", + hdrs = [ + "topic_properties_helpers.h", + ], + implementation_deps = [ + ], + include_prefix = "kafka/server/tests", + deps = [ + "//src/v/cluster", + "//src/v/redpanda/tests:fixture", + ], +) + +redpanda_test_cc_library( + name = "kafka_test_utils", + srcs = [ + "delete_records_utils.cc", + "list_offsets_utils.cc", + "offset_for_leader_epoch_utils.cc", + "produce_consume_utils.cc", + ], + hdrs = [ + "delete_records_utils.h", + "list_offsets_utils.h", + "offset_for_leader_epoch_utils.h", + "produce_consume_utils.h", + ], + implementation_deps = [ + ], + include_prefix = "kafka/server/tests", + deps = [ + "//src/v/bytes:iobuf", + "//src/v/kafka/client", + ], +) redpanda_cc_btest( name = "atomic_token_bucket_test", @@ -40,3 +104,557 @@ redpanda_cc_btest( "@boost//:test", ], ) + +redpanda_cc_btest( + name = "types_conversion_tests", + timeout = "short", + srcs = [ + "types_conversion_tests.cc", + ], + deps = [ + "//src/v/cluster", + "//src/v/kafka/protocol/schemata:create_topics_request", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "topic_utils_test", + timeout = "short", + srcs = [ + "topic_utils_test.cc", + ], + deps = [ + "//src/v/kafka/protocol/schemata:create_topics_response", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/test_utils:seastar_boost", + "@boost//:range", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "handler_interface_test", + timeout = "short", + srcs = [ + "handler_interface_test.cc", + ], + deps = [ + "//src/v/kafka/server", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "snc_quota_manager_test", + timeout = "short", + srcs = [ + "snc_quota_manager_test.cc", + ], + deps = [ + "//src/v/kafka/server", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "validator_tests", + timeout = "short", + srcs = [ + "validator_tests.cc", + ], + deps = [ + "//src/v/kafka/protocol/schemata:create_topics_request", + "//src/v/kafka/server", + "//src/v/pandaproxy:subject_name_strategy", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "fetch_unit_test", + timeout = "short", + srcs = [ + "fetch_unit_test.cc", + ], + deps = [ + "//src/v/base", + "//src/v/kafka/server", + "//src/v/ssx:semaphore", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "config_utils_test", + timeout = "short", + srcs = [ + "config_utils_test.cc", + ], + deps = [ + "//src/v/cluster", + "//src/v/config", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "config_response_utils_test", + timeout = "short", + srcs = [ + "config_response_utils_test.cc", + ], + deps = [ + "//src/v/kafka/server", + "//src/v/kafka/server/tests:config_response_utils_test_help", + "//src/v/test_utils:seastar_boost", + "//src/v/utils:to_string", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_gtest( + name = "consumer_group_recovery_test", + timeout = "short", + srcs = [ + "consumer_group_recovery_test.cc", + ], + deps = [ + "//src/v/container:chunked_hash_map", + "//src/v/kafka/protocol", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/storage:record_batch_builder", + "//src/v/test_utils:gtest", + "@abseil-cpp//absl/container:node_hash_map", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "member_test", + timeout = "short", + srcs = [ + "member_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/container:fragmented_vector", + "//src/v/kafka/protocol", + "//src/v/kafka/server", + "//src/v/test_utils:seastar_boost", + "//src/v/utils:to_string", + "@boost//:test", + "@fmt", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "group_test", + timeout = "short", + srcs = [ + "group_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/cluster", + "//src/v/config", + "//src/v/container:fragmented_vector", + "//src/v/kafka/protocol", + "//src/v/kafka/server", + "//src/v/test_utils:seastar_boost", + "//src/v/utils:to_string", + "@boost//:test", + "@boost//:uuid", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "read_write_roundtrip_test", + timeout = "short", + srcs = [ + "read_write_roundtrip_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/kafka/protocol", + "//src/v/random:generators", + "//src/v/test_utils:seastar_boost", + "//src/v/utils:to_string", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "delete_topics_test", + timeout = "short", + srcs = [ + "delete_topics_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/container:fragmented_vector", + "//src/v/kafka/protocol", + "//src/v/kafka/protocol:create_topics", + "//src/v/kafka/protocol:delete_topics", + "//src/v/kafka/protocol:metadata", + "//src/v/kafka/protocol/schemata:create_topics_request", + "//src/v/kafka/server", + "//src/v/redpanda:application", + "//src/v/redpanda/tests:fixture", + "//src/v/test_utils:seastar_boost", + "@abseil-cpp//absl/container:flat_hash_map", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "offset_fetch_test", + timeout = "short", + srcs = [ + "offset_fetch_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/kafka/protocol:offset_fetch", + "//src/v/redpanda/tests:fixture", + "//src/v/resource_mgmt:io_priority", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "api_versions_test", + timeout = "short", + srcs = [ + "api_versions_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/kafka/server", + "//src/v/redpanda/tests:fixture", + "//src/v/resource_mgmt:io_priority", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "usage_manager_test", + timeout = "short", + srcs = [ + "usage_manager_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/base", + "//src/v/kafka/server", + "//src/v/storage/tests:kvstore_fixture", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "create_topics_test", + timeout = "short", + srcs = [ + "create_topics_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/config", + "//src/v/container:fragmented_vector", + "//src/v/kafka/protocol:create_topics", + "//src/v/kafka/protocol:metadata", + "//src/v/kafka/server", + "//src/v/kafka/server/tests:topic_properties_helpers", + "//src/v/model", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "find_coordinator_test", + timeout = "short", + srcs = [ + "find_coordinator_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/kafka/protocol:find_coordinator", + "//src/v/redpanda/tests:fixture", + "//src/v/resource_mgmt:io_priority", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "list_offsets_test", + timeout = "short", + srcs = [ + "list_offsets_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/container:fragmented_vector", + "//src/v/kafka/protocol", + "//src/v/kafka/protocol:list_offset", + "//src/v/kafka/protocol:produce", + "//src/v/model", + "//src/v/model/tests:random", + "//src/v/redpanda/tests:fixture", + "//src/v/resource_mgmt:io_priority", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "topic_recreate_test", + timeout = "short", + srcs = [ + "topic_recreate_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/container:fragmented_vector", + "//src/v/kafka/protocol", + "//src/v/kafka/protocol:create_topics", + "//src/v/kafka/protocol:delete_topics", + "//src/v/kafka/protocol:metadata", + "//src/v/kafka/protocol:produce", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/model/tests:random", + "//src/v/redpanda:application", + "//src/v/redpanda/tests:fixture", + "//src/v/test_utils:seastar_boost", + "@abseil-cpp//absl/container:flat_hash_map", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "fetch_session_test", + timeout = "short", + srcs = [ + "fetch_session_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/kafka/protocol:fetch", + "//src/v/kafka/protocol/schemata:fetch_request", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/random:generators", + "//src/v/test_utils:seastar_boost", + "@boost//:range", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "create_partition_test", + timeout = "short", + srcs = [ + "create_partition_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/config", + "//src/v/kafka/protocol", + "//src/v/kafka/server/tests:topic_properties_helpers", + "//src/v/model", + "//src/v/test_utils:seastar_boost", + "@abseil-cpp//absl/container:flat_hash_map", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "group_metadata_serialization_test", + timeout = "short", + srcs = [ + "group_metadata_serialization_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/bytes", + "//src/v/bytes:random", + "//src/v/kafka/protocol", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/random:generators", + "//src/v/reflection:adl", + "//src/v/storage:record_batch_builder", + "//src/v/test_utils:seastar_boost", + "@boost//:range", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "partition_reassignments_test", + timeout = "short", + srcs = [ + "partition_reassignments_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/config", + "//src/v/container:fragmented_vector", + "//src/v/kafka/protocol:alter_partition_reassignments", + "//src/v/kafka/protocol:list_partition_reassignments", + "//src/v/kafka/protocol:metadata", + "//src/v/kafka/protocol/schemata:alter_partition_reassignments_request", + "//src/v/kafka/protocol/schemata:list_partition_reassignments_request", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/redpanda/tests:fixture", + "//src/v/test_utils:seastar_boost", + "@abseil-cpp//absl/container:flat_hash_map", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "replicated_partition_test", + timeout = "short", + srcs = [ + "replicated_partition_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/cluster", + "//src/v/kafka/data:partition_proxy", + "//src/v/model", + "//src/v/raft", + "//src/v/redpanda/tests:fixture", + "//src/v/storage:record_batch_builder", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "metadata_test", + timeout = "short", + srcs = [ + "metadata_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/cluster", + "//src/v/kafka/client", + "//src/v/kafka/protocol", + "//src/v/kafka/protocol:create_topics", + "//src/v/kafka/protocol:metadata", + "//src/v/kafka/protocol:sasl_authenticate", + "//src/v/kafka/protocol:sasl_handshake", + "//src/v/kafka/server", + "//src/v/model", + "//src/v/random:generators", + "//src/v/redpanda/tests:fixture", + "//src/v/security", + "//src/v/test_utils:seastar_boost", + "@abseil-cpp//absl/algorithm:container", + "@boost//:test", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "quota_manager_test", + timeout = "short", + srcs = [ + "quota_manager_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/cluster", + "//src/v/config", + "//src/v/kafka/server", + "//src/v/kafka/server/tests:client_quota_test_helpers", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "client_quota_translator_test", + timeout = "short", + srcs = [ + "client_quota_translator_test.cc", + ], + tags = ["exclusive"], + deps = [ + "//src/v/base", + "//src/v/cluster", + "//src/v/config", + "//src/v/kafka/server", + "//src/v/kafka/server/tests:client_quota_test_helpers", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) diff --git a/src/v/kafka/server/tests/list_offsets_test.cc b/src/v/kafka/server/tests/list_offsets_test.cc index 2874ca09e83f8..a67256e3773b1 100644 --- a/src/v/kafka/server/tests/list_offsets_test.cc +++ b/src/v/kafka/server/tests/list_offsets_test.cc @@ -222,7 +222,7 @@ FIXTURE_TEST(list_offsets_by_time, redpanda_thread_fixture) { // Arbitrary synthetic timestamp for start of produce auto base_timestamp = 100000; - for (long i = 0; i < batch_count; ++i) { + for (size_t i = 0; i < batch_count; ++i) { // Mixture of compressed and uncompressed, they have distinct offset // lookup behavior when searching by timequery, which will be // validated @@ -241,7 +241,7 @@ FIXTURE_TEST(list_offsets_by_time, redpanda_thread_fixture) { BOOST_REQUIRE_EQUAL(parts[0].error_code, kafka::error_code::none); } - for (long i = 0; i < batch_count; ++i) { + for (size_t i = 0; i < batch_count; ++i) { // fetch timestamp i, expect offset 2 * i. kafka::list_offsets_request req; diff --git a/src/v/kafka/server/tests/metadata_test.cc b/src/v/kafka/server/tests/metadata_test.cc index dc1b618ebb2d0..ed127d7b32386 100644 --- a/src/v/kafka/server/tests/metadata_test.cc +++ b/src/v/kafka/server/tests/metadata_test.cc @@ -24,7 +24,6 @@ #include "security/scram_algorithm.h" #include "security/scram_authenticator.h" #include "security/types.h" -#include "types.h" #include #include diff --git a/src/v/kafka/server/tests/produce_consume_test.cc b/src/v/kafka/server/tests/produce_consume_test.cc index 1e19a1b59f97b..13940b25e029f 100644 --- a/src/v/kafka/server/tests/produce_consume_test.cc +++ b/src/v/kafka/server/tests/produce_consume_test.cc @@ -81,7 +81,7 @@ struct prod_consume_fixture : public redpanda_thread_fixture { storage::record_batch_builder builder( model::record_batch_type::raft_data, model::offset(0)); - for (int i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { iobuf v{}; v.append("v", 1); builder.add_raw_kv(iobuf{}, std::move(v)); @@ -417,7 +417,7 @@ struct throughput_limits_fixure : prod_consume_fixture { for (int k = -warmup_cycles( rate_limit_in, batch_size + kafka_packet_in_overhead); - k != batches_cnt; + k != static_cast(batches_cnt); ++k) { if (k == 0) { start = ch::steady_clock::now(); diff --git a/src/v/kafka/server/tests/quota_manager_test.cc b/src/v/kafka/server/tests/quota_manager_test.cc index 988efe23c9475..9b40e5376c787 100644 --- a/src/v/kafka/server/tests/quota_manager_test.cc +++ b/src/v/kafka/server/tests/quota_manager_test.cc @@ -297,7 +297,7 @@ SEASTAR_THREAD_TEST_CASE(update_test) { set_config([&](config::configuration& conf) { auto produce_config = YAML::Load( std::string(raw_basic_produce_config)); - for (auto i = 0; i < produce_config.size(); ++i) { + for (size_t i = 0; i < produce_config.size(); ++i) { if ( produce_config[i]["clients_prefix"].as() == client_id) { diff --git a/src/v/kafka/server/tests/topic_properties_helpers.h b/src/v/kafka/server/tests/topic_properties_helpers.h index 0bdffe8bc59a7..72ecc52b40b22 100644 --- a/src/v/kafka/server/tests/topic_properties_helpers.h +++ b/src/v/kafka/server/tests/topic_properties_helpers.h @@ -7,7 +7,7 @@ // the Business Source License, use of this software will be governed // by the Apache License, Version 2.0 -#include "config_frontend.h" +#include "cluster/config_frontend.h" #include "kafka/client/transport.h" #include "kafka/protocol/create_partitions.h" #include "kafka/protocol/create_topics.h"