-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nacos): continue to process other services when request failed
Fix #4949 Signed-off-by: spacewander <spacewanderlzx@gmail.com>
- Loading branch information
1 parent
c4c9b1f
commit 7d623dd
Showing
3 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use t::APISIX 'no_plan'; | ||
|
||
workers(3); | ||
|
||
add_block_preprocessor(sub { | ||
my ($block) = @_; | ||
|
||
if ((!defined $block->error_log) && (!defined $block->no_error_log)) { | ||
$block->set_value("no_error_log", "[error]"); | ||
} | ||
}); | ||
|
||
run_tests(); | ||
|
||
__DATA__ | ||
=== TEST 1: continue to get nacos data after failure in a service | ||
--- yaml_config | ||
apisix: | ||
node_listen: 1984 | ||
config_center: yaml | ||
enable_admin: false | ||
discovery: | ||
nacos: | ||
host: | ||
- "http://127.0.0.1:20999" | ||
prefix: "/nacos/v1/" | ||
fetch_interval: 1 | ||
weight: 1 | ||
timeout: | ||
connect: 2000 | ||
send: 2000 | ||
read: 5000 | ||
--- apisix_yaml | ||
routes: | ||
- | ||
uri: /hello_ | ||
upstream: | ||
service_name: NOT-NACOS | ||
discovery_type: nacos | ||
type: roundrobin | ||
- | ||
uri: /hello | ||
upstream: | ||
service_name: APISIX-NACOS | ||
discovery_type: nacos | ||
type: roundrobin | ||
#END | ||
--- http_config | ||
server { | ||
listen 20999; | ||
location / { | ||
access_by_lua_block { | ||
if not package.loaded.hit then | ||
package.loaded.hit = true | ||
ngx.exit(502) | ||
end | ||
} | ||
proxy_pass http://127.0.0.1:8858; | ||
} | ||
} | ||
--- request | ||
GET /hello | ||
--- response_body_like eval | ||
qr/server [1-2]/ |