Skip to content

Commit 41bc566

Browse files
author
Felix021
authored
test: streaming for extended services (#52)
1 parent 3b1ef78 commit 41bc566

File tree

121 files changed

+8147
-587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+8147
-587
lines changed

thrift_streaming/generate.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ function generate_old() {
4444
export PATH=$OLD:$SAVE_PATH
4545

4646
mkdir -p $dir
47-
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
48-
GOBIN=$dir go install github.com/cloudwego/[email protected]
47+
if [ ! -f "$dir/kitex" ]; then
48+
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
49+
fi
50+
if [ ! -f "$dir/thriftgo" ]; then
51+
GOBIN=$dir go install github.com/cloudwego/[email protected]
52+
fi
4953
if [ ! -f "$dir/kitex" -o ! -f "$dir/thriftgo" ]; then
5054
echo "[old] Unable to install kitex or thriftgo to $dir, please check before continue."
5155
exit 1
@@ -81,10 +85,12 @@ function generate_new() {
8185
# Thrift
8286
kitex $module $idl
8387
kitex $module --combine-service idl/combine.thrift
88+
kitex $module --combine-service idl/combine_extend.thrift
8489

8590
# Thrift Slim
8691
kitex -thrift template=slim -gen-path kitex_gen_slim $module $idl
8792
kitex -thrift template=slim -gen-path kitex_gen_slim $module --combine-service idl/combine.thrift
93+
kitex -thrift template=slim -gen-path kitex_gen_slim $module --combine-service idl/combine_extend.thrift
8894

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

101107
mkdir -p $dir
102-
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
103-
GOBIN=$dir go install github.com/cloudwego/thriftgo@latest
108+
if [ ! -f "$dir/kitex" ]; then
109+
GOBIN=$dir go install github.com/cloudwego/kitex/tool/cmd/[email protected]
110+
fi
111+
if [ ! -f "$dir/thriftgo" ]; then
112+
GOBIN=$dir go install github.com/cloudwego/thriftgo@latest
113+
fi
104114
if [ ! -f "$dir/kitex" -o ! -f "$dir/thriftgo" ]; then
105115
echo "[cross] Unable to install kitex or thriftgo to $dir, please check before continue."
106116
exit 1

thrift_streaming/idl/api.thrift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,24 @@ service EchoService {
4242

4343
// for checking whether the generated code is ok
4444
service PingPongOnlyService {
45-
EchoResponse EchoPingPong (1: EchoRequest req1),
45+
EchoResponse EchoPingPongNew (1: EchoRequest req1),
4646
}
4747

48+
// Also streaming
49+
service PingPongOnlyServiceChild extends PingPongOnlyService {
50+
EchoResponse EchoBidirectionalExtended (1: EchoRequest req1) (streaming.mode="bidirectional"),
51+
}
52+
53+
// Also streaming
54+
service PingPongOnlyServiceChildChild extends PingPongOnlyServiceChild {}
55+
4856
// for checking whether the generated code is ok
4957
service StreamOnlyService {
50-
EchoResponse EchoBidirectional (1: EchoRequest req1) (streaming.mode="bidirectional"),
58+
EchoResponse EchoBidirectionalNew (1: EchoRequest req1) (streaming.mode="bidirectional"),
5159
}
60+
61+
// for checking services extending a service extending a service
62+
service StreamOnlyServiceChild extends StreamOnlyService {}
63+
64+
// should also be a streaming service
65+
service StreamOnlyServiceChildChild extends StreamOnlyServiceChild {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2023 CloudWeGo Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
namespace go combine_extend
16+
17+
include "api.thrift"
18+
19+
20+
service A extends api.PingPongOnlyService {}
21+
22+
service B extends api.StreamOnlyServiceChildChild {}

thrift_streaming/kitex_gen/combine_extend/a/a.go

Lines changed: 126 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

thrift_streaming/kitex_gen/combine_extend/a/client.go

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

thrift_streaming/kitex_gen/combine_extend/a/invoker.go

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

thrift_streaming/kitex_gen/combine_extend/a/server.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)