Skip to content

Commit

Permalink
test: remove http-https-echo docker image (#6639)
Browse files Browse the repository at this point in the history
Co-authored-by: soulbird <zhaothreee@gmail.com>
  • Loading branch information
soulbird and soulbird committed Mar 22, 2022
1 parent a1482dd commit 61890d0
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 79 deletions.
17 changes: 0 additions & 17 deletions ci/pod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,23 +355,6 @@ services:
networks:
nacos_net:


## http_echo
apisix_http_echo:
image: mendhak/http-https-echo
environment:
HTTP_PORT: 8888
HTTPS_PORT: 9999
restart: unless-stopped
ports:
- "8888:8888"
- "9999:9999"
depends_on:
nacos_service_health_check:
condition: service_healthy
networks:
apisix_net:

rocketmq_namesrv:
image: apacherocketmq/rocketmq:4.6.0
container_name: rmqnamesrv
Expand Down
130 changes: 68 additions & 62 deletions t/plugin/http-logger.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ log_level('debug');
repeat_each(1);
no_long_string();
no_root_location();

add_block_preprocessor(sub {
my ($block) = @_;

if ((!defined $block->error_log) && (!defined $block->no_error_log)) {
$block->set_value("no_error_log", "[error]");
}

if (!defined $block->request) {
$block->set_value("request", "GET /t");
}

});

run_tests;

__DATA__
Expand All @@ -37,12 +51,8 @@ __DATA__
ngx.say("done")
}
}
--- request
GET /t
--- response_body
done
--- no_error_log
[error]
Expand All @@ -69,12 +79,8 @@ done
ngx.say("done")
}
}
--- request
GET /t
--- response_body
done
--- no_error_log
[error]
Expand All @@ -99,13 +105,9 @@ done
ngx.say("done")
}
}
--- request
GET /t
--- response_body
property "uri" is required
done
--- no_error_log
[error]
Expand Down Expand Up @@ -143,12 +145,8 @@ done
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
Expand All @@ -173,7 +171,7 @@ Batch Processor[http logger] successfully processed the entries
[[{
"plugins": {
"http-logger": {
"uri": "http://127.0.0.1:8888/hello-world-http",
"uri": "http://127.0.0.1:1982/echo",
"batch_max_size": 1,
"max_retry_count": 1,
"retry_delay": 2,
Expand All @@ -197,12 +195,8 @@ Batch Processor[http logger] successfully processed the entries
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
Expand All @@ -227,7 +221,7 @@ Batch Processor[http logger] successfully processed the entries
[[{
"plugins": {
"http-logger": {
"uri": "https://127.0.0.1:8888/hello-world-http",
"uri": "https://127.0.0.1:1982/echo",
"batch_max_size": 1,
"max_retry_count": 1,
"retry_delay": 2,
Expand All @@ -252,12 +246,8 @@ Batch Processor[http logger] successfully processed the entries
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
Expand All @@ -267,7 +257,7 @@ GET /hello1
--- response_body
hello1 world
--- error_log
failed to perform SSL with host[127.0.0.1] port[8888] handshake failed
failed to perform SSL with host[127.0.0.1] port[1982] handshake failed
--- wait: 1.5
Expand All @@ -282,7 +272,7 @@ failed to perform SSL with host[127.0.0.1] port[8888] handshake failed
[[{
"plugins": {
"http-logger": {
"uri": "https://127.0.0.1:9999/hello-world-http",
"uri": "https://127.0.0.1:1983/echo",
"batch_max_size": 1,
"max_retry_count": 1,
"retry_delay": 2,
Expand All @@ -307,12 +297,8 @@ failed to perform SSL with host[127.0.0.1] port[8888] handshake failed
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
Expand All @@ -337,7 +323,7 @@ Batch Processor[http logger] successfully processed the entries
[[{
"plugins": {
"http-logger": {
"uri": "https://127.0.0.1:9999/hello-world-http",
"uri": "https://127.0.0.1:1983/echo",
"batch_max_size": 2,
"max_retry_count": 1,
"retry_delay": 2,
Expand All @@ -361,12 +347,8 @@ Batch Processor[http logger] successfully processed the entries
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
Expand Down Expand Up @@ -407,7 +389,7 @@ Batch Processor[http logger] successfully processed the entries
[[{
"plugins": {
"http-logger": {
"uri": "http://127.0.0.1:9991/hello-world-http",
"uri": "http://127.0.0.1:9991/echo",
"batch_max_size": 1,
"max_retry_count": 1,
"retry_delay": 2,
Expand All @@ -431,12 +413,8 @@ Batch Processor[http logger] successfully processed the entries
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
Expand Down Expand Up @@ -484,12 +462,8 @@ Batch Processor[http logger] failed to process entries: failed to connect to hos
ngx.say("done")
}
}
--- request
GET /t
--- response_body
done
--- no_error_log
[error]
Expand Down Expand Up @@ -576,8 +550,6 @@ done
ngx.print(body4)
}
}
--- request
GET /t
--- wait: 0.5
--- response_body
passedopentracing
Expand Down Expand Up @@ -616,13 +588,9 @@ sending a batch logs to http://127.0.0.1:1982/hello1
ngx.say("done")
}
}
--- request
GET /t
--- response_body
failed to validate the 'include_resp_body_expr' expression: invalid operator '<>'
done
--- no_error_log
[error]
Expand Down Expand Up @@ -655,12 +623,8 @@ done
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
Expand All @@ -674,7 +638,7 @@ passed
[[{
"plugins": {
"http-logger": {
"uri": "https://127.0.0.1:9999/hello-world-http",
"uri": "https://127.0.0.1:1983/echo",
"batch_max_size": 1,
"max_retry_count": 1,
"retry_delay": 2,
Expand All @@ -698,18 +662,60 @@ passed
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
=== TEST 21: access correct https endpoint but ssl verify failed
--- request
GET /hello1
--- error_log
self signed certificate in certificate chain
certificate host mismatch
--- wait: 3
=== TEST 22: set correct https endpoint and ssl verify false
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/routes/1',
ngx.HTTP_PUT,
[[{
"plugins": {
"http-logger": {
"uri": "https://127.0.0.1:1983/echo",
"batch_max_size": 1,
"max_retry_count": 1,
"retry_delay": 2,
"buffer_duration": 2,
"inactive_timeout": 2,
"ssl_verify": false
}
},
"upstream": {
"nodes": {
"127.0.0.1:1982": 1
},
"type": "roundrobin"
},
"uri": "/hello1"
}]]
)
if code >= 300 then
ngx.status = code
end
ngx.say(body)
}
}
--- response_body
passed
=== TEST 23: access correct https endpoint but ssl verify ok
--- request
GET /hello1
--- wait: 3

0 comments on commit 61890d0

Please sign in to comment.