Skip to content

Commit b54aa8b

Browse files
committed
Added integration tests for interface module
1 parent f51dbbe commit b54aa8b

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Build Zond
33
on:
44
release:
55
types: [published]
6+
push:
7+
branches: [ "main" ]
68
pull_request:
79
branches: [ "main" ]
810

@@ -35,13 +37,12 @@ jobs:
3537
Expand-Archive -Path "npcap-sdk.zip" -DestinationPath "npcap-sdk"
3638
echo "LIB=$env:GITHUB_WORKSPACE\npcap-sdk\Lib\x64;$env:LIB" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
3739
40+
- name: Run Tests
41+
run: cargo test --workspace
42+
3843
- name: Build Release Binary
3944
run: cargo build --release
4045

41-
- name: Package Windows Binary
42-
if: matrix.os == 'windows-latest' && github.event_name == 'release'
43-
run: |
44-
powershell Compress-Archive -Path target/release/zond.exe -DestinationPath target/release/zond-windows.zip
4546

4647
- name: Package MacOS Binary
4748
if: matrix.os == 'macos-latest' && github.event_name == 'release'
@@ -73,7 +74,6 @@ jobs:
7374
with:
7475
# The action automatically detects the tag from the release event
7576
files: |
76-
target/release/zond-windows.zip
7777
target/release/zond-macos.zip
7878
target/release/zond-linux.tar.gz
7979
target/release/Zond_Setup.exe

tests/src/discovery/integration.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,23 @@ async fn test_privileged_discovery_netns() {
149149
Err(e) => panic!("Discovery failed: {}", e),
150150
}
151151
}
152+
153+
#[test]
154+
fn test_lan_network_resolution() {
155+
// Assert that the machine running the integration test has at least 1 viable interface
156+
// that resolves via our platform agnostics hooks (macOS networksetup, Linux sysfs, Windows GetIfTable2).
157+
let result = zond_common::net::interface::get_lan_network();
158+
assert!(result.is_ok(), "Expected no OS or Viability errors during interface parsing");
159+
160+
// Virtualized headless CI runners might return None here since they use virtual bridges,
161+
// but the FFI/Syscalls must execute safely regardless!
162+
println!("Resolved LAN network: {:?}", result.unwrap());
163+
}
164+
165+
#[test]
166+
fn test_prioritized_interfaces_resolution() {
167+
let interfaces_res = zond_common::net::interface::get_prioritized_interfaces(10);
168+
assert!(interfaces_res.is_ok());
169+
let interfaces = interfaces_res.unwrap();
170+
assert!(!interfaces.is_empty(), "Expected at least 1 UP, non-loopback network interface on the host natively");
171+
}

0 commit comments

Comments
 (0)