Skip to content

Commit

Permalink
pandaproxy/sr: bazelize compatibility_protobuf test
Browse files Browse the repository at this point in the history
  • Loading branch information
IoannisRP committed Jan 9, 2025
1 parent d31b517 commit 6b56552
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 64 deletions.
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_protos"],
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/_virtual_imports/schema_registry_protos")
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)
38 changes: 19 additions & 19 deletions src/v/pandaproxy/schema_registry/protobuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,6 @@
#include "pandaproxy/schema_registry/compatibility.h"
#include "pandaproxy/schema_registry/errors.h"
#include "pandaproxy/schema_registry/sharded_store.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 "thirdparty/protobuf/descriptor.h"
#include "thirdparty/protobuf/descriptor.pb.h"
Expand All @@ -47,6 +28,8 @@

#include <absl/container/flat_hash_set.h>
#include <boost/algorithm/string/trim.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 @@ -62,6 +45,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 <string_view>
#include <unordered_set>
Expand Down
41 changes: 41 additions & 0 deletions src/v/pandaproxy/schema_registry/protobuf/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "schema_registry_protos",
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",
],
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"],
)
22 changes: 22 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,28 @@ redpanda_cc_btest(
],
)

redpanda_cc_btest(
name = "compatibility_protobuf_test",
timeout = "short",
srcs = [
"compatibility_protobuf.cc",
],
cpu = 1,
data = [
],
deps = [
"//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

0 comments on commit 6b56552

Please sign in to comment.