@@ -99,6 +99,8 @@ import Testing
9999
100100 @ Test ( arguments : [
101101 " failed-start " , " failed-stop " , " failed-restart " , " json-success " , " plain-success " , " json-failure " ,
102+ " json-failure-with-hints " , " json-failure-with-hints-and-exit " , " json-failure-hints-only " ,
103+ " not-loaded-start " , " not-loaded-stop " ,
102104 ] )
103105 func `node lifecycle respects process exit and optional JSON status` ( _ scenario : String ) async throws {
104106 let root = try makeTempDirForTests ( )
@@ -116,20 +118,37 @@ import Testing
116118 case " $OPENCLAW_NODE_SERVICE_TEST_CASE " in
117119 failed-*) printf '{ " ok " :true}'; printf 'cleanup failed' >&2; exit 23 ;;
118120 json-failure) printf '{ " ok " :false, " error " : " reported failure " }' ;;
121+ json-failure-with-hints*)
122+ printf '{ " ok " :false, " error " : " Node service not installed. " ,'
123+ printf ' " hints " :[ " openclaw node install " , " openclaw node start " , " third hint " ]}'
124+ if [ " $OPENCLAW_NODE_SERVICE_TEST_CASE " = " json-failure-with-hints-and-exit " ]; then exit 1; fi
125+ ;;
126+ json-failure-hints-only)
127+ printf '{ " ok " :false, " hints " :[ " openclaw node install " , " openclaw node start " ]}'
128+ ;;
129+ not-loaded-*)
130+ printf '{ " ok " :true, " result " : " not-loaded " , " message " : " Node service not loaded. " ,'
131+ printf ' " hints " :[ " openclaw node install " , " openclaw node start " ]}'
132+ ;;
119133 plain-success) printf 'service started' ;;
120134 *) printf '{ " ok " :true}' ;;
121135 esac
122136 """
123137 try script . write ( to : executable , atomically : false , encoding : . utf8 )
124138
125139 let action = switch scenario {
126- case " failed-stop " : " stop "
140+ case " failed-stop " , " not-loaded-stop " : " stop "
127141 case " failed-restart " : " restart "
128142 default : " start "
129143 }
130144 let expectedError : String ? = switch scenario {
131145 case " failed-start " , " failed-stop " , " failed-restart " : " cleanup failed "
132146 case " json-failure " : " reported failure "
147+ case " json-failure-with-hints " , " json-failure-with-hints-and-exit " :
148+ " Node service not installed. (openclaw node install · openclaw node start) "
149+ case " json-failure-hints-only " : " openclaw node install · openclaw node start "
150+ case " not-loaded-start " :
151+ " Node service not loaded. (openclaw node install · openclaw node start) "
133152 default : nil
134153 }
135154
0 commit comments