]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: extend 139-nts test
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 13 Aug 2020 10:49:39 +0000 (12:49 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 13 Aug 2020 14:37:38 +0000 (16:37 +0200)
test/simulation/139-nts

index b0d9917b472e3e933e43b6e72b1cd08e2af9d6c2..91c7f2b0a6a14b32aeb04d376fa824f959c51475 100755 (executable)
@@ -97,4 +97,77 @@ check_sync && test_fail
 check_file_messages "  2       1       .*      123     " 0 0 log.packets || test_fail
 check_file_messages "  2       1       .*      4460    " 10 20 log.packets || test_fail
 
+export CLKNETSIM_START_DATE=$(date -d 'Jan  2 00:00:01 UTC 2010' +'%s')
+
+client_conf="
+nosystemcert
+ntstrustedcerts tmp/server.crt"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection && test_fail
+check_sync && test_fail
+
+check_file_messages "  2       1       .*      123     " 0 0 log.packets || test_fail
+check_file_messages "  2       1       .*      4460    " 10 20 log.packets || test_fail
+check_log_messages "expired certificate" 4 4 || test_fail
+
+client_conf+="
+nocerttimecheck 1"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection || test_fail
+check_sync || test_fail
+
+export CLKNETSIM_START_DATE=$(date -d 'Jan  1 00:00:00 UTC 2010' +'%s')
+
+server_conf="
+ntsserverkey tmp/server.key
+ntsservercert tmp/server.crt
+ntsprocesses 0
+ntsrotate 0
+ntsdumpdir tmp
+ntsntpserver 192.168.123.2"
+client_conf="
+nosystemcert
+ntstrustedcerts tmp/server.crt
+ntsrefresh 500"
+client_server_conf="server node1.net1.clk $client_server_options"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection && test_fail
+check_sync && test_fail
+
+check_file_messages "  2       1       .*      4460    " 50 100 log.packets || test_fail
+check_file_messages "  2       2       .*      4460    " 0 0 log.packets || test_fail
+check_log_messages "Source 192.168.123.1 changed to 192.168.123.2" 6 8 || test_fail
+check_log_messages "Source 192.168.123.2 replaced with 192.168.123.1" 6 8 || test_fail
+
+servers=2
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection || test_fail
+check_sync || test_fail
+
+check_file_messages "  3       1       .*      4460    " 100 150 log.packets || test_fail
+check_file_messages "  3       2       .*      4460    " 0 0 log.packets || test_fail
+check_log_messages "Source 192.168.123.1 changed to 192.168.123.2" 1 1 || test_fail
+check_log_messages "Source 192.168.123.2 replaced with 192.168.123.1" 0 0 || test_fail
+
+server_conf+="
+ntsratelimit interval 12 burst 1 leak 4"
+
+client_chronyd_options="-d -d"
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection && test_fail
+
+check_file_messages "  3       1       .*      4460    1       0       2" 25 50 log.packets || test_fail
+check_file_messages "  3       2       .*      4460    " 0 0 log.packets || test_fail
+check_log_messages "Source 192.168.123.1 changed to 192.168.123.2" 2 6 || test_fail
+check_log_messages "Source 192.168.123.2 replaced with 192.168.123.1" 1 6 || test_fail
+
 test_pass