【发布时间】:2018-06-03 05:24:40
【问题描述】:
我目前正在尝试使用 Nomad 构建一些集成测试。
为此我尝试:
nomad agent -dev -config=test.conf&
nomad run test.nomad
这当然会失败,因为它会在服务器运行之前尝试提交作业。 不好的选择是插入睡眠。 我的问题是,是否有更好的方法来等待服务器启动并接受作业。
【问题讨论】:
标签: nomad
我目前正在尝试使用 Nomad 构建一些集成测试。
为此我尝试:
nomad agent -dev -config=test.conf&
nomad run test.nomad
这当然会失败,因为它会在服务器运行之前尝试提交作业。 不好的选择是插入睡眠。 我的问题是,是否有更好的方法来等待服务器启动并接受作业。
【问题讨论】:
标签: nomad
所以一个半途而废的解决方案是:
wait_for_agent() {
while test -z $(curl -s http://127.0.0.1:4646/v1/agent/health)
do
sleep 1
done
}
【讨论】:
另一个 hack :-)
nomad agent -dev -config=test.conf && nomad run test.nomad
【讨论】: