Skip to content

Commit 1240d59

Browse files
committed
enable e2e test
Signed-off-by: tison <[email protected]>
1 parent b8fc551 commit 1240d59

File tree

9 files changed

+39
-30
lines changed

9 files changed

+39
-30
lines changed

.github/workflows/test.yaml renamed to .github/workflows/codecov.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: codecov
22
on:
33
pull_request:
44
push:

.github/workflows/e2e.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: agent-test-tool
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
e2e-rust:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
submodules: recursive
18+
- name: Prepare service container
19+
run: docker-compose -f docker-compose.e2e.yml up --build -d
20+
- name: Run e2e
21+
run: |
22+
pip3 install --upgrade pip
23+
pip3 install setuptools
24+
pip3 install -r requirements.txt
25+
python3 tests/e2e/run_e2e.py --expected_file=tests/e2e/data/expected_context.yaml --max_retry_times=3 --target_path=/ping

docker-compose.e2e.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
version: "3.7"
22
services:
33
collector:
4-
build:
5-
context: .
6-
dockerfile: ./tests/e2e/docker/Dockerfile.tool
4+
image: ghcr.io/apache/skywalking-agent-test-tool/mock-collector:5acb890f225ca37ee60675ce3e330545e23e3cbc
75
ports:
86
- 19876:19876
97
- 12800:12800

src/reporter/grpc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl Reporter {
5858
/// let mut context = TracingContext::default("service", "instance");
5959
/// reporter.sender().send(context).await?;
6060
/// reporter.shutdown().await?;
61+
/// Ok(())
6162
/// }
6263
/// ```
6364
pub async fn start(address: impl Into<String>) -> Self {

tests/e2e/Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/e2e/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
name = "e2e"
33
version = "0.1.0"
44
authors = ["Shikugawa <[email protected]>"]
5-
edition = "2018"
6-
7-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
5+
edition = "2021"
86

97
[dependencies]
10-
skywalking_rust = { path = "../../" }
8+
skywalking_rust = { path = "../.." }
119
hyper = { version = "0.14", features = ["full"] }
1210
tokio = { version = "1", features = ["full"] }
1311
structopt = "0.3"

tests/e2e/docker/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
FROM rust:1.50.0
2-
RUN apt update && apt install -y protobuf-compiler
3-
RUN rustup component add rustfmt
1+
FROM rust:1.57.0
42
COPY . /tmp
5-
WORKDIR tmp/tests/e2e
3+
WORKDIR /tmp/tests/e2e

tests/e2e/docker/Dockerfile.tool

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/e2e/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use skywalking_rust::context::propagation::encoder::encode_propagation;
77
use skywalking_rust::context::trace_context::TracingContext;
88
use skywalking_rust::reporter::grpc::Reporter;
99
use std::convert::Infallible;
10+
use std::error::Error;
1011
use std::net::SocketAddr;
1112
use structopt::StructOpt;
1213
use tokio::sync::mpsc;
@@ -123,7 +124,7 @@ struct Opt {
123124
}
124125

125126
#[tokio::main]
126-
async fn main() {
127+
async fn main() -> Result<(), Box<dyn Error>> {
127128
let opt = Opt::from_args();
128129
let reporter = Reporter::start("http://collector:19876").await;
129130
let tx = reporter.sender();
@@ -134,5 +135,6 @@ async fn main() {
134135
run_producer_service([0, 0, 0, 0], tx).await;
135136
}
136137

137-
reporter.shutdown().await.unwarp();
138+
reporter.shutdown().await?;
139+
Ok(())
138140
}

0 commit comments

Comments
 (0)