test: extend 007-cmdmon system test

This commit is contained in:
Miroslav Lichvar 2020-08-18 17:37:28 +02:00
parent 24effd7340
commit 0f009e7718

View file

@ -5,39 +5,31 @@
test_start "chronyc commands" test_start "chronyc commands"
start_chronyd || test_fail start_chronyd || test_fail
wait_for_sync || test_fail
for command in \ for command in \
"authdata" \ "allow 1.2.3.4" \
"accheck 1.2.3.4" \ "deny 1.2.3.4" \
"delete $server" \ "cmddeny" \
"add server $server" \ "cmdallow" \
"deny" \
"allow" \
"burst 1/1" \
"clients" \
"cmdallow 1.2.3.4" \
"cmdaccheck 1.2.3.4" \
"cmddeny 1.2.3.4" \ "cmddeny 1.2.3.4" \
"cmdallow 1.2.3.4" \
"add server 127.123.1.1" \
"delete 127.123.1.1" \
"burst 1/1" \
"cyclelogs" \ "cyclelogs" \
"dfreq 1.0e-3" \ "dfreq 1.0e-3" \
"doffset -0.1" \ "doffset -0.1" \
"dump" \ "dump" \
"local off" \ "local off" \
"local" \ "local" \
"manual on" \ "maxdelay $server 1e-1" \
"settime now" \
"manual delete 0" \
"settime now" \
"manual reset" \
"manual off" \
"maxdelay $server 1e-2" \
"maxdelaydevratio $server 5.0" \ "maxdelaydevratio $server 5.0" \
"maxdelayratio $server 3.0" \ "maxdelayratio $server 3.0" \
"maxpoll $server 5" \ "maxpoll $server 5" \
"maxupdateskew $server 10.0" \ "maxupdateskew $server 10.0" \
"minpoll $server 3" \ "minpoll $server 3" \
"minstratum $server 1" \ "minstratum $server 1" \
"ntpdata $server" \
"offline" \ "offline" \
"online" \ "online" \
"onoffline" \ "onoffline" \
@ -48,23 +40,115 @@ for command in \
"reselect" \ "reselect" \
"reselectdist 1e-3" \ "reselectdist 1e-3" \
"reset sources" \ "reset sources" \
"selectdata" \
"serverstats" \
"smoothtime reset" \ "smoothtime reset" \
"smoothtime activate" \ "smoothtime activate" \
"shutdown" \
; do ; do
run_chronyc "$command" || test_fail run_chronyc "$command" || test_fail
check_chronyc_output "^200 OK$" || test_fail
done done
run_chronyc "accheck $server" || test_fail
check_chronyc_output "^208 Access allowed$" || test_fail
run_chronyc "accheck 1.2.3.4" || test_fail
check_chronyc_output "^209 Access denied$" || test_fail
run_chronyc "cmdaccheck 1.2.3.4" || test_fail
check_chronyc_output "^208 Access allowed$" || test_fail
run_chronyc "authdata" || test_fail
check_chronyc_output "^Name/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen
=========================================================================
127\.0\.0\.1 - 0 0 0 - 0 0 0 0$" \
|| test_chronyc
run_chronyc "clients" || test_fail
check_chronyc_output "^Hostname NTP Drop Int IntL Last Cmd Drop Int Last
===============================================================================
127\.0\.0\.1 [1-9] 0 - - [0-9] 0 0 - -$" \
|| test_fail
run_chronyc "ntpdata $server" || test_fail
check_chronyc_output "^Remote address : 127\.0\.0\.1 \(7F000001\)
Remote port : [0-9]+
Local address : 127\.0\.0\.1 \(7F000001\)
Leap status : Normal
Version : 4
Mode : Server
Stratum : 10
Poll interval : -6 \(0 seconds\)
Precision : [0-9 +-]+ \(0\.[0-9]+ seconds\)
Root delay : 0\.000000 seconds
Root dispersion : 0\.000000 seconds
Reference ID : 7F7F0101 \(\)
Reference time : [A-Za-z0-9: ]+
Offset : [+-]0\.......... seconds
Peer delay : 0\.......... seconds
Peer dispersion : 0\.......... seconds
Response time : 0\.......... seconds
Jitter asymmetry: \+0\.00
NTP tests : 111 111 1110
Interleaved : No
Authenticated : No
TX timestamping : (Daemon|Kernel)
RX timestamping : (Daemon|Kernel)
Total TX : [0-9]+
Total RX : [0-9]+
Total valid RX : [0-9]+$" || test_fail
run_chronyc "selectdata" || test_fail
check_chronyc_output "^S Name/IP Address Auth COpts EOpts Last Score Interval +
====================================================================
M 127\.0\.0\.1 N ----- ----- 0 1\.0 \+0ns \+0ns$" || test_fail
run_chronyc "serverstats" || test_fail
check_chronyc_output "^NTP packets received : [0-9]+
NTP packets dropped : 0
Command packets received : [0-9]+
Command packets dropped : 0
Client log records dropped : 0
NTS-KE connections accepted: 0
NTS-KE connections dropped : 0
Authenticated NTP packets : 0$" || test_fail
run_chronyc "manual on" || test_fail
check_chronyc_output "^200 OK$" || test_fail
run_chronyc "settime now" || test_fail
check_chronyc_output "^200 OK
Clock was.*$" || test_fail
run_chronyc "manual delete 0" || test_fail
check_chronyc_output "^200 OK$" || test_fail
run_chronyc "settime now" || test_fail
check_chronyc_output "^200 OK
Clock was.*$" || test_fail
run_chronyc "manual list" || test_fail
check_chronyc_output "^210 n_samples = 1
# Date Time\(UTC\) Slewed Original Residual
=======================================================
0.*$" || test_fail
run_chronyc "manual reset" || test_fail
check_chronyc_output "^200 OK$" || test_fail
run_chronyc "manual off" || test_fail
check_chronyc_output "^200 OK$" || test_fail
run_chronyc "shutdown" || test_fail
check_chronyc_output "^200 OK$" || test_fail
stop_chronyd || test_fail stop_chronyd || test_fail
check_chronyd_messages || test_fail check_chronyd_messages || test_fail
start_chronyd || test_fail start_chronyd || test_fail
run_chronyc "makestep" && test_fail run_chronyc "makestep" && test_fail
check_chronyc_output "500 Failure" || test_fail check_chronyc_output "500 Failure" || test_fail
run_chronyc "trimrtc" && test_fail run_chronyc "trimrtc" && test_fail
check_chronyc_output "513 RTC driver not running" || test_fail check_chronyc_output "513 RTC driver not running" || test_fail
run_chronyc "writertc" && test_fail run_chronyc "writertc" && test_fail
check_chronyc_output "513 RTC driver not running" || test_fail check_chronyc_output "513 RTC driver not running" || test_fail