Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use reliable upstream server #1099

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: "1.20"
- uses: actions/cache@v2
with:
path: ~/go/bin/oathkeeper
key: oathkeeper-${{ hashFiles('~/go/bin/oathkeeper') }}
- run: |
make install
go version -m $(which oathkeeper) | grep "\w*build"
./test/${{ matrix.name }}/run.sh

docs-cli:
Expand Down
19 changes: 8 additions & 11 deletions test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,29 @@ killall oathkeeper || true
killall okapi || true
killall okclient || true

OATHKEEPER="go run ../.."
OKAPI="go run ./okapi"
OKCLIENT="go run ./okclient"

export OATHKEEPER_PROXY=http://127.0.0.1:6660
export OATHKEEPER_API=http://127.0.0.1:6661
export GO111MODULE=on

[[ "$(command -v oathkeeper)" == "" ]] &&
(cd ../../; make install)

$OATHKEEPER --config ./config.yml serve > ./oathkeeper.e2e.log 2>&1 &
PORT=6662 $OKAPI > ./api.e2e.log 2>&1 &
go build -o . ../..
./oathkeeper --config ./config.yml serve > ./oathkeeper.e2e.log 2>&1 &
PORT=6662 go run ./okapi > ./api.e2e.log 2>&1 &

waitport 6660
waitport 6661
waitport 6662

function finish {
echo ::group::Oathkeeper Log
cat ./oathkeeper.e2e.log
echo "-----"
echo ::endgroup::
echo ::group::OK API Log
cat ./api.e2e.log
echo ::endgroup::
}
trap finish EXIT

$OKCLIENT
go run ./okclient

kill %1 || true
kill %2 || true
Expand Down
3 changes: 2 additions & 1 deletion test/forwarded-header/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ run_oathkekeper() {
export OATHKEEPER_PROXY=http://127.0.0.1:6060
export OATHKEEPER_API=http://127.0.0.1:6061

LOG_LEVEL=debug go run ../.. --config ./config.yaml serve > ./oathkeeper.log 2>&1 &
go build -o . ../..
LOG_LEVEL=debug ./oathkeeper --config ./config.yaml serve > ./oathkeeper.log 2>&1 &

waitport 6060
waitport 6061
Expand Down
3 changes: 2 additions & 1 deletion test/reload/rules.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"id": "test-rule-1",
"upstream": {
"url": "https://httpbin.org/anything/"
"url": "https://example.com/",
"strip_path": "/rules"
},
"match": {
"url": "http://127.0.0.1:6060/rules",
Expand Down
3 changes: 2 additions & 1 deletion test/reload/rules.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"id": "test-rule-1",
"upstream": {
"url": "https://httpbin.org/anything/"
"url": "https://example.com/",
"strip_path": "/rules"
},
"match": {
"url": "http://127.0.0.1:6060/rules",
Expand Down
3 changes: 2 additions & 1 deletion test/reload/rules.3.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"id": "test-rule-2",
"upstream": {
"url": "https://httpbin.org/anything/"
"url": "https://example.com/",
"strip_path": "/other-rules"
},
"match": {
"url": "http://127.0.0.1:6060/other-rules",
Expand Down
3 changes: 2 additions & 1 deletion test/reload/rules.3.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"id": "test-rule-2",
"upstream": {
"url": "https://httpbin.org/anything/"
"url": "https://example.com/",
"strip_path": "/other-rules"
},
"match": {
"url": "http://127.0.0.1:6060/other-rules",
Expand Down
10 changes: 6 additions & 4 deletions test/reload/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ export OATHKEEPER_PROXY=http://127.0.0.1:6060
export OATHKEEPER_API=http://127.0.0.1:6061
export GO111MODULE=on

[[ "$(command -v oathkeeper)" == "" ]] &&
(cd ../../; make install)

cp config.1.yaml config.yaml

LOG_LEVEL=debug oathkeeper --config ./config.yaml serve >> ./oathkeeper.log 2>&1 &
go build -o . ../..
LOG_LEVEL=debug ./oathkeeper --config ./config.yaml serve > ./oathkeeper.log 2>&1 &

waitport 6060
waitport 6061

function finish {
killall oathkeeper || true
echo ::group::Config
cat ./config.yaml
cat ./rules.3.json || true
echo ::endgroup::
echo ::group::Log
cat ./oathkeeper.log
echo ::endgroup::
}
trap finish EXIT

Expand Down