Skip to content

Commit

Permalink
Test for listening port being chosen randomly (#134).
Browse files Browse the repository at this point in the history
  • Loading branch information
burghardt committed Jul 2, 2024
1 parent fcf56a2 commit c64b962
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/port_randomness.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bats

load teardown setup

@test "two runs to check listening port randomness" {
run ../easy-wg-quick
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 3 ]]
RANDOM_PORT_1ST="$(grep ListenPort wghub.conf | awk '{ print $3 }')"
teardown
run ../easy-wg-quick
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 3 ]]
RANDOM_PORT_2ND="$(grep ListenPort wghub.conf | awk '{ print $3 }')"
[[ "${RANDOM_PORT_1ST}" -ne "${RANDOM_PORT_2ND}" ]]
}

0 comments on commit c64b962

Please sign in to comment.