Skip to content

Commit

Permalink
fix unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Akayeshmantha committed Jun 9, 2020
1 parent 549d035 commit 54abde1
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions t/plugin/echo.t
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,69 @@ before the body modification hello upstream
--- no_error_log
[error]
--- wait: 0.2


=== TEST 5: update plugin
--- 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": {
"echo": {
"before_body": "before the body modification "
}
},
"upstream": {
"nodes": {
"127.0.0.1:1980": 1
},
"type": "roundrobin"
},
"uri": "/hello"
}]],
[[{
"node": {
"value": {
"plugins": {
"echo": {
"before_body": "before the body modification "
}
},
"upstream": {
"nodes": {
"127.0.0.1:1980": 1
},
"type": "roundrobin"
},
"uri": "/hello"
},
"key": "/apisix/routes/1"
},
"action": "set"
}]]
)

if code >= 300 then
ngx.status = code
end
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]

=== TEST 6: access without upstream body change
--- request
GET /hello
--- response_body
before the body modification hello world
--- no_error_log
[error]
--- wait: 0.2

0 comments on commit 54abde1

Please sign in to comment.