Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandaproxy/sr: bazelize compatibility_protobuf test #24657

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/go/rpk/pkg/serde/embed/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ go_test(
name = "embed_test",
size = "small",
srcs = ["embed_test.go"],
data = ["//src/v/pandaproxy:schema_registry_protos"],
data = ["//src/v/pandaproxy/schema_registry/protobuf:schema_registry_proto_files"],
embed = [":embed"],
deps = ["@com_github_stretchr_testify//require"],
)
2 changes: 1 addition & 1 deletion src/go/rpk/pkg/serde/embed/embed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestEmbeddedFiles(t *testing.T) {
t.Run("Test Embedded files in rpk, equal to Redpanda", func(t *testing.T) {
// /src/v/pandaproxy/schema_registry/protobuf
redpandaProtoFS := os.DirFS("../../../../../v/pandaproxy/schema_registry/protobuf/")
redpandaProtoFS := os.DirFS("../../../../../v/pandaproxy/schema_registry/protobuf")
redpandaMap := make(map[string]string)
err := fs.WalkDir(redpandaProtoFS, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
Expand Down
41 changes: 1 addition & 40 deletions src/v/pandaproxy/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:build.bzl", "redpanda_cc_library")
load("//bazel/thirdparty:seastar.bzl", "seastar_cc_swagger_library")

Expand All @@ -12,39 +11,6 @@ seastar_cc_swagger_library(
src = "api/api-doc/schema_registry.json",
)

proto_library(
name = "schema_registry_protos",
srcs = [
"schema_registry/protobuf/confluent/meta.proto",
"schema_registry/protobuf/confluent/types/decimal.proto",
"schema_registry/protobuf/google/type/calendar_period.proto",
"schema_registry/protobuf/google/type/color.proto",
"schema_registry/protobuf/google/type/date.proto",
"schema_registry/protobuf/google/type/datetime.proto",
"schema_registry/protobuf/google/type/dayofweek.proto",
"schema_registry/protobuf/google/type/decimal.proto",
"schema_registry/protobuf/google/type/expr.proto",
"schema_registry/protobuf/google/type/fraction.proto",
"schema_registry/protobuf/google/type/interval.proto",
"schema_registry/protobuf/google/type/latlng.proto",
"schema_registry/protobuf/google/type/localized_text.proto",
"schema_registry/protobuf/google/type/money.proto",
"schema_registry/protobuf/google/type/month.proto",
"schema_registry/protobuf/google/type/phone_number.proto",
"schema_registry/protobuf/google/type/postal_address.proto",
"schema_registry/protobuf/google/type/quaternion.proto",
"schema_registry/protobuf/google/type/timeofday.proto",
],
visibility = ["//src/go/rpk/pkg/serde:__subpackages__"],
deps = [
"@protobuf//:any_proto",
"@protobuf//:descriptor_proto",
"@protobuf//:duration_proto",
"@protobuf//:timestamp_proto",
"@protobuf//:wrappers_proto",
],
)

cc_proto_library(
name = "descriptor_cc_proto",
deps = [
Expand Down Expand Up @@ -122,11 +88,6 @@ cc_proto_library(
],
)

cc_proto_library(
name = "schema_registry_cc_proto",
deps = [":schema_registry_protos"],
)

redpanda_cc_library(
name = "pandaproxy",
srcs = [
Expand Down Expand Up @@ -233,7 +194,6 @@ redpanda_cc_library(
":empty_cc_proto",
":field_mask_cc_proto",
":rest_swagger",
":schema_registry_cc_proto",
":schema_registry_swagger",
":source_context_cc_proto",
":struct_cc_proto",
Expand Down Expand Up @@ -266,6 +226,7 @@ redpanda_cc_library(
"//src/v/metrics",
"//src/v/model",
"//src/v/net",
"//src/v/pandaproxy/schema_registry/protobuf:schema_registry_cc_proto",
"//src/v/random:time_jitter",
"//src/v/reflection:type_traits",
"//src/v/rpc",
Expand Down
3 changes: 0 additions & 3 deletions src/v/pandaproxy/schema_registry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ v_cc_library(
jsoncons
)

set_source_files_properties(protobuf.cc
PROPERTIES INCLUDE_DIRECTORIES ${PROJECT_BINARY_DIR})

add_subdirectory(test)
add_subdirectory(requests)
add_subdirectory(protobuf)
40 changes: 19 additions & 21 deletions src/v/pandaproxy/schema_registry/protobuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@
#include "pandaproxy/schema_registry/compatibility.h"
#include "pandaproxy/schema_registry/errors.h"
#include "pandaproxy/schema_registry/sharded_store.h"
#include "pandaproxy/schema_registry/types.h"
#include "src/v/pandaproxy/schema_registry/protobuf/confluent/meta.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/confluent/types/decimal.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/calendar_period.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/color.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/date.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/datetime.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/dayofweek.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/decimal.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/expr.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/fraction.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/interval.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/latlng.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/localized_text.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/money.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/month.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/phone_number.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/postal_address.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/quaternion.pb.h"
#include "src/v/pandaproxy/schema_registry/protobuf/google/type/timeofday.pb.h"
#include "ssx/sformat.h"
#include "utils/base64.h"

Expand All @@ -48,7 +28,8 @@
#include <absl/container/flat_hash_set.h>
#include <absl/strings/ascii.h>
#include <boost/algorithm/string/trim.hpp>
#include <boost/container/flat_set.hpp>
#include <confluent/meta.pb.h>
#include <confluent/types/decimal.pb.h>
#include <fmt/core.h>
#include <fmt/ostream.h>
#include <google/protobuf/any.pb.h>
Expand All @@ -67,6 +48,23 @@
#include <google/protobuf/timestamp.pb.h>
#include <google/protobuf/type.pb.h>
#include <google/protobuf/wrappers.pb.h>
#include <google/type/calendar_period.pb.h>
#include <google/type/color.pb.h>
#include <google/type/date.pb.h>
#include <google/type/datetime.pb.h>
#include <google/type/dayofweek.pb.h>
#include <google/type/decimal.pb.h>
#include <google/type/expr.pb.h>
#include <google/type/fraction.pb.h>
#include <google/type/interval.pb.h>
#include <google/type/latlng.pb.h>
#include <google/type/localized_text.pb.h>
#include <google/type/money.pb.h>
#include <google/type/month.pb.h>
#include <google/type/phone_number.pb.h>
#include <google/type/postal_address.pb.h>
#include <google/type/quaternion.pb.h>
#include <google/type/timeofday.pb.h>

#include <algorithm>
#include <charconv>
Expand Down
47 changes: 47 additions & 0 deletions src/v/pandaproxy/schema_registry/protobuf/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

filegroup(
name = "schema_registry_proto_files",
srcs = [
"confluent/meta.proto",
"confluent/types/decimal.proto",
"google/type/calendar_period.proto",
"google/type/color.proto",
"google/type/date.proto",
"google/type/datetime.proto",
"google/type/dayofweek.proto",
"google/type/decimal.proto",
"google/type/expr.proto",
"google/type/fraction.proto",
"google/type/interval.proto",
"google/type/latlng.proto",
"google/type/localized_text.proto",
"google/type/money.proto",
"google/type/month.proto",
"google/type/phone_number.proto",
"google/type/postal_address.proto",
"google/type/quaternion.proto",
"google/type/timeofday.proto",
],
visibility = ["//visibility:public"],
)

proto_library(
name = "schema_registry_protos",
srcs = [":schema_registry_proto_files"],
strip_import_prefix = "/src/v/pandaproxy/schema_registry/protobuf/",
visibility = ["//visibility:public"],
deps = [
"@protobuf//:any_proto",
"@protobuf//:descriptor_proto",
"@protobuf//:duration_proto",
"@protobuf//:timestamp_proto",
"@protobuf//:wrappers_proto",
],
)

cc_proto_library(
name = "schema_registry_cc_proto",
visibility = ["//visibility:public"],
deps = [":schema_registry_protos"],
)
23 changes: 23 additions & 0 deletions src/v/pandaproxy/schema_registry/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,29 @@ redpanda_cc_btest(
],
)

redpanda_cc_btest(
name = "compatibility_protobuf_test",
timeout = "short",
srcs = [
"compatibility_protobuf.cc",
],
cpu = 1,
data = [
],
deps = [
"//src/v/bytes:iobuf_parser",
"//src/v/pandaproxy",
"//src/v/pandaproxy/schema_registry/test:compatibility_common",
"//src/v/pandaproxy/schema_registry/test:compatibility_protobuf",
"//src/v/test_utils:seastar_boost",
"@abseil-cpp//absl/container:flat_hash_set",
"@boost//:test",
"@fmt",
"@seastar",
"@seastar//:testing",
],
)

redpanda_cc_btest(
name = "compatibility_avro_test",
timeout = "short",
Expand Down
Loading