tests: add test for listener removal

Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
This commit is contained in:
Nicolás A. Ortega Froysa 2023-05-25 16:02:02 +02:00
parent 81351bb97c
commit 144c88d180
27 changed files with 290 additions and 0 deletions

View File

@ -0,0 +1,13 @@
DESCRIPTION="List listeners"
CMD=ctl
URL="/listeners"
METHOD="GET"
#########################
DESCRIPTION="Remove one of the listeners"
CMD=reload
FILE=zproxy_new.cfg
#########################
DESCRIPTION="List listeners"
CMD=ctl
URL="/listeners"
METHOD="GET"

View File

@ -0,0 +1,86 @@
[
{
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "0.0.0.0",
"connections": 0,
"https": false,
"id": 0,
"name": "env",
"pending-connections": 0,
"port": 80,
"services": [
{
"backends": [
{
"2xx-code-hits": 0,
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "10.2.1.1",
"connect-time": "#######",
"connections": 0,
"connections-limit": 0,
"https": false,
"id": "10.2.1.1-80",
"pending-connections": 0,
"port": 80,
"priority": 1,
"response-time": "#######",
"status": "active",
"type": 0,
"nfmark": 0,
"weight": 1
}
],
"name": "default",
"priority": 1,
"sessions": []
}
],
"waf-hits": 0
},
{
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "0.0.0.0",
"connections": 0,
"https": true,
"id": 1,
"name": "env",
"pending-connections": 0,
"port": 443,
"services": [
{
"backends": [
{
"2xx-code-hits": 0,
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "10.2.1.2",
"connect-time": "#######",
"connections": 0,
"connections-limit": 0,
"https": false,
"id": "10.2.1.2-80",
"pending-connections": 0,
"port": 80,
"priority": 1,
"response-time": "#######",
"status": "active",
"type": 0,
"nfmark": 0,
"weight": 1
}
],
"name": "default",
"priority": 1,
"sessions": []
}
],
"waf-hits": 0
}
]

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_1_ctl/response_headers.out.tmp -o test_1_ctl/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/listeners >test_1_ctl/extended.out.tmp 2>test_1_ctl/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,3 @@
{
"result": "ok"
}

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X PATCH --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_2_reload/response_headers.out.tmp -o test_2_reload/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/config >test_2_reload/extended.out.tmp 2>test_2_reload/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,29 @@
[
{
"backends": [
{
"2xx-code-hits": 0,
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "10.2.1.1",
"connect-time": "#######",
"connections": 0,
"connections-limit": 0,
"https": false,
"id": "10.2.1.1-80",
"pending-connections": 0,
"port": 80,
"priority": 1,
"response-time": "#######",
"status": "active",
"type": 0,
"nfmark": 0,
"weight": 1
}
],
"name": "default",
"priority": 1,
"sessions": []
}
]

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_2_reload_dump/response_headers.out.tmp -o test_2_reload_dump/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/listener/0/services >test_2_reload_dump/extended.out.tmp 2>test_2_reload_dump/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,44 @@
[
{
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "0.0.0.0",
"connections": 0,
"https": false,
"id": 0,
"name": "env",
"pending-connections": 0,
"port": 80,
"services": [
{
"backends": [
{
"2xx-code-hits": 0,
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "10.2.1.1",
"connect-time": "#######",
"connections": 0,
"connections-limit": 0,
"https": false,
"id": "10.2.1.1-80",
"pending-connections": 0,
"port": 80,
"priority": 1,
"response-time": "#######",
"status": "active",
"type": 0,
"nfmark": 0,
"weight": 1
}
],
"name": "default",
"priority": 1,
"sessions": []
}
],
"waf-hits": 0
}
]

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_3_ctl/response_headers.out.tmp -o test_3_ctl/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/listeners >test_3_ctl/extended.out.tmp 2>test_3_ctl/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,48 @@
######################################################################
##GLOBAL OPTIONS
User "root"
Group "root"
LogLevel 7
Timeout 45
ConnTO 6
Alive 10
Client 30
ThreadModel dynamic
DHParams "#{TEST_TPL}/dh2048.pem"
ECDHCurve "prime256v1"
ListenHTTP
Name env
Address 0.0.0.0
Port #{PROXY_VPORT}
xHTTP 4
RewriteLocation 1
Service "default"
BackEnd
Address #{BCK_IP_1}
Port 80
End
End
End
ListenHTTPS
Name env
Address 0.0.0.0
Port #{PROXY_VPORT_SSL}
xHTTP 4
RewriteLocation 1
Cert "#{TEST_TPL}/all.pem"
Ciphers "ALL"
Disable SSLv3
SSLHonorCipherOrder 1
Service "default"
BackEnd
Address #{BCK_IP_2}
Port 80
End
End
End

View File

@ -0,0 +1,27 @@
######################################################################
##GLOBAL OPTIONS
User "root"
Group "root"
LogLevel 7
Timeout 45
ConnTO 6
Alive 10
Client 30
ThreadModel dynamic
DHParams "#{TEST_TPL}/dh2048.pem"
ECDHCurve "prime256v1"
ListenHTTP
Name env
Address 0.0.0.0
Port #{PROXY_VPORT}
xHTTP 4
RewriteLocation 1
Service "default"
BackEnd
Address #{BCK_IP_1}
Port 80
End
End
End