From b436b4635108687a51270ace88fb7bbadf04f7ff Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Tue, 16 Jul 2024 22:35:01 -0700 Subject: [PATCH 1/4] bazel: add utils:stop_signal library Signed-off-by: Noah Watkins --- src/v/utils/BUILD | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/v/utils/BUILD b/src/v/utils/BUILD index 47b2236263ff..b4f9d8526b35 100644 --- a/src/v/utils/BUILD +++ b/src/v/utils/BUILD @@ -26,6 +26,18 @@ redpanda_cc_library( ], ) +redpanda_cc_library( + name = "stop_signal", + hdrs = [ + "stop_signal.h", + ], + include_prefix = "utils", + deps = [ + "//src/v/base", + "@seastar", + ], +) + redpanda_cc_library( name = "rwlock", hdrs = [ From 87cec72d35825bdcee9d98526b9699d555d37ce0 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Tue, 16 Jul 2024 22:35:21 -0700 Subject: [PATCH 2/4] bazel: add cloud storage clients library Signed-off-by: Noah Watkins --- src/v/cloud_storage_clients/BUILD | 63 ++++++++++++++ src/v/cloud_storage_clients/tests/BUILD | 110 ++++++++++++++++++++++++ 2 files changed, 173 insertions(+) create mode 100644 src/v/cloud_storage_clients/BUILD create mode 100644 src/v/cloud_storage_clients/tests/BUILD diff --git a/src/v/cloud_storage_clients/BUILD b/src/v/cloud_storage_clients/BUILD new file mode 100644 index 000000000000..5e7644c5bb34 --- /dev/null +++ b/src/v/cloud_storage_clients/BUILD @@ -0,0 +1,63 @@ +load("//bazel:build.bzl", "redpanda_cc_library") + +redpanda_cc_library( + name = "cloud_storage_clients", + srcs = [ + "abs_client.cc", + "abs_error.cc", + "client_pool.cc", + "client_probe.cc", + "configuration.cc", + "s3_client.cc", + "s3_error.cc", + "util.cc", + "xml_sax_parser.cc", + ], + hdrs = [ + "abs_client.h", + "abs_error.h", + "client.h", + "client_pool.h", + "client_probe.h", + "configuration.h", + "logger.h", + "s3_client.h", + "s3_error.h", + "types.h", + "util.h", + "xml_sax_parser.h", + ], + # for libxml2 + exclude_layering_check = True, + include_prefix = "cloud_storage_clients", + visibility = ["//visibility:public"], + deps = [ + "//src/v/base", + "//src/v/bytes", + "//src/v/bytes:iobuf", + "//src/v/bytes:iostream", + "//src/v/bytes:streambuf", + "//src/v/cloud_roles", + "//src/v/config", + "//src/v/container:intrusive", + "//src/v/hashing:secure", + "//src/v/http", + "//src/v/json", + "//src/v/metrics", + "//src/v/model", + "//src/v/net", + "//src/v/ssx:future_util", + "//src/v/ssx:sformat", + "//src/v/strings:string_switch", + "//src/v/utils:base64", + "//src/v/utils:functional", + "//src/v/utils:log_hist", + "//src/v/utils:named_type", + "//src/v/utils:stop_signal", + "@boost//:beast", + "@boost//:lexical_cast", + "@boost//:property_tree", + "@libxml2", + "@seastar", + ], +) diff --git a/src/v/cloud_storage_clients/tests/BUILD b/src/v/cloud_storage_clients/tests/BUILD new file mode 100644 index 000000000000..e9031998f11e --- /dev/null +++ b/src/v/cloud_storage_clients/tests/BUILD @@ -0,0 +1,110 @@ +load("//bazel:test.bzl", "redpanda_cc_btest", "redpanda_cc_gtest") + +redpanda_cc_btest( + name = "backend_detection_test", + timeout = "short", + srcs = [ + "backend_detection_test.cc", + ], + deps = [ + "//src/v/cloud_storage_clients", + "//src/v/config", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + ], +) + +redpanda_cc_btest( + name = "client_pool_test", + timeout = "short", + srcs = [ + "client_pool_test.cc", + ], + deps = [ + "//src/v/base", + "//src/v/cloud_storage_clients", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "s3_client_test", + timeout = "short", + srcs = [ + "s3_client_test.cc", + ], + deps = [ + "//src/v/base", + "//src/v/bytes:iobuf", + "//src/v/bytes:iobuf_parser", + "//src/v/bytes:iostream", + "//src/v/cloud_storage_clients", + "//src/v/hashing:secure", + "//src/v/net", + "//src/v/test_utils:seastar_boost", + "//src/v/utils:base64", + "//src/v/utils:unresolved_address", + "@boost//:algorithm", + "@boost//:beast", + "@boost//:property_tree", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "xml_sax_parser_test", + timeout = "short", + srcs = [ + "xml_sax_parser_test.cc", + ], + deps = [ + "//src/v/cloud_storage_clients", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + ], +) + +redpanda_cc_btest( + name = "exception_test", + timeout = "short", + srcs = [ + "exception_test.cc", + ], + deps = [ + "//src/v/cloud_storage_clients", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + "@seastar", + ], +) + +redpanda_cc_btest( + name = "util_test", + timeout = "short", + srcs = [ + "util_test.cc", + ], + deps = [ + "//src/v/cloud_storage_clients", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + ], +) + +redpanda_cc_gtest( + name = "types_test", + timeout = "short", + srcs = [ + "types_test.cc", + ], + deps = [ + "//src/v/cloud_storage_clients", + "//src/v/config", + "//src/v/test_utils:gtest", + ], +) From d4e39fb3bfdc39969dbafb51e22722d8ba986738 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Wed, 17 Jul 2024 12:48:30 -0700 Subject: [PATCH 3/4] cloud_roles: split library to support tests Signed-off-by: Noah Watkins --- src/v/cloud_roles/BUILD | 93 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 8 deletions(-) diff --git a/src/v/cloud_roles/BUILD b/src/v/cloud_roles/BUILD index b87a9f4f52d1..26376a6c485d 100644 --- a/src/v/cloud_roles/BUILD +++ b/src/v/cloud_roles/BUILD @@ -1,6 +1,85 @@ load("//bazel:build.bzl", "redpanda_cc_library") -package(default_visibility = ["//visibility:public"]) +package(default_visibility = ["//src/v/cloud_roles:__subpackages__"]) + +redpanda_cc_library( + name = "logger", + hdrs = [ + "include/cloud_roles/logger.h", + ], + strip_include_prefix = "include", + deps = [ + "//src/v/base", + "@seastar", + ], +) + +redpanda_cc_library( + name = "types", + srcs = [ + "types.cc", + ], + hdrs = [ + "include/cloud_roles/types.h", + ], + strip_include_prefix = "include", + deps = [ + "//src/v/base", + "//src/v/bytes:iobuf", + "//src/v/utils:named_type", + "@boost//:beast", + "@seastar", + ], +) + +redpanda_cc_library( + name = "request_response_helpers", + srcs = [ + "request_response_helpers.cc", + ], + hdrs = [ + "request_response_helpers.h", + ], + include_prefix = "cloud_roles", + deps = [ + ":logger", + ":types", + "//src/v/bytes:iostream", + "//src/v/bytes:streambuf", + "//src/v/config", + "//src/v/http", + "//src/v/json", + "@rapidjson", + ], +) + +redpanda_cc_library( + name = "signature", + srcs = [ + "signature.cc", + ], + hdrs = [ + "signature.h", + ], + include_prefix = "cloud_roles", + deps = [ + ":logger", + ":request_response_helpers", + ":types", + "//src/v/base", + "//src/v/bytes", + "//src/v/config", + "//src/v/hashing:secure", + "//src/v/http", + "//src/v/ssx:sformat", + "//src/v/utils:base64", + "//src/v/utils:named_type", + "@abseil-cpp//absl/strings", + "@boost//:algorithm", + "@fmt", + "@seastar", + ], +) redpanda_cc_library( name = "cloud_roles", @@ -26,23 +105,21 @@ redpanda_cc_library( "gcp_refresh_impl.h", "probe.cc", "refresh_credentials.cc", - "request_response_helpers.cc", - "request_response_helpers.h", - "signature.cc", - "signature.h", - "types.cc", ], hdrs = [ "include/cloud_roles/apply_credentials.h", - "include/cloud_roles/logger.h", "include/cloud_roles/probe.h", "include/cloud_roles/refresh_credentials.h", - "include/cloud_roles/types.h", ], # for ada exclude_layering_check = True, strip_include_prefix = "include", + visibility = ["//visibility:public"], deps = [ + ":logger", + ":request_response_helpers", + ":signature", + ":types", "//src/v/base", "//src/v/bytes", "//src/v/bytes:iobuf", From 272fe1ab7635280f6d25666f617557a9eec80ae9 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Wed, 17 Jul 2024 12:48:42 -0700 Subject: [PATCH 4/4] cloud_roles: add tests Signed-off-by: Noah Watkins --- src/v/cloud_roles/tests/BUILD | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/v/cloud_roles/tests/BUILD diff --git a/src/v/cloud_roles/tests/BUILD b/src/v/cloud_roles/tests/BUILD new file mode 100644 index 000000000000..816b93051d11 --- /dev/null +++ b/src/v/cloud_roles/tests/BUILD @@ -0,0 +1,32 @@ +load("//bazel:test.bzl", "redpanda_cc_btest") + +redpanda_cc_btest( + name = "signature_test", + timeout = "short", + srcs = [ + "signature_test.cc", + ], + deps = [ + "//src/v/cloud_roles:signature", + "//src/v/http", + "//src/v/test_utils:seastar_boost", + "@abseil-cpp//absl/strings", + "@boost//:test", + "@seastar", + "@seastar//:testing", + ], +) + +redpanda_cc_btest( + name = "schema_parsing_test", + timeout = "short", + srcs = [ + "schema_parsing_tests.cc", + ], + deps = [ + "//src/v/bytes:streambuf", + "//src/v/cloud_roles:request_response_helpers", + "//src/v/test_utils:seastar_boost", + "@boost//:test", + ], +)