Skip to content

Commit 23256d3

Browse files
committed
fix: fix test in protoc async
because of the api change 1. fix the marco in prost 2. fix the test Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
1 parent 5237576 commit 23256d3

File tree

9 files changed

+37
-17
lines changed

9 files changed

+37
-17
lines changed

.github/workflows/bvt.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
- name: Checkout
1212
uses: actions/checkout@v3
1313
- name: Install Protoc
14-
run: |
15-
./install_protoc.sh
14+
run: ./install_protoc.sh
15+
shell: bash
1616
- name: Check
1717
run: |
1818
make deps
@@ -31,8 +31,8 @@ jobs:
3131
- name: Checkout
3232
uses: actions/checkout@v3
3333
- name: Install Protoc
34-
run: |
35-
./install_protoc.sh
34+
run: ./install_protoc.sh
35+
shell: bash
3636
- name: Build
3737
run: |
3838
make

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ example/protocols/**/*.rs
1010
example2/protocols/**/*.rs
1111
!example2/protocols/**/mod.rs
1212
src/ttrpc.rs
13-
example2/protocols/**/*.rs
13+
example2/protocols/**/*.rs
14+
!example2/protocols/**/mod.rs

Makefile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ build: debug
2424
.PHONY: test
2525
test:
2626
ifeq ($OS,Windows_NT)
27-
# async isn't enabled for windows, don't test that feature
28-
cargo test --verbose
27+
cargo test --features sync,async,rustprotobuf
2928
else
3029
# cargo test --all-features --verbose
3130
cargo test --features sync,async,rustprotobuf
@@ -36,11 +35,15 @@ endif
3635
check:
3736
cargo fmt --all -- --check
3837
cargo clippy --all-targets --features sync,async -- -D warnings
38+
# Skip prost check on Windows
39+
ifeq ($(OS),Windows_NT)
40+
@echo "Skipping prost check on Windows"
41+
else
3942
cargo clippy --all-targets --no-default-features --features sync,async,prost -- -D warnings
43+
endif
4044

41-
.PHONY: deps
42-
deps:
43-
rustup update stable
44-
rustup default stable
45-
rustup component add rustfmt clippy
46-
./install_protoc.sh
45+
.PHONY: check-all
46+
check-all:
47+
$(MAKE) check
48+
$(MAKE) -C compiler check
49+
$(MAKE) -C ttrpc-codegen check

example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ description = "An example of ttrpc."
1313
[dev-dependencies]
1414
protobuf = "3.1.0"
1515
bytes = "0.4.11"
16-
libc = "0.2.79"
16+
libc = "0.2.158"
1717
byteorder = "1.3.2"
1818
log = "0.4.6"
1919
simple-logging = "2.0.2"

example2/async_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use ttrpc::r#async::Client;
1212

1313
#[tokio::main(flavor = "current_thread")]
1414
async fn main() {
15-
let c = Client::connect(utils::SOCK_ADDR).unwrap();
15+
let c = Client::connect(utils::SOCK_ADDR).await.unwrap();
1616
let hc = health::HealthClient::new(c.clone());
1717
let ac = agent::AgentServiceClient::new(c);
1818

example2/async_stream_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ttrpc::r#async::Client;
1414
async fn main() {
1515
simple_logging::log_to_stderr(log::LevelFilter::Info);
1616

17-
let c = Client::connect(utils::SOCK_ADDR).unwrap();
17+
let c = Client::connect(utils::SOCK_ADDR).await.unwrap();
1818
let sc = streaming::StreamingClient::new(c);
1919

2020
let _now = std::time::Instant::now();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) 2020 Ant Financial
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
6+
#![allow(dead_code)]
7+
8+
include!("_include.rs");

example2/protocols/sync/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) 2020 Ant Financial
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
6+
#![allow(dead_code)]
7+
8+
include!("_include.rs");

src/asynchronous/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ macro_rules! async_client_stream_receive {
434434
.map_err(::ttrpc::err_to_others!(e, "Encoding error "))?;
435435

436436
let inner = $self.client.new_stream(creq, false, true).await?;
437-
let stream = ::ttrpc::r#async::ClientStreamReceiver::new(inner);
437+
let stream = ::ttrpc::r#async::ClientStreamReceiver::new(inner, $self.client.clone());
438438

439439
return Ok(stream);
440440
};

0 commit comments

Comments
 (0)