assert $? 0 "Your agent has too restrictive permissions: should be 755"
else
echo "WARN: Can't check agent's permissions because we're not root; they should be 755"
fi
test_metadata
assert $? 0 "Your agent produces meta-data which does not conform to ra-api-1.dtd"
OCF_TESTER_FAIL_HAVE_BINARY=1
export OCF_TESTER_FAIL_HAVE_BINARY
test_command meta-data
rc=$?
if [ $rc -eq 3 ]; then
assert $rc 0 "Your agent does not support the meta-data action"
else
assert $rc 0 "The meta-data action cannot fail and must return 0"
fi
unset OCF_TESTER_FAIL_HAVE_BINARY
ra_args="export $ra_args"
eval $ra_args
test_command validate-all
rc=$?
if [ $rc -eq 3 ]; then
assert $rc 0 "Your agent does not support the validate-all action"
elif [ $rc -ne 0 ]; then
assert $rc 0 "Validation failed. Did you supply enough options with -o ?" 1
usage $rc
fi
test_command monitor "Checking current state"
rc=$?
if [ $rc -eq 3 ]; then
assert $rc 7 "Your agent does not support the monitor action" 1
elif [ $rc -eq 8 ]; then
test_command demote "Cleanup, demote"
- assert $? 0 "Your agent was a master and could not be demoted" 1
+ assert $? 0 "Your agent was promoted and could not be demoted" 1
test_command stop "Cleanup, stop"
- assert $? 0 "Your agent was a master and could not be stopped" 1
+ assert $? 0 "Your agent was promoted and could not be stopped" 1
elif [ $rc -ne 7 ]; then
test_command stop
assert $? 0 "Your agent was active and could not be stopped" 1
fi
test_command monitor
assert $? $stopped_rc "Monitoring a stopped resource should return $stopped_rc"
OCF_TESTER_FAIL_HAVE_BINARY=1
export OCF_TESTER_FAIL_HAVE_BINARY
OCF_RESKEY_CRM_meta_interval=0
test_command monitor
assert $? $stopped_rc:$installed_rc "The initial probe for a stopped resource should return $stopped_rc or $installed_rc even if all binaries are missing"
unset OCF_TESTER_FAIL_HAVE_BINARY
OCF_RESKEY_CRM_meta_interval=20000
test_command start
assert $? 0 "Start failed. Did you supply enough options with -o ?" 1
test_command monitor
assert $? 0 "Monitoring an active resource should return 0"
OCF_RESKEY_CRM_meta_interval=0
test_command monitor
assert $? 0 "Probing an active resource should return 0"
OCF_RESKEY_CRM_meta_interval=20000
test_command notify
rc=$?
if [ $rc -eq 3 ]; then
info "* Your agent does not support the notify action (optional)"
else
assert $rc 0 "The notify action cannot fail and must return 0"
fi
test_command demote "Checking for demote action"
if [ $? -eq 3 ]; then
has_demote=0
info "* Your agent does not support the demote action (optional)"
fi
test_command promote "Checking for promote action"
if [ $? -eq 3 ]; then
has_promote=0
info "* Your agent does not support the promote action (optional)"
fi
if [ $has_promote -eq 1 -a $has_demote -eq 1 ]; then
test_command demote "Testing: demotion of started resource"
assert $? 0 "Demoting a start resource should not fail"
test_command promote
assert $? 0 "Promote failed"
test_command demote
assert $? 0 "Demote failed" 1
test_command demote "Testing: demotion of demoted resource"
assert $? 0 "Demoting a demoted resource should not fail"
test_command promote "Promoting resource"
assert $? 0 "Promote failed" 1
test_command promote "Testing: promotion of promoted resource"
assert $? 0 "Promoting a promoted resource should not fail"
test_command demote "Demoting resource"
assert $? 0 "Demote failed" 1
elif [ $has_promote -eq 0 -a $has_demote -eq 0 ]; then
- info "* Your agent does not support master/slave (optional)"
+ info "* Your agent does not support promotable clones (optional)"
else
- echo "* Your agent partially supports master/slave"
+ echo "* Your agent partially supports promotable clones"
num_errors=`expr $num_errors + 1`
fi
test_command stop
assert $? 0 "Stop failed" 1
test_command monitor
assert $? $stopped_rc "Monitoring a stopped resource should return $stopped_rc"
test_command start "Restarting resource..."
assert $? 0 "Start failed" 1
test_command monitor
assert $? 0 "Monitoring an active resource should return 0"
test_command start "Testing: starting a started resource"
assert $? 0 "Starting a running resource is required to succeed"
test_command monitor
assert $? 0 "Monitoring an active resource should return 0"
test_command stop "Stopping resource"
assert $? 0 "Stop could not clean up after multiple starts" 1
test_command monitor
assert $? $stopped_rc "Monitoring a stopped resource should return $stopped_rc"
test_command stop "Testing: stopping a stopped resource"
assert $? 0 "Stopping a stopped resource is required to succeed"
test_command monitor
assert $? $stopped_rc "Monitoring a stopped resource should return $stopped_rc"
test_command migrate_to "Checking for migrate_to action"
rc=$?
if [ $rc -ne 3 ]; then
test_command migrate_from "Checking for migrate_from action"
fi
if [ $? -eq 3 ]; then
info "* Your agent does not support the migrate action (optional)"
fi
test_command reload "Checking for reload action"
if [ $? -eq 3 ]; then
info "* Your agent does not support the reload action (optional)"