From ac627aacf00c2f888f21c6f108931dea38260f73 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 3 Sep 2013 15:09:39 +0200 Subject: reorganized directory layout --- git/superproject-post-push.sh | 38 ++++++++++++++++++++++ superproject-post-push.sh | 38 ---------------------- test-postmap.sh | 17 ---------- test-swaks.sh | 73 ------------------------------------------- tests/test-postmap.sh | 17 ++++++++++ tests/test-swaks.sh | 73 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 128 insertions(+), 128 deletions(-) create mode 100755 git/superproject-post-push.sh delete mode 100755 superproject-post-push.sh delete mode 100755 test-postmap.sh delete mode 100755 test-swaks.sh create mode 100755 tests/test-postmap.sh create mode 100755 tests/test-swaks.sh diff --git a/git/superproject-post-push.sh b/git/superproject-post-push.sh new file mode 100755 index 0000000..d680a94 --- /dev/null +++ b/git/superproject-post-push.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# how to use: +# put all of this in some directory (eg. /home/micah/bin/superproject-post-push.sh) and then do this in the git submodule directory: +# micah@minnow:~/leap/puppet/modules/apt$ git config alias.xpush "push && /home/micah/bin/superproject-post-push.sh" + +# use git xpush for pushing + +# this assumes a couple things: +# 1. you do the commit in the top level of the submodule (not any subdirectory within) +# 2. you have no local, uncomitted changes in your superproject when you do any submodule commit + +# exit on any error +set -e + +# change this variable to your superproject checkout +superproject=${HOME}/leap/puppet + +submodule_base=`basename $PWD` +submodule=${submodule_base#puppet_} + +# check out the latest version of the superproject +# note: this part is fragile, because if you have local, uncomitted changes in your superproject, then this pull will fail +cd ${superproject} +git pull +git submodule update --init + +# check out latest version of submodule +# according to https://we.riseup.net/riseup+tech/puppet-git-submodules +cd ${superproject}/modules/${submodule} +git remote update +git merge origin/master + +# commit and push the submodule update commit +cd .. +git add $submodule +git commit -m "automatic update of submodule $submodule_base" +git push diff --git a/superproject-post-push.sh b/superproject-post-push.sh deleted file mode 100755 index d680a94..0000000 --- a/superproject-post-push.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -# how to use: -# put all of this in some directory (eg. /home/micah/bin/superproject-post-push.sh) and then do this in the git submodule directory: -# micah@minnow:~/leap/puppet/modules/apt$ git config alias.xpush "push && /home/micah/bin/superproject-post-push.sh" - -# use git xpush for pushing - -# this assumes a couple things: -# 1. you do the commit in the top level of the submodule (not any subdirectory within) -# 2. you have no local, uncomitted changes in your superproject when you do any submodule commit - -# exit on any error -set -e - -# change this variable to your superproject checkout -superproject=${HOME}/leap/puppet - -submodule_base=`basename $PWD` -submodule=${submodule_base#puppet_} - -# check out the latest version of the superproject -# note: this part is fragile, because if you have local, uncomitted changes in your superproject, then this pull will fail -cd ${superproject} -git pull -git submodule update --init - -# check out latest version of submodule -# according to https://we.riseup.net/riseup+tech/puppet-git-submodules -cd ${superproject}/modules/${submodule} -git remote update -git merge origin/master - -# commit and push the submodule update commit -cd .. -git add $submodule -git commit -m "automatic update of submodule $submodule_base" -git push diff --git a/test-postmap.sh b/test-postmap.sh deleted file mode 100755 index 460e26b..0000000 --- a/test-postmap.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -test_postmap () { - echo -n "get $1, port 2244:" - postmap -v -q $1 tcp:localhost:2244 2>&1 |grep recv: - echo -n "get $1, port 4242:" - postmap -v -q $1 tcp:localhost:4242 2>&1 |grep recv: - echo -} - -test_postmap dummy -test_postmap dummy@dev.bitmask.net -test_postmap dummy@nowhe.re - -test_postmap fooooo -test_postmap fooooo@dev.bitmask.net -test_postmap fooooo@nowhe.re diff --git a/test-swaks.sh b/test-swaks.sh deleted file mode 100755 index 9f521b9..0000000 --- a/test-swaks.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -local='dummy@bitmask.net' -nobody_local='fooooooo@bitmask.net' -external='dummy@leap.se' -server='leech.bitmask.net' -exit_code=0 - -# override $server with possible exported shell var -[ $SWAKS_SERVER ] && server=$SWAKS_SERVER - -swaks_options="--timeout 5 --server $server --hide-informational --suppress-data" -swaks_auth="--tlsc --tls-cert $HOME/leap/test/certs/cert.crt --tls-key $HOME/leap/test/certs/cert.key" - -echo "swaks_options: $swaks_options" -echo "swaks_auth : $swaks_auth" -echo - -test_swaks() { - local from=$1 - shift - local to=$1 - shift - local expected_repsonse_code=$1 - shift - local options="$@" - - response=`swaks -f $from -t $to $options | tail -3 | head -1` - response_code=`echo "$response"| cut -d' ' -f 2-|sed 's/^ //g'|cut -d' ' -f 1 ` - if [ "$response_code" == "$expected_repsonse_code" ] - then - echo -n 'OK: ' - else - echo -n 'WARNING: ' - exit_code=1 - fi - - [[ "$options" == *--tls* ]] && authentication='authenticated ' || authentication='no authentication' - [ ] - echo "From $from, to $to, $authentication: $response" -} - - -test_delivery() { - local from=$1 - local to=$2 - local unauth_repsonse_code=$3 - local auth_response_code=$4 - - test_swaks $from $to $unauth_repsonse_code $swaks_options - test_swaks $from $to $auth_response_code $swaks_options $swaks_auth - - echo -} - - -test_delivery $local $local 250 250 -test_delivery $local $nobody_local 550 550 -test_delivery $local $external 554 250 - -echo - -test_delivery $nobody_local $local 250 250 -test_delivery $nobody_local $nobody_local 550 550 -test_delivery $nobody_local $external 554 250 - -echo - -test_delivery $external $local 250 250 -test_delivery $external $nobody_local 550 550 -test_delivery $external $external 554 250 - -exit $exit_code diff --git a/tests/test-postmap.sh b/tests/test-postmap.sh new file mode 100755 index 0000000..460e26b --- /dev/null +++ b/tests/test-postmap.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test_postmap () { + echo -n "get $1, port 2244:" + postmap -v -q $1 tcp:localhost:2244 2>&1 |grep recv: + echo -n "get $1, port 4242:" + postmap -v -q $1 tcp:localhost:4242 2>&1 |grep recv: + echo +} + +test_postmap dummy +test_postmap dummy@dev.bitmask.net +test_postmap dummy@nowhe.re + +test_postmap fooooo +test_postmap fooooo@dev.bitmask.net +test_postmap fooooo@nowhe.re diff --git a/tests/test-swaks.sh b/tests/test-swaks.sh new file mode 100755 index 0000000..9f521b9 --- /dev/null +++ b/tests/test-swaks.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +local='dummy@bitmask.net' +nobody_local='fooooooo@bitmask.net' +external='dummy@leap.se' +server='leech.bitmask.net' +exit_code=0 + +# override $server with possible exported shell var +[ $SWAKS_SERVER ] && server=$SWAKS_SERVER + +swaks_options="--timeout 5 --server $server --hide-informational --suppress-data" +swaks_auth="--tlsc --tls-cert $HOME/leap/test/certs/cert.crt --tls-key $HOME/leap/test/certs/cert.key" + +echo "swaks_options: $swaks_options" +echo "swaks_auth : $swaks_auth" +echo + +test_swaks() { + local from=$1 + shift + local to=$1 + shift + local expected_repsonse_code=$1 + shift + local options="$@" + + response=`swaks -f $from -t $to $options | tail -3 | head -1` + response_code=`echo "$response"| cut -d' ' -f 2-|sed 's/^ //g'|cut -d' ' -f 1 ` + if [ "$response_code" == "$expected_repsonse_code" ] + then + echo -n 'OK: ' + else + echo -n 'WARNING: ' + exit_code=1 + fi + + [[ "$options" == *--tls* ]] && authentication='authenticated ' || authentication='no authentication' + [ ] + echo "From $from, to $to, $authentication: $response" +} + + +test_delivery() { + local from=$1 + local to=$2 + local unauth_repsonse_code=$3 + local auth_response_code=$4 + + test_swaks $from $to $unauth_repsonse_code $swaks_options + test_swaks $from $to $auth_response_code $swaks_options $swaks_auth + + echo +} + + +test_delivery $local $local 250 250 +test_delivery $local $nobody_local 550 550 +test_delivery $local $external 554 250 + +echo + +test_delivery $nobody_local $local 250 250 +test_delivery $nobody_local $nobody_local 550 550 +test_delivery $nobody_local $external 554 250 + +echo + +test_delivery $external $local 250 250 +test_delivery $external $nobody_local 550 550 +test_delivery $external $external 554 250 + +exit $exit_code -- cgit v1.2.3