tests: client: Add client config test suite
* Test the client configuration to detect breakages
This commit is contained in:
parent
78d612d181
commit
8c9d88b316
@ -9,6 +9,7 @@ imageTests+=(
|
||||
[openvpn]='
|
||||
paranoid
|
||||
conf_options
|
||||
client
|
||||
basic
|
||||
dual-proto
|
||||
otp
|
||||
|
40
test/tests/client/container.sh
Normal file
40
test/tests/client/container.sh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to fail
|
||||
abort() { cat <<< "$@" 1>&2; exit 1; }
|
||||
|
||||
|
||||
#
|
||||
# Generate openvpn.config file
|
||||
#
|
||||
SERV_IP=$(ip -4 -o addr show scope global | awk '{print $4}' | sed -e 's:/.*::' | head -n1)
|
||||
|
||||
ovpn_genconfig \
|
||||
-u udp://$SERV_IP \
|
||||
-m 1337 \
|
||||
|
||||
|
||||
EASYRSA_BATCH=1 EASYRSA_REQ_CN="Travis-CI Test CA" ovpn_initpki nopass
|
||||
|
||||
easyrsa build-client-full test1 nopass 2>/dev/null
|
||||
|
||||
TEST1_OVPN="/etc/openvpn/test1.ovpn"
|
||||
ovpn_getclient test1 > "${TEST1_OVPN}"
|
||||
|
||||
# Check a config (haystack) for a given line (needle) exit with error if not found.
|
||||
test-client-config() {
|
||||
|
||||
local needle="${1}"
|
||||
|
||||
busybox grep -q "${needle}" "${TEST1_OVPN}"
|
||||
if [ $? -ne 0 ]; then
|
||||
abort "==> Config match not found: ${needle}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Test cases
|
||||
#
|
||||
|
||||
# Test 1: Check MTU
|
||||
test-client-config "^tun-mtu\s+1337"
|
1
test/tests/client/run.sh
Symbolic link
1
test/tests/client/run.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../run-bash-in-container.sh
|
Loading…
Reference in New Issue
Block a user