-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid nameserver duplication #636
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,11 +179,12 @@ nameserver 127.0.0.1 | |
end) | ||
|
||
it('returns nameserver touples', function() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this deserves a new test. Because it basically changes it so we don't have a test for the order of returned nameservers from a normal file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. Also, I think that we have similar problems with other tests. For example, this test is checking that commented lines are ignored, but there isn't an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in e2755eb |
||
resty_env.set('RESOLVER', '127.0.0.1') | ||
local nameservers = resty_resolver.parse_nameservers(tmpname) | ||
|
||
assert.equal(2, #nameservers) | ||
assert.same({ '127.0.0.2', 53 }, nameservers[1]) | ||
assert.same({ '127.0.0.1', 53 }, nameservers[2]) | ||
assert.same({ '127.0.0.1', 53 }, nameservers[1]) | ||
assert.same({ '127.0.0.2', 53 }, nameservers[2]) | ||
end) | ||
|
||
it('returns search domains', function() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,3 +101,29 @@ GET /t | |
nameservers: 1 [dead::beef]:5353 | ||
--- user_files | ||
>>> resolv.conf | ||
|
||
|
||
=== TEST 4: do not duplicate nameserver from RESOLVER | ||
nameservers should not repeat if already configured | ||
--- main_config | ||
env RESOLVER='127.0.1.1:53'; | ||
--- http_config | ||
lua_package_path "$TEST_NGINX_LUA_PATH"; | ||
init_worker_by_lua_block { | ||
require('resty.resolver').init('$TEST_NGINX_RESOLV_CONF') | ||
} | ||
--- config | ||
location = /t { | ||
content_by_lua_block { | ||
local nameservers = require('resty.resolver').nameservers() | ||
ngx.say('nameservers: ', #nameservers, ' ', nameservers[1], ' ', nameservers[2]) | ||
} | ||
} | ||
--- request | ||
GET /t | ||
--- response_body | ||
nameservers: 2 127.0.1.153 1.2.3.453 | ||
--- user_files | ||
>>> resolv.conf | ||
nameserver 127.0.1.1 | ||
nameserver 1.2.3.4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing newline at the end of the file. Would be good to set-up your editor to always keep a new-line at the EOF. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in 3afea98 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo