Skip to content

Commit

Permalink
enable e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Jan 13, 2022
1 parent b8fc551 commit 1240d59
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: codecov
on:
pull_request:
push:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: agent-test-tool

on:
pull_request:
push:
branches:
- master
tags:
- 'v*'

jobs:
e2e-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Prepare service container
run: docker-compose -f docker-compose.e2e.yml up --build -d
- name: Run e2e
run: |
pip3 install --upgrade pip
pip3 install setuptools
pip3 install -r requirements.txt
python3 tests/e2e/run_e2e.py --expected_file=tests/e2e/data/expected_context.yaml --max_retry_times=3 --target_path=/ping
4 changes: 1 addition & 3 deletions docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
version: "3.7"
services:
collector:
build:
context: .
dockerfile: ./tests/e2e/docker/Dockerfile.tool
image: ghcr.io/apache/skywalking-agent-test-tool/mock-collector:5acb890f225ca37ee60675ce3e330545e23e3cbc
ports:
- 19876:19876
- 12800:12800
Expand Down
1 change: 1 addition & 0 deletions src/reporter/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl Reporter {
/// let mut context = TracingContext::default("service", "instance");
/// reporter.sender().send(context).await?;
/// reporter.shutdown().await?;
/// Ok(())
/// }
/// ```
pub async fn start(address: impl Into<String>) -> Self {
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions tests/e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
name = "e2e"
version = "0.1.0"
authors = ["Shikugawa <Shikugawa@gmail.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
edition = "2021"

[dependencies]
skywalking_rust = { path = "../../" }
skywalking_rust = { path = "../.." }
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1", features = ["full"] }
structopt = "0.3"
6 changes: 2 additions & 4 deletions tests/e2e/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
FROM rust:1.50.0
RUN apt update && apt install -y protobuf-compiler
RUN rustup component add rustfmt
FROM rust:1.57.0
COPY . /tmp
WORKDIR tmp/tests/e2e
WORKDIR /tmp/tests/e2e
15 changes: 0 additions & 15 deletions tests/e2e/docker/Dockerfile.tool

This file was deleted.

6 changes: 4 additions & 2 deletions tests/e2e/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use skywalking_rust::context::propagation::encoder::encode_propagation;
use skywalking_rust::context::trace_context::TracingContext;
use skywalking_rust::reporter::grpc::Reporter;
use std::convert::Infallible;
use std::error::Error;
use std::net::SocketAddr;
use structopt::StructOpt;
use tokio::sync::mpsc;
Expand Down Expand Up @@ -123,7 +124,7 @@ struct Opt {
}

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

reporter.shutdown().await.unwarp();
reporter.shutdown().await?;
Ok(())
}

0 comments on commit 1240d59

Please sign in to comment.