summaryrefslogtreecommitdiff
path: root/tests/plugins/grpc/configs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/grpc/configs')
-rw-r--r--tests/plugins/grpc/configs/.rr-grpc-init.yaml58
-rw-r--r--tests/plugins/grpc/configs/external.proto19
-rw-r--r--tests/plugins/grpc/configs/test.pb.go291
-rw-r--r--tests/plugins/grpc/configs/test.proto33
4 files changed, 401 insertions, 0 deletions
diff --git a/tests/plugins/grpc/configs/.rr-grpc-init.yaml b/tests/plugins/grpc/configs/.rr-grpc-init.yaml
new file mode 100644
index 00000000..b743a766
--- /dev/null
+++ b/tests/plugins/grpc/configs/.rr-grpc-init.yaml
@@ -0,0 +1,58 @@
+rpc:
+ listen: "tcp://127.0.0.1:6001"
+
+server:
+ command: "php ../../psr-worker-bench.php"
+ relay: "pipes"
+ relay_timeout: "20s"
+
+# GRPC service configuration
+grpc:
+ # socket to listen
+ listen: "tcp://localhost:9001"
+
+ # proto root file
+ proto: "configs/test.proto"
+
+ # max send limit (MB)
+ max_send_msg_size: 50
+
+ # max receive limit (MB)
+ max_recv_msg_size: 50
+
+ # MaxConnectionIdle is a duration for the amount of time after which an
+ # idle connection would be closed by sending a GoAway. Idleness duration is
+ # defined since the most recent time the number of outstanding RPCs became
+ # zero or the connection establishment.
+ max_connection_idle: 0s
+
+ # MaxConnectionAge is a duration for the maximum amount of time a
+ # connection may exist before it will be closed by sending a GoAway. A
+ # random jitter of +/-10% will be added to MaxConnectionAge to spread out
+ # connection storms.
+ max_connection_age: 0s
+
+ # MaxConnectionAgeGrace is an additive period after MaxConnectionAge after
+ # which the connection will be forcibly closed.
+ max_connection_age_grace: 0s
+
+ # MaxConnectionAgeGrace is an additive period after MaxConnectionAge after
+ # which the connection will be forcibly closed.
+ max_concurrent_streams: 10
+
+ # After a duration of this time if the server doesn't see any activity it
+ # pings the client to see if the transport is still alive.
+ # If set below 1s, a minimum value of 1s will be used instead.
+ ping_time: 1s
+
+ # After having pinged for keepalive check, the server waits for a duration
+ # of Timeout and if no activity is seen even after that the connection is
+ # closed.
+ timeout: 200s
+
+ # Usual workers pool configuration
+ pool:
+ num_workers: 2
+ max_jobs: 0
+ allocate_timeout: 60s
+ destroy_timeout: 60
diff --git a/tests/plugins/grpc/configs/external.proto b/tests/plugins/grpc/configs/external.proto
new file mode 100644
index 00000000..2bbe806e
--- /dev/null
+++ b/tests/plugins/grpc/configs/external.proto
@@ -0,0 +1,19 @@
+syntax = "proto3";
+package tests;
+
+service External {
+ rpc Echo (Ping) returns (Pong) {
+ }
+
+ rpc Empty (EmptyMessage) returns (EmptyMessage) {
+
+ }
+}
+
+message Ping {
+ int64 value = 1;
+}
+
+message Pong {
+ int64 value = 1;
+} \ No newline at end of file
diff --git a/tests/plugins/grpc/configs/test.pb.go b/tests/plugins/grpc/configs/test.pb.go
new file mode 100644
index 00000000..5f30ceb6
--- /dev/null
+++ b/tests/plugins/grpc/configs/test.pb.go
@@ -0,0 +1,291 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.17.3
+// source: test.proto
+
+package __
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Message struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
+}
+
+func (x *Message) Reset() {
+ *x = Message{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_test_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message) ProtoMessage() {}
+
+func (x *Message) ProtoReflect() protoreflect.Message {
+ mi := &file_test_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Message.ProtoReflect.Descriptor instead.
+func (*Message) Descriptor() ([]byte, []int) {
+ return file_test_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Message) GetMsg() string {
+ if x != nil {
+ return x.Msg
+ }
+ return ""
+}
+
+type EmptyMessage struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *EmptyMessage) Reset() {
+ *x = EmptyMessage{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_test_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *EmptyMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EmptyMessage) ProtoMessage() {}
+
+func (x *EmptyMessage) ProtoReflect() protoreflect.Message {
+ mi := &file_test_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use EmptyMessage.ProtoReflect.Descriptor instead.
+func (*EmptyMessage) Descriptor() ([]byte, []int) {
+ return file_test_proto_rawDescGZIP(), []int{1}
+}
+
+type DetailsMessageForException struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code uint64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
+ Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
+}
+
+func (x *DetailsMessageForException) Reset() {
+ *x = DetailsMessageForException{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_test_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DetailsMessageForException) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DetailsMessageForException) ProtoMessage() {}
+
+func (x *DetailsMessageForException) ProtoReflect() protoreflect.Message {
+ mi := &file_test_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DetailsMessageForException.ProtoReflect.Descriptor instead.
+func (*DetailsMessageForException) Descriptor() ([]byte, []int) {
+ return file_test_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *DetailsMessageForException) GetCode() uint64 {
+ if x != nil {
+ return x.Code
+ }
+ return 0
+}
+
+func (x *DetailsMessageForException) GetMessage() string {
+ if x != nil {
+ return x.Message
+ }
+ return ""
+}
+
+var File_test_proto protoreflect.FileDescriptor
+
+var file_test_proto_rawDesc = []byte{
+ 0x0a, 0x0a, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x65,
+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x1b, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+ 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d,
+ 0x73, 0x67, 0x22, 0x0e, 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61,
+ 0x67, 0x65, 0x22, 0x4a, 0x0a, 0x1a, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x4d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04,
+ 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0xf6,
+ 0x01, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12,
+ 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
+ 0x65, 0x1a, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73,
+ 0x61, 0x67, 0x65, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x05, 0x54, 0x68, 0x72, 0x6f, 0x77, 0x12, 0x10,
+ 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+ 0x1a, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61,
+ 0x67, 0x65, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x03, 0x44, 0x69, 0x65, 0x12, 0x10, 0x2e, 0x73, 0x65,
+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x10, 0x2e,
+ 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22,
+ 0x00, 0x12, 0x2c, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76,
+ 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x10, 0x2e, 0x73, 0x65,
+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x12,
+ 0x36, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
+ 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x15,
+ 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65,
+ 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x42, 0x05, 0x5a, 0x03, 0x2e, 0x2f, 0x3b, 0x62, 0x06,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_test_proto_rawDescOnce sync.Once
+ file_test_proto_rawDescData = file_test_proto_rawDesc
+)
+
+func file_test_proto_rawDescGZIP() []byte {
+ file_test_proto_rawDescOnce.Do(func() {
+ file_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_proto_rawDescData)
+ })
+ return file_test_proto_rawDescData
+}
+
+var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_test_proto_goTypes = []interface{}{
+ (*Message)(nil), // 0: service.Message
+ (*EmptyMessage)(nil), // 1: service.EmptyMessage
+ (*DetailsMessageForException)(nil), // 2: service.DetailsMessageForException
+}
+var file_test_proto_depIdxs = []int32{
+ 0, // 0: service.Test.Echo:input_type -> service.Message
+ 0, // 1: service.Test.Throw:input_type -> service.Message
+ 0, // 2: service.Test.Die:input_type -> service.Message
+ 0, // 3: service.Test.Info:input_type -> service.Message
+ 1, // 4: service.Test.Ping:input_type -> service.EmptyMessage
+ 0, // 5: service.Test.Echo:output_type -> service.Message
+ 0, // 6: service.Test.Throw:output_type -> service.Message
+ 0, // 7: service.Test.Die:output_type -> service.Message
+ 0, // 8: service.Test.Info:output_type -> service.Message
+ 1, // 9: service.Test.Ping:output_type -> service.EmptyMessage
+ 5, // [5:10] is the sub-list for method output_type
+ 0, // [0:5] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_test_proto_init() }
+func file_test_proto_init() {
+ if File_test_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Message); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*EmptyMessage); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DetailsMessageForException); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_test_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 3,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_test_proto_goTypes,
+ DependencyIndexes: file_test_proto_depIdxs,
+ MessageInfos: file_test_proto_msgTypes,
+ }.Build()
+ File_test_proto = out.File
+ file_test_proto_rawDesc = nil
+ file_test_proto_goTypes = nil
+ file_test_proto_depIdxs = nil
+}
diff --git a/tests/plugins/grpc/configs/test.proto b/tests/plugins/grpc/configs/test.proto
new file mode 100644
index 00000000..2e1c90a9
--- /dev/null
+++ b/tests/plugins/grpc/configs/test.proto
@@ -0,0 +1,33 @@
+syntax = "proto3";
+
+package service;
+option go_package = "./;";
+
+service Test {
+ rpc Echo (Message) returns (Message) {
+ }
+
+ rpc Throw (Message) returns (Message) {
+ }
+
+ rpc Die (Message) returns (Message) {
+ }
+
+ rpc Info (Message) returns (Message) {
+ }
+
+ rpc Ping (EmptyMessage) returns (EmptyMessage) {
+ }
+}
+
+message Message {
+ string msg = 1;
+}
+
+message EmptyMessage {
+}
+
+message DetailsMessageForException {
+ uint64 code = 1;
+ string message = 2;
+} \ No newline at end of file