better ntp check workaround
This commit is contained in:
parent
41b0c4c45c
commit
08e161ee65
4
Vagrantfile
vendored
4
Vagrantfile
vendored
@ -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|
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user