Skip to content

Commit

Permalink
tests: Add gen-key test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuesch committed Dec 30, 2024
1 parent f0735b5 commit 4f65fe9
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,25 @@ cargo_clippy()
cargo clippy --tests -- --deny warnings || die "cargo clippy --tests failed"
}

run_tests()
run_tests_genkey()
{
info "### Running test: gen-key ###"

local conf="$testdir/conf/udp.conf"

local res="$("$target/letmein" --config "$conf" gen-key --user 12345678)"

local user="$(echo "$res" | cut -d'=' -f1 | cut -d' ' -f1)"
local key="$(echo "$res" | cut -d'=' -f2 | cut -d' ' -f2)"

[ "$user" = "12345678" ] || die "Got invalid user"
}

run_tests_knock()
{
local test_type="$1"

info "### Running test: $test_type ###"
info "### Running test: knock $test_type ###"

rm -rf "$rundir"
local conf="$testdir/conf/$test_type.conf"
Expand Down Expand Up @@ -177,8 +191,9 @@ trap cleanup EXIT
info "Temporary directory is: $tmpdir"
build_project
cargo_clippy
run_tests tcp
run_tests udp
run_tests_genkey
run_tests_knock tcp
run_tests_knock udp
info "All tests Ok."

# vim: ts=4 sw=4 expandtab

0 comments on commit 4f65fe9

Please sign in to comment.