chef-lctp/site-cookbooks/ntp/files/default/test/default_test.rb

23 lines
393 B
Ruby
Raw Normal View History

2014-01-22 09:32:39 +00:00
require 'minitest/spec'
describe_recipe 'ntp::default' do
it "starts the ntp daemon" do
2014-01-27 17:16:56 +00:00
# linear back off to work around race condition
assert_sh <<EOF
bash -c'
NEXT_WAIT_TIME=0
until [ $NEXT_WAIT_TIME -eq 4 ]; do
if service ntp status; then
exit 0
fi
sleep $(( NEXT_WAIT_TIME++ ))
done
exit 1
'
EOF
2014-01-22 09:32:39 +00:00
end
it "should sync the time" do
assert_sh("ntpq -p")
end
end