From 65bebaebd8b4e3cc25d9b3ac320e6f8fa28e67eb Mon Sep 17 00:00:00 2001 From: Kyle Manna Date: Wed, 31 Aug 2016 11:53:03 -0700 Subject: [PATCH] test: Migrate conf_options test * Move the configuration options to new docker test suite. --- test/config.sh | 1 + .../tests/conf_options/container.sh | 23 ++++--------------- test/tests/conf_options/run.sh | 1 + 3 files changed, 7 insertions(+), 18 deletions(-) rename tests/openvpn_conf_options.test.sh => test/tests/conf_options/container.sh (66%) mode change 100755 => 100644 create mode 120000 test/tests/conf_options/run.sh diff --git a/test/config.sh b/test/config.sh index 6c4e5d8..81f6ef4 100644 --- a/test/config.sh +++ b/test/config.sh @@ -8,5 +8,6 @@ testAlias+=( imageTests+=( [openvpn]=' paranoid + conf_options ' ) diff --git a/tests/openvpn_conf_options.test.sh b/test/tests/conf_options/container.sh old mode 100755 new mode 100644 similarity index 66% rename from tests/openvpn_conf_options.test.sh rename to test/tests/conf_options/container.sh index 1a0bad5..f7ed45b --- a/tests/openvpn_conf_options.test.sh +++ b/test/tests/conf_options/container.sh @@ -1,16 +1,8 @@ #!/bin/bash -OVPN_DATA=options-data - -IMG=kylemanna/openvpn - # Function to fail abort() { cat <<< "$@" 1>&2; exit 1; } -# -# Create a docker container with the config data -# -sudo docker run --name $OVPN_DATA -v /etc/openvpn busybox # # Generate openvpn.config file @@ -21,7 +13,7 @@ max-clients 10 EOF SERV_IP=$(ip -4 -o addr show scope global | awk '{print $4}' | sed -e 's:/.*::' | head -n1) -sudo docker run --volumes-from $OVPN_DATA --rm $IMG ovpn_genconfig -u udp://$SERV_IP -f 1400 -e "$EXTRA_SERVER_CONF" +ovpn_genconfig -u udp://$SERV_IP -f 1400 -e "$EXTRA_SERVER_CONF" # # grep for config lines from openvpn.conf @@ -30,24 +22,19 @@ sudo docker run --volumes-from $OVPN_DATA --rm $IMG ovpn_genconfig -u udp://$SER # 1. verb config CONFIG_REQUIRED_VERB="verb 3" -CONFIG_MATCH_VERB=$(sudo docker run --rm -it --volumes-from $OVPN_DATA busybox grep verb /etc/openvpn/openvpn.conf) +CONFIG_MATCH_VERB=$(busybox grep verb /etc/openvpn/openvpn.conf) # 2. fragment config CONFIG_REQUIRED_FRAGMENT="fragment 1400" -CONFIG_MATCH_FRAGMENT=$(sudo docker run --rm -it --volumes-from $OVPN_DATA busybox grep fragment /etc/openvpn/openvpn.conf) +CONFIG_MATCH_FRAGMENT=$(busybox grep fragment /etc/openvpn/openvpn.conf) # 3. management config CONFIG_REQUIRED_MANAGEMENT="^management localhost 7505" -CONFIG_MATCH_MANAGEMENT=$(sudo docker run --rm -it --volumes-from $OVPN_DATA busybox grep management /etc/openvpn/openvpn.conf) +CONFIG_MATCH_MANAGEMENT=$(busybox grep management /etc/openvpn/openvpn.conf) # 4. max-clients config CONFIG_REQUIRED_MAX_CLIENTS="^max-clients 10" -CONFIG_MATCH_MAX_CLIENTS=$(sudo docker run --rm -it --volumes-from $OVPN_DATA busybox grep max-clients /etc/openvpn/openvpn.conf) - -# -# Clean up -# -# sudo docker rm -f $OVPN_DATA +CONFIG_MATCH_MAX_CLIENTS=$(busybox grep max-clients /etc/openvpn/openvpn.conf) # # Tests diff --git a/test/tests/conf_options/run.sh b/test/tests/conf_options/run.sh new file mode 120000 index 0000000..2778ad9 --- /dev/null +++ b/test/tests/conf_options/run.sh @@ -0,0 +1 @@ +../run-bash-in-container.sh \ No newline at end of file