~/Projects/openvpn-go
git clone https://code.lsong.org/openvpn-go
Commit
- Commit
- e5f14fd340f1cd2c814bbdb49f67086274204c6e
- Author
- Ain Ghazal <[email protected]>
- Date
- 2022-03-24 21:00:32 +0100 +0100
- Diffstat
Makefile | 13 +++++++++++++ tests/integration/extract.sh | 15 +++++++++------ tests/qa/run-filternet.sh | 3 +--
cosmetic changes
diff --git a/Makefile b/Makefile index bce3f67d29b09b2fd2d23389e71316de9304e649..2ec8e1c609e15d38090784b1411f77b13de76ffc 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,19 @@ ./minivpn -c data/tests/config -t ${LOCAL_TARGET} -n ${COUNT} ping test-local: test-fetch-config test-ping-local +qa: + @# all the steps at once + cd tests/integration && ./run-server.sh & + sleep 5 # 5secs should be enough, increase this if not. + @rm -rf data/tests + @mkdir -p data/tests && curl 172.17.0.2:8080/ > data/tests/config + @cd data/tests && ../../tests/integration/extract.sh config + ./minivpn -c data/tests/config -t 172.17.0.1 -n ${COUNT} ping + @docker stop ovpn1 + +filternet-qa: + cd tests/qa && ./run-filternet.sh + coverage: go test -coverprofile=coverage.out ./vpn go tool cover -html=coverage.out diff --git a/tests/integration/extract.sh b/tests/integration/extract.sh index 9446fd5de566cc8c3b13e26ae585593c9499240e..9c1ec31d79130671ff33fed4dd445a240c1633b0 100755 --- a/tests/integration/extract.sh +++ b/tests/integration/extract.sh @@ -7,8 +7,6 @@ FILE=$1 tail=0 -echo "FILE>>>>" $FILE - # first lets extract the inline blocks # ca block tag=ca @@ -16,7 +14,7 @@ f=ca.crt sed -n "/<$tag>/,/<\/$tag>/p" $FILE > $f n=$(wc -l $f | cut -f 1 -d ' ') tail=$(($tail+n)) -cat $f | tail -n $(($n-1)) | head -n $(($n-2)) | tee $f +cat $f | tail -n $(($n-1)) | head -n $(($n-2)) | tee $f >/dev/null # key block tag=key @@ -24,7 +22,7 @@ f=key.pem sed -n "/<$tag>/,/<\/$tag>/p" $FILE > $f n=$(wc -l $f | cut -f 1 -d ' ') tail=$(($tail+n)) -cat $f | tail -n $(($n-1)) | head -n $(($n-2)) | tee $f +cat $f | tail -n $(($n-1)) | head -n $(($n-2)) | tee $f >/dev/null # cert block tag=cert @@ -32,7 +30,7 @@ f=cert.pem sed -n "/<$tag>/,/<\/$tag>/p" $FILE > $f n=$(wc -l $f | cut -f 1 -d ' ') tail=$(($tail+n)) -cat $f | tail -n $(($n-1)) | head -n $(($n-2)) | tee $f +cat $f | tail -n $(($n-1)) | head -n $(($n-2)) | tee $f >/dev/null # tls-auth (ignored) tag=tls-auth @@ -40,11 +38,16 @@ f=ta.pem sed -n "/<$tag>/,/<\/$tag>/p" $FILE > $f n=$(wc -l $f | cut -f 1 -d ' ') tail=$(($tail+n)) -cat $f | tail -n $(($n-4)) | head -n $(($n-5)) | tee $f +cat $f | tail -n $(($n-4)) | head -n $(($n-5)) | tee $f >/dev/null all=$(wc -l $FILE | cut -f -1 -d ' ') cp $FILE config.bk + +echo "------------------------" +echo "Config file:" +echo "------------------------" head -n $(($all-$tail)) $FILE | tee config +echo "------------------------" # now enable the paths for ca, cert and key sed -i "s/;ca ca.crt/ca ca.crt/g" config diff --git a/tests/qa/run-filternet.sh b/tests/qa/run-filternet.sh index b58857feb9964bbf968d5d28b31538c2af911bbd..77adc1f7b4cf63f3b66e9e0ba5cb92a8bf7d74aa 100755 --- a/tests/qa/run-filternet.sh +++ b/tests/qa/run-filternet.sh @@ -12,5 +12,4 @@ sudo ${FILTERNET} \ --firewall-rule "${DROP_RULE}" \ --user $USER \ #!/bin/sh - - ./minivpn -c data/tests/config -t ${TARGET} -n 3 ping +REMOTE=172.17.0.2 # can grep it from the config file instead