我们有一个看起来像这样的脚本:
#!/bin/bash
for cookbook in $cookbooks; do
cd /path/to/$cookbook
kitchen test;
# Log whether the test failed or passed
done;
# Print number of tests passed and number of tests failed
如何确定我的kitchen test
是否通过?
答案 0 :(得分:1)
您可以检查kitchen test
命令的退出状态,并增加计数器,如:
#!/bin/bash
let failed=0
let passed=0
for cookbook in $cookbooks; do
cd /path/to/$cookbook
kitchen test;
if [ $? -ne 0 ]
then
failed=$((failed + 1))
else
passed=$((passed + 1))
fi
done;
echo "There was $passed passed and $failed failed tests."