From 4f65fe9cf1046a07a869b83cce8dcd0fe2795f92 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 30 Dec 2024 20:40:24 +0100 Subject: [PATCH] tests: Add gen-key test --- tests/run-tests.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 3bb0882..aab1b58 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -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" @@ -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