From ee192adfa90302c6f45eded39e9c6d2836fdb111 Mon Sep 17 00:00:00 2001 From: Xiangjin Date: Sat, 11 Nov 2023 23:49:40 +0800 Subject: [PATCH] e2e test --- ci/scripts/e2e-source-test.sh | 5 +++++ e2e_test/schema_registry/pb.py | 2 ++ e2e_test/schema_registry/pb.slt | 8 ++++---- e2e_test/schema_registry/protobuf/user.proto | 5 ++++- e2e_test/schema_registry/protobuf/user_pb2.py | 13 +++++++------ 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ci/scripts/e2e-source-test.sh b/ci/scripts/e2e-source-test.sh index 05dc731394200..3c4d9afa72f90 100755 --- a/ci/scripts/e2e-source-test.sh +++ b/ci/scripts/e2e-source-test.sh @@ -98,6 +98,11 @@ RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=i cargo make ci-start ci-1cn-1fe python3 -m pip install requests protobuf confluent-kafka python3 e2e_test/schema_registry/pb.py "message_queue:29092" "http://message_queue:8081" "sr_pb_test" 20 +curl 'http://message_queue:8081/subjects' +curl 'http://message_queue:8081/subjects/google%2Fprotobuf%2Fsource_context.proto/versions' +curl --head 'http://message_queue:8081/subjects/google%2Fprotobuf%2Fsource_context.proto/versions' +curl --silent --head 'http://message_queue:8081/subjects/google%2Fprotobuf%2Fsource_context.proto/versions' +curl --silent --head 'http://message_queue:8081/subjects/google%2Fprotobuf%2Fsource_context.proto/versions' | grep 404 sqllogictest -p 4566 -d dev './e2e_test/schema_registry/pb.slt' echo "--- Kill cluster" diff --git a/e2e_test/schema_registry/pb.py b/e2e_test/schema_registry/pb.py index 8b5e850a82796..637c0addbdc36 100644 --- a/e2e_test/schema_registry/pb.py +++ b/e2e_test/schema_registry/pb.py @@ -1,4 +1,5 @@ from protobuf import user_pb2 +from google.protobuf.source_context_pb2 import SourceContext import sys from confluent_kafka import Producer from confluent_kafka.serialization import ( @@ -21,6 +22,7 @@ def get_user(i): address="Address_{}".format(i), city="City_{}".format(i), gender=user_pb2.MALE if i % 2 == 0 else user_pb2.FEMALE, + sc=SourceContext(file_name="source/context_{:03}.proto".format(i)), ) diff --git a/e2e_test/schema_registry/pb.slt b/e2e_test/schema_registry/pb.slt index 9914d3fa04b2f..618ecd71e960c 100644 --- a/e2e_test/schema_registry/pb.slt +++ b/e2e_test/schema_registry/pb.slt @@ -39,14 +39,14 @@ select count(*) from sr_pb_test; ---- 20 -query II -select min(id), max(id) from sr_pb_test; +query IIT +select min(id), max(id), max((sc).file_name) from sr_pb_test; ---- -0 19 +0 19 source/context_019.proto statement ok drop table sr_pb_test; statement ok -drop table sr_pb_test_bk; \ No newline at end of file +drop table sr_pb_test_bk; diff --git a/e2e_test/schema_registry/protobuf/user.proto b/e2e_test/schema_registry/protobuf/user.proto index 79245a3ba4ff9..e6c5f109bbd76 100644 --- a/e2e_test/schema_registry/protobuf/user.proto +++ b/e2e_test/schema_registry/protobuf/user.proto @@ -2,15 +2,18 @@ syntax = "proto3"; package test; +import "google/protobuf/source_context.proto"; + message User { int32 id = 1; string name = 2; string address = 3; string city = 4; Gender gender = 5; + google.protobuf.SourceContext sc = 6; } enum Gender { MALE = 0; FEMALE = 1; -} \ No newline at end of file +} diff --git a/e2e_test/schema_registry/protobuf/user_pb2.py b/e2e_test/schema_registry/protobuf/user_pb2.py index 1258739d4ae2f..b87f3a5ea1d81 100644 --- a/e2e_test/schema_registry/protobuf/user_pb2.py +++ b/e2e_test/schema_registry/protobuf/user_pb2.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: user.proto +# Protobuf Python Version: 4.25.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -11,18 +12,18 @@ _sym_db = _symbol_database.Default() +from google.protobuf import source_context_pb2 as google_dot_protobuf_dot_source__context__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nuser.proto\x12\x04test\"]\n\x04User\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x03 \x01(\t\x12\x0c\n\x04\x63ity\x18\x04 \x01(\t\x12\x1c\n\x06gender\x18\x05 \x01(\x0e\x32\x0c.test.Gender*\x1e\n\x06Gender\x12\x08\n\x04MALE\x10\x00\x12\n\n\x06\x46\x45MALE\x10\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nuser.proto\x12\x04test\x1a$google/protobuf/source_context.proto\"\x89\x01\n\x04User\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x03 \x01(\t\x12\x0c\n\x04\x63ity\x18\x04 \x01(\t\x12\x1c\n\x06gender\x18\x05 \x01(\x0e\x32\x0c.test.Gender\x12*\n\x02sc\x18\x06 \x01(\x0b\x32\x1e.google.protobuf.SourceContext*\x1e\n\x06Gender\x12\x08\n\x04MALE\x10\x00\x12\n\n\x06\x46\x45MALE\x10\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'user_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - DESCRIPTOR._options = None - _globals['_GENDER']._serialized_start=115 - _globals['_GENDER']._serialized_end=145 - _globals['_USER']._serialized_start=20 - _globals['_USER']._serialized_end=113 + _globals['_GENDER']._serialized_start=198 + _globals['_GENDER']._serialized_end=228 + _globals['_USER']._serialized_start=59 + _globals['_USER']._serialized_end=196 # @@protoc_insertion_point(module_scope)