mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-20 22:09:09 +00:00
Run tests with GitHub actions
This commit is contained in:
parent
e509a81d67
commit
5cbb13247f
4 changed files with 36 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
on: [push, pull_request]
|
||||
|
||||
name: Code Formatting
|
||||
name: Build and Formatting Tests
|
||||
|
||||
jobs:
|
||||
check:
|
27
.github/workflows/tests.yml
vendored
Normal file
27
.github/workflows/tests.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
on:
|
||||
pull_request_review:
|
||||
types: [submitted]
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
name: Integration Tests
|
||||
|
||||
jobs:
|
||||
proxy_tests:
|
||||
name: Proxy Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --no-run
|
||||
- env:
|
||||
SOCKS5_SERVER: ${{ secrets.SOCKS5_SERVER }}
|
||||
HTTP_SERVER: ${{ secrets.HTTP_SERVER }}
|
||||
run: sudo -E find -wholename './target/debug/deps/proxy-*' -executable -exec "{}" \;
|
|
@ -20,4 +20,3 @@ nix = { version = "0.26", features = ["process", "signal"] }
|
|||
prctl = "1.0"
|
||||
reqwest = { version = "0.11", features = ["blocking", "json"] }
|
||||
serial_test = "1.0"
|
||||
test-with = "0.9"
|
||||
|
|
|
@ -148,15 +148,21 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
fn require_var(var: &str) {
|
||||
env::var(var).expect(format!("{var} environment variable required").as_str());
|
||||
}
|
||||
|
||||
#[serial]
|
||||
#[test_with::env(SOCKS5_SERVER)]
|
||||
#[test]
|
||||
fn test_socks5() {
|
||||
require_var("SOCKS5_SERVER");
|
||||
run_test(|test| test.proxy.proxy_type == ProxyType::Socks5)
|
||||
}
|
||||
|
||||
#[serial]
|
||||
#[test_with::env(HTTP_SERVER)]
|
||||
#[test]
|
||||
fn test_http() {
|
||||
require_var("HTTP_SERVER");
|
||||
run_test(|test| test.proxy.proxy_type == ProxyType::Http)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue