better ntp check workaround

This commit is contained in:
Jörg Thalheim 2014-01-27 18:16:56 +01:00
parent 41b0c4c45c
commit 08e161ee65
2 changed files with 15 additions and 4 deletions

4
Vagrantfile vendored
View File

@ -11,8 +11,8 @@ end
boxes = [
{ name: "node0.lctp", role: :head_node, mac: "5CA1AB1E0001", json: load_json("node0.json") },
{ name: "node1.lctp", role: :compute_node, mac: "5CA1AB1E0002", json: load_json("node1.json") }
#{ name: "node2.lctp", role: :compute_node, mac: "5CA1AB1E0003", json: load_json("node2.json") }
{ name: "node1.lctp", role: :compute_node, mac: "5CA1AB1E0002", json: load_json("node1.json") },
#{ name: "node2.lctp", role: :compute_node, mac: "5CA1AB1E0003", json: load_json("node2.json") },
]
["vbguest", "berkshelf"].each do |plugin|

View File

@ -2,8 +2,19 @@ require 'minitest/spec'
describe_recipe 'ntp::default' do
it "starts the ntp daemon" do
# ugly workaround because of race condition
assert_sh("sleep 3 && kill -0 $(cat /var/run/ntpd.pid)")
# 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
end
it "should sync the time" do
assert_sh("ntpq -p")