Skip to content

Commit

Permalink
Merge pull request #72 from wallarm/DEVOPS-2503
Browse files Browse the repository at this point in the history
DEVOPS-2503 Adjust tests for 4.8
  • Loading branch information
nedvna authored Feb 27, 2024
2 parents 4421f63 + 08a68be commit 82a0663
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ jobs:
path: kubernetes-ci
secrets: |
kv-gitlab-ci/data/github/ingress api_token ;
kv-gitlab-ci/data/github/ingress api_host ;
kv-gitlab-ci/data/github/ingress api_preset ;
kv-gitlab-ci/data/github/ingress client_id ;
kv-gitlab-ci/data/github/ingress user_secret ;
kv-gitlab-ci/data/github/ingress user_uuid ;
kv-gitlab-ci/data/github/shared/smoke-tests-registry-creds token_name ;
Expand All @@ -82,4 +85,7 @@ jobs:
USER_UUID: ${{ steps.secrets.outputs.user_uuid }}
USER_SECRET: ${{ steps.secrets.outputs.user_secret }}
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.api_token }}
WALLARM_API_HOST: ${{ steps.secrets.outputs.api_host }}
WALLARM_API_PRESET: ${{ steps.secrets.outputs.api_preset }}
CLIENT_ID: ${{ steps.secrets.outputs.client_id }}
run: make ${{ matrix.case }}
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ REGISTRY := docker.io/wallarm
TAG ?= test
IMAGE ?= $(REGISTRY)/node:$(TAG)
IMAGE_LATEST := $(REGISTRY)/node:latest
NODE_VERSION ?= 4.8.0

COMPOSE_CMD = NODE_IMAGE=$(IMAGE) docker-compose -p $@ -f test/docker-compose.$@.yaml
NODE_UUID = $(COMPOSE_CMD) exec node cat /etc/wallarm/node.yaml | grep uuid | awk '{print $$2}'
Expand Down
2 changes: 2 additions & 0 deletions test/docker-compose.single.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
image: dkr.wallarm.com/tests/smoke-tests:latest
environment:
WALLARM_API_HOST: ${WALLARM_API_HOST}
WALLARM_API_PRESET: ${WALLARM_API_PRESET:-audit}
WALLARM_API_CA_VERIFY: ${WALLARM_API_CA_VERIFY}
CLIENT_ID: ${CLIENT_ID}
USER_UUID: ${USER_UUID}
Expand All @@ -33,6 +34,7 @@ services:
PYTEST_ARGS: ${PYTEST_ARGS}
NODE_BASE_URL: http://node
HOSTNAME_OLD_NODE: smoke-tests-old-node
NODE_VERSION: ${NODE_VERSION}
entrypoint: '/bin/sleep'
command:
- infinity
2 changes: 2 additions & 0 deletions test/docker-compose.split.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
image: dkr.wallarm.com/tests/smoke-tests:latest
environment:
WALLARM_API_HOST: ${WALLARM_API_HOST}
WALLARM_API_PRESET: ${WALLARM_API_PRESET:-audit}
WALLARM_API_CA_VERIFY: ${WALLARM_API_CA_VERIFY}
CLIENT_ID: ${CLIENT_ID}
USER_UUID: ${USER_UUID}
Expand All @@ -47,6 +48,7 @@ services:
PYTEST_ARGS: ${PYTEST_ARGS}
NODE_BASE_URL: http://node
HOSTNAME_OLD_NODE: smoke-tests-old-node
NODE_VERSION: ${NODE_VERSION}
entrypoint: '/bin/sleep'
command:
- infinity
Expand Down
26 changes: 26 additions & 0 deletions test/nginx_conf/nginx_node.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,30 @@ server {
location / {
return 200;
}

location /api-discovery-test {
add_header Api-Discovery-Header "Hello, I am header!";
return 200 '{"json_response": "Hello, I am json"}';
default_type application/json;
}

# Some mocks for test_api_abuse_prevention.py
location /.git {
if ($http_custom_id) {
return 400;
}
return 200;
}
location /admin {
if ($http_custom_id) {
return 401;
}
return 200;
}
location /api/v2 {
if ($http_custom_id) {
return 502;
}
return 200;
}
}
22 changes: 22 additions & 0 deletions test/nginx_conf/wallarm_node.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,26 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /wallarm-mode/monitoring {
wallarm_mode monitoring;
proxy_pass http://nginx:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

# Endpoint for `test_api_abuse_prevention.py` (and any other test, that uses non-default APP_ID)
location /wallarm-application/ {
rewrite ^/wallarm-application(/.*)$ $1 break;
wallarm_application $http_custom_id;
proxy_pass http://nginx:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api-discovery-test {
wallarm_application $http_custom_id;
proxy_pass http://nginx:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

0 comments on commit 82a0663

Please sign in to comment.