Skip to content

Commit 3b009cd

Browse files
committed
tests(lua-bridge) ensure CI uses the dnsmasq resolver
Some tests resolving to external services were unreliable as they were using a real resolver instead of the local dnsmasq mock resolver that we use on CI.
1 parent a31f6d8 commit 3b009cd

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

t/04-openresty/lua-bridge/002-proxy_wasm_lua_resolver_sanity.t

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ ok
8585
--- timeout eval: $::ExtTimeout
8686
--- load_nginx_modules: ngx_http_echo_module
8787
--- wasm_modules: hostcalls
88+
--- http_config eval
89+
qq{
90+
init_worker_by_lua_block {
91+
dns_client = require 'resty.dns.client'
92+
assert(dns_client.init({
93+
noSynchronisation = false, -- default
94+
order = { 'A' },
95+
resolvConf = {
96+
'nameserver $::ExtResolver',
97+
'options timeout:$::ExtTimeout',
98+
}
99+
}))
100+
}
101+
}
88102
--- config
89103
location /t {
90104
proxy_wasm_lua_resolver on;
@@ -111,6 +125,20 @@ called 3 times
111125
--- timeout eval: $::ExtTimeout
112126
--- load_nginx_modules: ngx_http_echo_module
113127
--- wasm_modules: hostcalls
128+
--- http_config eval
129+
qq{
130+
init_worker_by_lua_block {
131+
dns_client = require 'resty.dns.client'
132+
assert(dns_client.init({
133+
noSynchronisation = false, -- default
134+
order = { 'A' },
135+
resolvConf = {
136+
'nameserver $::ExtResolver',
137+
'options timeout:$::ExtTimeout',
138+
}
139+
}))
140+
}
141+
}
114142
--- config
115143
location /t {
116144
proxy_wasm_lua_resolver on;
@@ -612,6 +640,20 @@ ok
612640
--- timeout eval: $::ExtTimeout
613641
--- load_nginx_modules: ngx_http_echo_module
614642
--- wasm_modules: hostcalls
643+
--- http_config eval
644+
qq{
645+
init_worker_by_lua_block {
646+
dns_client = require 'resty.dns.client'
647+
assert(dns_client.init({
648+
noSynchronisation = false, -- default
649+
order = { 'A' },
650+
resolvConf = {
651+
'nameserver $::ExtResolver',
652+
'options timeout:$::ExtTimeout',
653+
}
654+
}))
655+
}
656+
}
615657
--- config
616658
location /t {
617659
proxy_wasm_lua_resolver on;
@@ -638,6 +680,20 @@ TODO: also test with no_postpone
638680
--- timeout eval: $::ExtTimeout
639681
--- load_nginx_modules: ngx_http_echo_module
640682
--- wasm_modules: hostcalls
683+
--- http_config eval
684+
qq{
685+
init_worker_by_lua_block {
686+
dns_client = require 'resty.dns.client'
687+
assert(dns_client.init({
688+
noSynchronisation = false, -- default
689+
order = { 'A' },
690+
resolvConf = {
691+
'nameserver $::ExtResolver',
692+
'options timeout:$::ExtTimeout',
693+
}
694+
}))
695+
}
696+
}
641697
--- config
642698
location /t {
643699
proxy_wasm_lua_resolver on;
@@ -689,6 +745,20 @@ ok
689745
--- timeout eval: $::ExtTimeout
690746
--- load_nginx_modules: ngx_http_echo_module
691747
--- wasm_modules: hostcalls
748+
--- http_config eval
749+
qq{
750+
init_worker_by_lua_block {
751+
dns_client = require 'resty.dns.client'
752+
assert(dns_client.init({
753+
noSynchronisation = false, -- default
754+
order = { 'A' },
755+
resolvConf = {
756+
'nameserver $::ExtResolver',
757+
'options timeout:$::ExtTimeout',
758+
}
759+
}))
760+
}
761+
}
692762
--- config
693763
location /t {
694764
proxy_wasm_lua_resolver on;
@@ -715,6 +785,20 @@ TODO: also test with no_postpone
715785
--- timeout eval: $::ExtTimeout
716786
--- load_nginx_modules: ngx_http_echo_module
717787
--- wasm_modules: hostcalls
788+
--- http_config eval
789+
qq{
790+
init_worker_by_lua_block {
791+
dns_client = require 'resty.dns.client'
792+
assert(dns_client.init({
793+
noSynchronisation = false, -- default
794+
order = { 'A' },
795+
resolvConf = {
796+
'nameserver $::ExtResolver',
797+
'options timeout:$::ExtTimeout',
798+
}
799+
}))
800+
}
801+
}
718802
--- config
719803
location /t {
720804
proxy_wasm_lua_resolver on;
@@ -766,6 +850,20 @@ ok
766850
--- timeout eval: $::ExtTimeout
767851
--- load_nginx_modules: ngx_http_echo_module
768852
--- wasm_modules: hostcalls
853+
--- http_config eval
854+
qq{
855+
init_worker_by_lua_block {
856+
dns_client = require 'resty.dns.client'
857+
assert(dns_client.init({
858+
noSynchronisation = false, -- default
859+
order = { 'A' },
860+
resolvConf = {
861+
'nameserver $::ExtResolver',
862+
'options timeout:$::ExtTimeout',
863+
}
864+
}))
865+
}
866+
}
769867
--- config
770868
location /t {
771869
proxy_wasm_lua_resolver on;
@@ -798,6 +896,20 @@ ok
798896
--- timeout eval: $::ExtTimeout
799897
--- load_nginx_modules: ngx_http_echo_module
800898
--- wasm_modules: hostcalls
899+
--- http_config eval
900+
qq{
901+
init_worker_by_lua_block {
902+
dns_client = require 'resty.dns.client'
903+
assert(dns_client.init({
904+
noSynchronisation = false, -- default
905+
order = { 'A' },
906+
resolvConf = {
907+
'nameserver $::ExtResolver',
908+
'options timeout:$::ExtTimeout',
909+
}
910+
}))
911+
}
912+
}
801913
--- config
802914
location /t {
803915
proxy_wasm_lua_resolver on;

0 commit comments

Comments
 (0)