Skip to content

Commit

Permalink
[ISSUE #171]Integration Test with nacos-server (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm committed Sep 18, 2023
1 parent 0049628 commit 2d94382
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,34 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: cargo fmt
run: cargo fmt -- --check --color ${{ env.CARGO_TERM_COLOR }}
- name: cargo clippy
run: cargo clippy -- -W warnings

regression-test:
runs-on: ubuntu-latest
steps:
- run: echo "Get latest nacos from docker hub"
- run: docker --version
- run: sudo docker pull nacos/nacos-server:latest
- run: sudo docker run --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:latest
- run: sudo apt install -y protobuf-compiler libprotobuf-dev
- name: Check out repository code
uses: actions/checkout@v3
- run: cargo --version --verbose
- run: rustc --version --verbose
- name: format check
run: cargo fmt --check
- name: unit test
run: cargo test --all-targets
- run: cargo run --example simple_app

build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
Expand Down
6 changes: 4 additions & 2 deletions examples/simple_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use nacos_sdk::api::naming::{
};
use nacos_sdk::api::props::ClientProps;

const NACOS_ADDRESS: &str = "127.0.0.1:8848";

/// enable https auth run with command:
/// cargo run --example simple_app --features default,tls
#[tokio::main]
Expand All @@ -19,7 +21,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.init();

let client_props = ClientProps::new()
.server_addr("0.0.0.0:8848")
.server_addr(NACOS_ADDRESS)
// .remote_grpc_port(9838)
// Attention! "public" is "", it is recommended to customize the namespace with clear meaning.
.namespace("")
Expand Down Expand Up @@ -84,7 +86,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Err(err) => tracing::error!("naming get_all_instances error {:?}", err),
}

tokio::time::sleep(tokio::time::Duration::from_secs(300)).await;
tokio::time::sleep(tokio::time::Duration::from_millis(300)).await;

Ok(())
}
Expand Down

0 comments on commit 2d94382

Please sign in to comment.