Skip to content

Commit

Permalink
test: streaming for extended services (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix021 authored Jan 17, 2024
1 parent 3b1ef78 commit 41bc566
Show file tree
Hide file tree
Showing 121 changed files with 8,147 additions and 587 deletions.
18 changes: 14 additions & 4 deletions thrift_streaming/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ function generate_old() {
export PATH=$OLD:$SAVE_PATH

mkdir -p $dir
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
GOBIN=$dir go install github.com/cloudwego/[email protected]
if [ ! -f "$dir/kitex" ]; then
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
fi
if [ ! -f "$dir/thriftgo" ]; then
GOBIN=$dir go install github.com/cloudwego/[email protected]
fi
if [ ! -f "$dir/kitex" -o ! -f "$dir/thriftgo" ]; then
echo "[old] Unable to install kitex or thriftgo to $dir, please check before continue."
exit 1
Expand Down Expand Up @@ -81,10 +85,12 @@ function generate_new() {
# Thrift
kitex $module $idl
kitex $module --combine-service idl/combine.thrift
kitex $module --combine-service idl/combine_extend.thrift

# Thrift Slim
kitex -thrift template=slim -gen-path kitex_gen_slim $module $idl
kitex -thrift template=slim -gen-path kitex_gen_slim $module --combine-service idl/combine.thrift
kitex -thrift template=slim -gen-path kitex_gen_slim $module --combine-service idl/combine_extend.thrift

# KitexPB
kitex $module idl/api.proto
Expand All @@ -99,8 +105,12 @@ function generate_new_thriftgo_old_kitex() {
export PATH=$dir:$SAVE_PATH

mkdir -p $dir
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
GOBIN=$dir go install github.com/cloudwego/thriftgo@latest
if [ ! -f "$dir/kitex" ]; then
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
fi
if [ ! -f "$dir/thriftgo" ]; then
GOBIN=$dir go install github.com/cloudwego/thriftgo@latest
fi
if [ ! -f "$dir/kitex" -o ! -f "$dir/thriftgo" ]; then
echo "[cross] Unable to install kitex or thriftgo to $dir, please check before continue."
exit 1
Expand Down
18 changes: 16 additions & 2 deletions thrift_streaming/idl/api.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,24 @@ service EchoService {

// for checking whether the generated code is ok
service PingPongOnlyService {
EchoResponse EchoPingPong (1: EchoRequest req1),
EchoResponse EchoPingPongNew (1: EchoRequest req1),
}

// Also streaming
service PingPongOnlyServiceChild extends PingPongOnlyService {
EchoResponse EchoBidirectionalExtended (1: EchoRequest req1) (streaming.mode="bidirectional"),
}

// Also streaming
service PingPongOnlyServiceChildChild extends PingPongOnlyServiceChild {}

// for checking whether the generated code is ok
service StreamOnlyService {
EchoResponse EchoBidirectional (1: EchoRequest req1) (streaming.mode="bidirectional"),
EchoResponse EchoBidirectionalNew (1: EchoRequest req1) (streaming.mode="bidirectional"),
}

// for checking services extending a service extending a service
service StreamOnlyServiceChild extends StreamOnlyService {}

// should also be a streaming service
service StreamOnlyServiceChildChild extends StreamOnlyServiceChild {}
22 changes: 22 additions & 0 deletions thrift_streaming/idl/combine_extend.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace go combine_extend

include "api.thrift"


service A extends api.PingPongOnlyService {}

service B extends api.StreamOnlyServiceChildChild {}
126 changes: 126 additions & 0 deletions thrift_streaming/kitex_gen/combine_extend/a/a.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions thrift_streaming/kitex_gen/combine_extend/a/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions thrift_streaming/kitex_gen/combine_extend/a/invoker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions thrift_streaming/kitex_gen/combine_extend/a/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 41bc566

Please sign in to comment.