Make local DNS server tests more generic

pull/15346/head
Alexander Polcyn 7 years ago
parent 61fdb46ac4
commit 550621c1b5
  1. 14
      templates/test/cpp/naming/resolver_component_tests_defs.include
  2. 14
      templates/test/cpp/naming/resolver_gce_integration_tests_defs.include
  3. 17
      test/cpp/naming/gen_build_yaml.py

@ -113,20 +113,18 @@ wait_until_dns_server_is_up(args,
num_test_failures = 0
% for test in tests:
test_runner_log('Run test with target: %s' % '${test['target_name']}')\
test_runner_log('Run test with target: %s' % '${test['test_title']}')\
current_test_subprocess = subprocess.Popen([\
args.test_bin_path,\
'--target_name', '${test['target_name']}',\
'--expected_addrs', '${test['expected_addrs']}',\
'--expected_chosen_service_config', '${test['expected_chosen_service_config']}',\
'--expected_lb_policy', '${test['expected_lb_policy']}',\
% for arg_name_and_value in test['arg_names_and_values']:
\
'--${arg_name_and_value[0]}', '${arg_name_and_value[1]}',\
\
% endfor
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])\
current_test_subprocess.communicate()\

@ -48,15 +48,15 @@ echo "Sanity check PASSED. Run resolver tests:"
ONE_FAILED=0
bins/$CONFIG/resolver_component_test \\
--target_name='${test['target_name']}' \\
% for arg_name_and_value in test['arg_names_and_values'][0:-1]:
\
--${arg_name_and_value[0]}='${arg_name_and_value[1]}' \\
--expected_addrs='${test['expected_addrs']}' \\
--expected_chosen_service_config='${test['expected_chosen_service_config']}' \\
--expected_lb_policy='${test['expected_lb_policy']}' || ONE_FAILED=1
\
% endfor
--${test['arg_names_and_values'][-1][0]}='${test['arg_names_and_values'][-1][1]}' || ONE_FAILED=1
if [[ "$ONE_FAILED" != 0 ]]; then
echo "Test based on target record: ${test['target_name']} FAILED"
echo "Test based on target record: ${test['test_title']} FAILED"
EXIT_CODE=1
fi

@ -119,12 +119,19 @@ def _resolver_test_cases(resolver_component_data, records_to_skip):
for test_case in resolver_component_data['resolver_component_tests']:
if test_case['record_to_resolve'] in records_to_skip:
continue
target_name = _append_zone_name(
test_case['record_to_resolve'],
resolver_component_data['resolver_tests_common_zone_name'])
out.append({
'target_name': _append_zone_name(test_case['record_to_resolve'],
resolver_component_data['resolver_tests_common_zone_name']),
'expected_addrs': _build_expected_addrs_cmd_arg(test_case['expected_addrs']),
'expected_chosen_service_config': (test_case['expected_chosen_service_config'] or ''),
'expected_lb_policy': (test_case['expected_lb_policy'] or ''),
'test_title': target_name,
'arg_names_and_values': [
('target_name', target_name),
('expected_addrs',
_build_expected_addrs_cmd_arg(test_case['expected_addrs'])),
('expected_chosen_service_config',
(test_case['expected_chosen_service_config'] or '')),
('expected_lb_policy', (test_case['expected_lb_policy'] or '')),
],
})
return out

Loading…
Cancel
Save