diff --git a/go.mod b/go.mod index af189c1659..6fa97a7889 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( github.com/ory/herodot v0.6.2 github.com/ory/ladon v1.0.1 github.com/ory/viper v1.5.6 - github.com/ory/x v0.0.79 + github.com/ory/x v0.0.80 github.com/pborman/uuid v1.2.0 github.com/pelletier/go-toml v1.6.0 // indirect github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 diff --git a/go.sum b/go.sum index c2b38b844e..ad1472376a 100644 --- a/go.sum +++ b/go.sum @@ -521,8 +521,8 @@ github.com/ory/ladon v1.0.1/go.mod h1:1VhCA2mBtaMhRUS6VS0d9qrNVDQnFXqSRb5D0NvQUP github.com/ory/pagination v0.0.1/go.mod h1:d1ToRROAUleriPhmb2dYbhANhhLwZ8s395m2yJCDFh8= github.com/ory/viper v1.5.6 h1:w4ceGgWwWLzAFYQ7bHaDZmwNsAto2JPVdyQjQnn7VWI= github.com/ory/viper v1.5.6/go.mod h1:TYmpFpKLxjQwvT4f0QPpkOn4sDXU1kDgAwJpgLYiQ28= -github.com/ory/x v0.0.79 h1:epo/41vLUB/GdgJ1qNxKK7hYqzCUu1GpKVsAGUu9EA0= -github.com/ory/x v0.0.79/go.mod h1:WVlPrVNe4wtPfdXqE6B+x7a7xoTR2EFGIGxZTPdAuxw= +github.com/ory/x v0.0.80 h1:Gv8puLh2Yn3cyx0k9vweQSfoR+xwgQAPQotkqX43Rjo= +github.com/ory/x v0.0.80/go.mod h1:WVlPrVNe4wtPfdXqE6B+x7a7xoTR2EFGIGxZTPdAuxw= github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 95a3b1d262..2341deb7b8 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -3,7 +3,17 @@ set -euxo pipefail waitport() { - while ! nc -z localhost $1 ; do sleep 1 ; done + i=0 + while ! nc -z localhost "$1" ; do + sleep 1 + if [ $i -gt 10 ]; then + cat ./oathkeeper.e2e.log + echo "-----" + cat ./api.e2e.log + exit 1 + fi + i=$((i+1)) + done } cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" @@ -27,7 +37,16 @@ waitport 6660 waitport 6661 waitport 6662 +function finish { + cat ./oathkeeper.e2e.log + echo "-----" + cat ./api.e2e.log +} +trap finish EXIT + okclient kill %1 || true kill %2 || true + +trap - EXIT diff --git a/test/reload/config.1.yaml b/test/reload/config.1.yaml index 8072e7957b..1c500927a3 100644 --- a/test/reload/config.1.yaml +++ b/test/reload/config.1.yaml @@ -5,7 +5,7 @@ serve: port: 6060 access_rules: - repositories: + repositories: [] authenticators: noop: diff --git a/test/reload/config.6.yaml b/test/reload/config.6.yaml index 8072e7957b..1c500927a3 100644 --- a/test/reload/config.6.yaml +++ b/test/reload/config.6.yaml @@ -5,7 +5,7 @@ serve: port: 6060 access_rules: - repositories: + repositories: [] authenticators: noop: diff --git a/test/reload/run.sh b/test/reload/run.sh index ceaabbffd3..1cf95b0355 100755 --- a/test/reload/run.sh +++ b/test/reload/run.sh @@ -3,7 +3,15 @@ set -euxo pipefail waitport() { - while ! nc -z localhost $1 ; do sleep 1 ; done + i=0 + while ! nc -z localhost "$1" ; do + sleep 1 + if [ $i -gt 10 ]; then + cat ./oathkeeper.log + exit 1 + fi + i=$((i+1)) + done } cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" @@ -23,38 +31,44 @@ LOG_LEVEL=debug oathkeeper --config ./config.yaml serve >> ./oathkeeper.log 2>&1 waitport 6060 waitport 6061 -sleep 2 +function finish { + cat ./oathkeeper.log +} +trap finish EXIT + +sleep 5 echo "Executing request against no configured rules -> 404" [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 404 ]] && exit 1 echo "Executing request against a now configured rule -> 200" -cp config.2.yaml config.yaml; sleep 1; [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 200 ]] && exit 1 +cp config.2.yaml config.yaml; sleep 3; [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 200 ]] && exit 1 echo "Executing request against updated rule with deny in it -> 403" -cp config.3.yaml config.yaml; sleep 1; [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 403 ]] && exit 1 +cp config.3.yaml config.yaml; sleep 3; [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 403 ]] && exit 1 echo "Executing request against updated rule with deny deny disabled -> 500" -cp config.4.yaml config.yaml; sleep 1; [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 500 ]] && exit 1 +cp config.4.yaml config.yaml; sleep 3; [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 500 ]] && exit 1 echo "Making sure route to be registered is not available yet -> 404" [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/other-rules -w '%{http_code}') -ne 404 ]] && exit 1 echo "Load another rule set -> all 200" cp rules.3.1.json rules.3.json -cp config.5.yaml config.yaml; sleep 1 +cp config.5.yaml config.yaml; sleep 3 [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 200 ]] && exit 1 [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/other-rules -w '%{http_code}') -ne 200 ]] && exit 1 echo "Make changes to other rule -> should 403" -cp rules.3.2.json rules.3.json; sleep 1 +cp rules.3.2.json rules.3.json; sleep 3 [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 200 ]] && exit 1 [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/other-rules -w '%{http_code}') -ne 403 ]] && exit 1 echo "Remove all configs -> all 404" -cp config.6.yaml config.yaml; sleep 1 +cp config.6.yaml config.yaml; sleep 3 [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/rules -w '%{http_code}') -ne 404 ]] && exit 1 [[ $(curl --silent --output /dev/null -f ${OATHKEEPER_PROXY}/other-rules -w '%{http_code}') -ne 404 ]] && exit 1 kill %1 || true -exit 0 + +trap - EXIT