Commit aa354778 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1290] add example test with two instances of bind10

parent 701074eb
......@@ -25,7 +25,8 @@ This port must be free. (TODO: can we make this run-time discovered?).
Port 47805 is used for cmdctl, and must also be available.
The bind10 main script, bindctl script, and dig must all be in the default
search path of your environment.
search path of your environment, and BIND 10 must not be running if you use
the installed version when you run the tests.
To run the tests, just run 'lettuce' in this directory.
......
{"version": 2, "Logging": {"loggers": [{"severity": "DEBUG", "name": "auth", "debuglevel": 99}]}, "Auth": {"database_file": "data/example.org.sqlite3", "listen_on": [{"port": 47807, "address": "127.0.0.1"}]}}
......@@ -25,7 +25,8 @@ def wait_for_output_lines_stdout(process_name, lines, examine_past = True):
@world.absorb
def wait_for_output_lines_stderr(process_name, lines, examine_past = True):
assert process_name in world.processes
assert process_name in world.processes,\
"No process named '" + process_name + "' known"
if examine_past:
for output in world.processes_stderr[process_name]:
for line in lines:
......@@ -40,17 +41,24 @@ def wait_for_output_lines_stderr(process_name, lines, examine_past = True):
if output.find(line) != -1:
return line
@step('start bind10(?: with configuration ([\w.]+))?(?: as (\w+))?')
def start_bind10(step, config_file, process_name):
@step('start bind10(?: with configuration (\S+))?' +\
'(?: with cmdctl port (\d+))?(?: as (\S+))?')
def start_bind10(step, config_file, cmdctl_port, process_name):
args = [ 'bind10', '-v' ]
if config_file is not None:
args.append('-p')
args.append("configurations/")
args.append('-c')
args.append(config_file)
if cmdctl_port is None:
args.append('--cmdctl-port=47805')
else:
args.append('--cmdctl-port=' + cmdctl_port)
if process_name is None:
process_name = "bind10"
else:
args.append('-m')
args.append(process_name + '_msgq.socket')
assert process_name not in world.processes,\
"There already seems to be a process named " + process_name
......@@ -65,7 +73,7 @@ def start_bind10(step, config_file, process_name):
message = world.wait_for_output_lines_stderr(process_name,
["BIND10_STARTUP_COMPLETE",
"BIND10_STARTUP_ERROR"])
assert message == "BIND10_STARTUP_COMPLETE"
assert message == "BIND10_STARTUP_COMPLETE", "Got: " + message
@step('wait for bind10 auth (?:of (\w+) )?to start')
def wait_for_auth(step, process_name):
......
......@@ -40,7 +40,7 @@ class QueryResult(object):
"([0-9]+), AUTHORITY: ([0-9]+), ADDITIONAL: ([0-9]+)")
def __init__(self, name, qtype, qclass, address, port):
args = [ 'dig', '@' + address, '-p', str(port) ]
args = [ 'dig', '+tries=1', '@' + address, '-p', str(port) ]
if qtype is not None:
args.append('-t')
args.append(str(qtype))
......
......@@ -73,3 +73,19 @@ Feature: SQLite3 backend
Then set bind10 configuration Auth/database_file to data/example.org.sqlite3
And wait for bind10 stderr message DATASRC_SQLITE_OPEN
A query for www.example.org should have rcode NOERROR
Scenario: two bind10 instances
# This is more a test of the test system, start 2 bind10's
When I start bind10 with configuration example.org.config as bind10_one
And I start bind10 with configuration example2.org.config with cmdctl port 47804 as bind10_two
Then wait for bind10 auth of bind10_one to start
Then wait for bind10 auth of bind10_two to start
A query for www.example.org to 127.0.0.1:47806 should have rcode NOERROR
A query for www.example.org to 127.0.0.1:47807 should have rcode NOERROR
Then set bind10 configuration Auth/database_file to data/empty_db.sqlite3
And wait for bind10_one stderr message DATASRC_SQLITE_OPEN
A query for www.example.org to 127.0.0.1:47806 should have rcode REFUSED
A query for www.example.org to 127.0.0.1:47807 should have rcode NOERROR
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment