Skip to content

Commit

Permalink
Merge pull request #141 from burghardt/port_randomness_test
Browse files Browse the repository at this point in the history
Test for listening port being chosen randomly (#134).
  • Loading branch information
burghardt authored Jul 2, 2024
2 parents fcf56a2 + c64b962 commit 96a3615
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 96a3615

Please sign in to comment.