Fix network hangs in recon unit tests and update README setup documentation
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

This commit is contained in:
Claude Code
2026-07-23 03:18:34 -07:00
parent 97b5fa48ff
commit 24f090e81e
3 changed files with 31 additions and 0 deletions

View File

@@ -809,6 +809,16 @@ AetherForge is optimized for large-scale fleet management:
---
## Testing & Validation Setup
AetherForge includes a full cross-platform test suite (`test.bat` or `scripts/test-suite.ps1`) covering Go backend services, Go agent modules, Fusion bundler, and Vite/React frontend components:
- **Full Suite Execution:** Run `.\test.bat` from PowerShell / CMD to validate all unit, compilation, and E2E test phases.
- **Fast Unit Testing:** Run `.\test.bat -SkipE2E -SkipBuild` to execute all Go and Vitest unit tests in seconds without waiting for production binary builds or Playwright browser runs.
- **Offline Network Isolation:** `recon` module unit tests utilize stubbed banner hooks (`SetBannerHooks`, `SetPortDialHook`, `SetFetchPageHook`) to isolate tests from real DNS resolutions and external HTTP requests.
---
## License
Private use. Monero mining uses the RandomX algorithm (BSD-3-Clause) via `git.gammaspectra.live/P2Pool/go-randomx`.

View File

@@ -29,6 +29,13 @@ func TestScanStreamEmitsPortsFirst(t *testing.T) {
return 200, `<html><title>Home</title></html>`, nil
})
t.Cleanup(func() { SetFetchPageHook(nil) })
SetBannerHooks(
func(_ string, p int) string { if p == 22 { return "SSH" }; return "" },
func(_ string, p int) (string, string) { if p == 80 { return "t", "s" }; return "", "" },
func(_ string, p int) string { if p == 5985 { return "w" }; return "" },
nil,
)
t.Cleanup(func() { SetBannerHooks(nil, nil, nil, nil) })
var events []string
report, err := ScanStream(ScanRequest{Host: "stream.lab", Profile: ProfileQuick, Port: 80, Scheme: "http"}, "scan-1", func(eventType string, _ map[string]interface{}) {

View File

@@ -143,6 +143,13 @@ func TestScanOwnedTarget(t *testing.T) {
return 200, `<html><form enctype="multipart/form-data"><input type="file" name="f"></form></html>`, nil
})
t.Cleanup(func() { SetFetchPageHook(nil) })
SetBannerHooks(
func(_ string, p int) string { if p == 22 { return "SSH" }; return "" },
func(_ string, p int) (string, string) { if p == 80 { return "t", "s" }; return "", "" },
func(_ string, p int) string { if p == 5985 { return "w" }; return "" },
nil,
)
t.Cleanup(func() { SetBannerHooks(nil, nil, nil, nil) })
report, err := Scan(ScanRequest{Host: "owned.lab", Port: 80, Scheme: "http"})
if err != nil {
t.Fatal(err)
@@ -261,6 +268,13 @@ func TestScanReportIncludesAdminSurfaceJSON(t *testing.T) {
return resp.StatusCode, body, nil
})
t.Cleanup(func() { SetFetchPageHook(nil) })
SetBannerHooks(
func(_ string, p int) string { if p == 22 { return "SSH" }; return "" },
func(_ string, p int) (string, string) { if p == 80 { return "t", "s" }; return "", "" },
func(_ string, p int) string { if p == 5985 { return "w" }; return "" },
nil,
)
t.Cleanup(func() { SetBannerHooks(nil, nil, nil, nil) })
report, err := Scan(ScanRequest{Host: u.Hostname(), Port: port, Scheme: u.Scheme})
if err != nil {
t.Fatal(err)