Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: streamx integration tests #105

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ protoc --go-grpc_out=grpc_gen/. ./idl/grpc_demo_2.proto

# generate thrift streaming code
LOCAL_REPO=$LOCAL_REPO ./thrift_streaming/generate.sh
# generate thrift streaming code with streamx mode
cd ./streamx && rm -rf ./kitex_gen && kitex_cmd -streamx -I idl ./idl/echo.thrift && kitex_cmd -streamx -I idl ./idl/echo.proto && cd -

echo -e "\ngenerating code for testing ... done\n"

Expand Down Expand Up @@ -162,13 +164,15 @@ export GOMAXPROCS=$(( $nproc / 2 ))
echo -e "\nrunning tests ... \n"

if [[ -n $LOCAL_REPO ]]; then
go test -failfast -covermode=atomic -coverprofile=${LOCAL_REPO}/coverage.txt -coverpkg=github.com/cloudwego/kitex/... ./...
go test -failfast -covermode=atomic -coverprofile=${LOCAL_REPO}/coverage.txt.tmp -coverpkg=github.com/cloudwego/kitex/... ./...
if [[ "$OSTYPE" =~ ^darwin ]]; # remove `mode: atomic` line
then
sed -i '' 1d ${LOCAL_REPO}/coverage.txt
sed -i '' 1d ${LOCAL_REPO}/coverage.txt.tmp
else
sed -i '1d' ${LOCAL_REPO}/coverage.txt
sed -i '1d' ${LOCAL_REPO}/coverage.txt.tmp
fi
cat ${LOCAL_REPO}/coverage.txt.tmp >> ${LOCAL_REPO}/coverage.txt
rm ${LOCAL_REPO}/coverage.txt.tmp
else
go test -failfast ./...
fi
Expand Down
40 changes: 40 additions & 0 deletions streamx/idl/echo.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.
*/
syntax = "proto3";

option go_package = "echopb";

package echopb;

service TestService {
rpc Unary (EchoClientRequest) returns (EchoClientResponse) {}
rpc EchoBidi (stream EchoClientRequest) returns (stream EchoClientResponse){}
rpc EchoClient (stream EchoClientRequest) returns (EchoClientResponse){}
rpc EchoServer (EchoClientRequest) returns (stream EchoClientResponse){}
}

service EmptyService {

}

message EchoClientRequest {
string message = 1;
}

message EchoClientResponse {
string message = 1;
}

21 changes: 21 additions & 0 deletions streamx/idl/echo.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace go echo

struct EchoClientRequest {
1: string Message,
}

struct EchoClientResponse {
1: string Message,
}

service TestService {
EchoClientResponse PingPong(1: EchoClientRequest req)
EchoClientResponse Unary(1: EchoClientRequest req) (streaming.mode="unary"),
EchoClientResponse EchoBidi (1: EchoClientRequest req) (streaming.mode="bidirectional"),
EchoClientResponse EchoClient (1: EchoClientRequest req) (streaming.mode="client"),
EchoClientResponse EchoServer (1: EchoClientRequest req) (streaming.mode="server"),
}

service EmptyService {

}
Loading
Loading