The commit c43efccf02
("sources: update source selection with
unreachable sources") caused a high rate of failures in the
148-replacement test (1 falseticker vs 2 unreachable sources). This was
due to a larger fraction of the replacement attempts being made for the
source incorrectly marked as a falseticker instead of the second
unreachable source and the random process needed more time to get to the
expected state with both unreachable sources replaced.
When updating reachability of an unreachable source, try to request the
replacement of the source before calling the source selection, where
other sources may be replaced, to better balance the different
replacement attempts.
80 lines
2.6 KiB
Bash
Executable file
80 lines
2.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
. ./test.common
|
|
|
|
test_start "source replacement"
|
|
|
|
limit=5000
|
|
client_conf="logdir tmp
|
|
log measurements"
|
|
|
|
servers=6
|
|
falsetickers=2
|
|
client_server_conf="pool nodes-1-2-3-4-5-6.net1.clk maxsources 5 polltarget 1 iburst"
|
|
wander=1e-12
|
|
jitter=1e-6
|
|
min_sync_time=7
|
|
|
|
run_test || test_fail
|
|
check_chronyd_exit || test_fail
|
|
check_source_selection || test_fail
|
|
check_packet_interval || test_fail
|
|
check_sync || test_fail
|
|
|
|
check_log_messages "Detected falseticker" 2 10 || test_fail
|
|
check_log_messages "Source 192.168.123.. replaced with" 1 3 || test_fail
|
|
check_file_messages "20.*192.168.123.* 11.1 6 6 " 15 18 measurements.log || test_fail
|
|
check_file_messages "20.*00:[1-5].:.. 192.168.123.* 11.1 6 6 " 1 4 measurements.log || test_fail
|
|
rm -f tmp/measurements.log
|
|
|
|
# 1 unreplaceable falseticker against 2 replaceable unreachable servers
|
|
servers=5
|
|
falsetickers=1
|
|
limit=200000
|
|
base_delay="(+ 1e-4 (* -1 (equal 0.6 to 4.5)))"
|
|
client_conf+="
|
|
minsources 2"
|
|
client_server_conf="
|
|
server 192.168.123.1
|
|
server nodes-2-4.net1.clk
|
|
server nodes-3-5.net1.clk"
|
|
max_sync_time=150000
|
|
|
|
run_test || test_fail
|
|
check_chronyd_exit || test_fail
|
|
check_source_selection && test_fail
|
|
check_packet_interval || test_fail
|
|
check_sync || test_fail
|
|
|
|
check_log_messages "Detected falseticker" 2 10 || test_fail
|
|
check_log_messages "Source 192.168.123.. replaced with" 2 70 || test_fail
|
|
check_log_messages "2010-01-01T0[0-4]:.*Source 192.168.123.. replaced with" 2 15 || test_fail
|
|
check_log_messages "2010-01-01T0[5-9]:.*Source 192.168.123.. replaced with" 0 15 || test_fail
|
|
check_file_messages "20.*192.168.123.* 11.1 6 6 " 20 500 measurements.log || test_fail
|
|
rm -f tmp/measurements.log
|
|
|
|
# 2 replaceable falsetickers and 1 replaceable unreachable server
|
|
servers=6
|
|
falsetickers=2
|
|
base_delay="(+ 1e-4 (* -1 (equal 0.1 to 3)))"
|
|
client_server_conf="
|
|
server nodes-4-1.net1.clk
|
|
server nodes-5-2.net1.clk
|
|
server nodes-6-3.net1.clk"
|
|
|
|
run_test || test_fail
|
|
check_chronyd_exit || test_fail
|
|
check_source_selection && test_fail
|
|
check_packet_interval || test_fail
|
|
check_sync || test_fail
|
|
|
|
check_log_messages "Can't synchronise: no majority" 1 1 || test_fail
|
|
check_log_messages "Detected falseticker" 0 2 || test_fail
|
|
check_log_messages "Source 192.168.123.. replaced with" 3 60 || test_fail
|
|
check_log_messages "Source 192.168.123.1 replaced with" 1 25 || test_fail
|
|
check_log_messages "Source 192.168.123.2 replaced with" 1 25 || test_fail
|
|
check_log_messages "Source 192.168.123.3 replaced with" 1 25 || test_fail
|
|
check_file_messages "20.*192.168.123.* 11.1 6 6 " 50 800 measurements.log || test_fail
|
|
rm -f tmp/measurements.log
|
|
|
|
test_pass
|