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 num_test_failures = 0
% for test in tests: % 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([\ current_test_subprocess = subprocess.Popen([\
args.test_bin_path,\ args.test_bin_path,\
'--target_name', '${test['target_name']}',\ % for arg_name_and_value in test['arg_names_and_values']:
\
'--expected_addrs', '${test['expected_addrs']}',\ '--${arg_name_and_value[0]}', '${arg_name_and_value[1]}',\
'--expected_chosen_service_config', '${test['expected_chosen_service_config']}',\
'--expected_lb_policy', '${test['expected_lb_policy']}',\
\
% endfor
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])\ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])\
current_test_subprocess.communicate()\ current_test_subprocess.communicate()\

@ -48,15 +48,15 @@ echo "Sanity check PASSED. Run resolver tests:"
ONE_FAILED=0 ONE_FAILED=0
bins/$CONFIG/resolver_component_test \\ 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']}' \\ \
% endfor
--expected_chosen_service_config='${test['expected_chosen_service_config']}' \\ --${test['arg_names_and_values'][-1][0]}='${test['arg_names_and_values'][-1][1]}' || ONE_FAILED=1
--expected_lb_policy='${test['expected_lb_policy']}' || ONE_FAILED=1
if [[ "$ONE_FAILED" != 0 ]]; then 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 EXIT_CODE=1
fi 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']: for test_case in resolver_component_data['resolver_component_tests']:
if test_case['record_to_resolve'] in records_to_skip: if test_case['record_to_resolve'] in records_to_skip:
continue continue
target_name = _append_zone_name(
test_case['record_to_resolve'],
resolver_component_data['resolver_tests_common_zone_name'])
out.append({ out.append({
'target_name': _append_zone_name(test_case['record_to_resolve'], 'test_title': target_name,
resolver_component_data['resolver_tests_common_zone_name']), 'arg_names_and_values': [
'expected_addrs': _build_expected_addrs_cmd_arg(test_case['expected_addrs']), ('target_name', target_name),
'expected_chosen_service_config': (test_case['expected_chosen_service_config'] or ''), ('expected_addrs',
'expected_lb_policy': (test_case['expected_lb_policy'] or ''), _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 return out

Loading…
Cancel
Save