mrjackwills / havn

A fast configurable port scanner with reasonable defaults
MIT License
167 stars 5 forks source link

[BUG] Failed to run tests in clean chroot #2

Open orhun opened 4 months ago

orhun commented 4 months ago

Describe the bug

In a clean Arch Linux chroot, I'm getting the following test failures:

failures:

---- terminal::print::tests::test_terminal_monochrome_false stdout ----
thread 'terminal::print::tests::test_terminal_monochrome_false' panicked at src/terminal/mod.rs:328:13:
assertion failed: result.contains("\x1b[33m443")

---- scanner::tests::test_scanner_1000_80_443 stdout ----
thread 'scanner::tests::test_scanner_1000_80_443' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warp-0.3.6/src/server.rs:217:27:
error binding to 127.0.0.1:80: error creating server listener: Permission denied (os error 13)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'scanner::tests::test_scanner_1000_80_443' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warp-0.3.6/src/server.rs:217:27:
error binding to 127.0.0.1:443: error creating server listener: Permission denied (os error 13)
thread 'scanner::tests::test_scanner_1000_80_443' panicked at src/scanner/mod.rs:360:9:
assertion `left == right` failed
  left: 999
 right: 998

---- scanner::tests::test_scanner_1000_empty stdout ----
thread 'scanner::tests::test_scanner_1000_empty' panicked at src/scanner/mod.rs:309:9:
assertion `left == right` failed
  left: 999
 right: 1000

---- scanner::tests::test_scanner_all_80 stdout ----
thread 'scanner::tests::test_scanner_all_80' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warp-0.3.6/src/server.rs:217:27:
error binding to 127.0.0.1:80: error creating server listener: Permission denied (os error 13)
thread 'scanner::tests::test_scanner_all_80' panicked at src/scanner/mod.rs:384:9:
assertion failed: result.contains(&(80, "http"))

failures:
    scanner::tests::test_scanner_1000_80_443
    scanner::tests::test_scanner_1000_empty
    scanner::tests::test_scanner_all_80
    terminal::print::tests::test_terminal_monochrome_false

test result: FAILED. 16 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.76s

error: test failed, to rerun pass `--bin havn`

To Reproduce

Build the Arch Linux package in a clean chroot via extra-x86_64-build.

Expected behavior Successful tests.

Desktop (please complete the following information):

Additional context None

mrjackwills commented 4 months ago

Thanks, I'll investigate.

Is the port 80/443 issue related to not having sudo (and/or root access). If so, I can probably re-jig the tests to make them use all ports over 1000.

edit: Actually that wouldn't make any sense, as other test use these ports and have passed your test run

orhun commented 4 months ago

Yeah, I think they are related to not having root access. The chroot has the builduser in the container and I don't think it has all the permissions. But I will double check to make sure.