@@ -181,4 +181,44 @@ describe('lifecycle commands', () => {
181181 expect ( fs . readFileSync ( sudoLog , 'utf8' ) ) . toContain ( workspace . sourceEntry )
182182 expect ( fs . readFileSync ( systemctlLog , 'utf8' ) ) . toContain ( 'start myapp-api.service' )
183183 } )
184+
185+ it ( 'status explains activating but not enabled units' , async ( ) => {
186+ const workspace = createWorkspace ( )
187+ workspaces . push ( workspace )
188+
189+ const systemctlLog = path . join ( workspace . root , 'systemctl.log' )
190+ installMockCommand (
191+ workspace ,
192+ 'systemctl' ,
193+ [
194+ '#!/usr/bin/env bash' ,
195+ 'printf "%s\\n" "$*" >>"${SSM_SYSTEMCTL_LOG}"' ,
196+ 'if [[ "$1" == "is-enabled" ]]; then printf "disabled\\n"; fi' ,
197+ 'if [[ "$1" == "is-active" ]]; then printf "activating\\n"; fi' ,
198+ 'exit 0' ,
199+ ] . join ( '\n' ) ,
200+ )
201+
202+ const projectRoot = path . join (
203+ workspace . managerHome ,
204+ 'tests' ,
205+ 'fixtures' ,
206+ 'project-basic' ,
207+ )
208+
209+ const result = await runSource (
210+ workspace ,
211+ [ 'status' , 'api' , '--project' , projectRoot ] ,
212+ {
213+ SSM_TEST_EUID : '0' ,
214+ SSM_SYSTEMCTL_LOG : systemctlLog ,
215+ } ,
216+ )
217+
218+ expect ( result . exitCode ) . toBe ( 0 )
219+ expect ( result . stdout ) . toContain ( 'enabled=disabled' )
220+ expect ( result . stdout ) . toContain ( 'active=activating' )
221+ expect ( result . stdout ) . toContain ( 'note=unit 已启动但未启用开机自启' )
222+ expect ( result . stdout ) . toContain ( 'note=unit 正在启动中' )
223+ } )
184224} )
0 commit comments