TT#157951 Check for ngcp-rest-api process running under node binary

goss checks the name of the *binary*, not the name of the *process*.

This can be checked from a user perspective via:

| $ systemctl cat ngcp-rest-api | grep ExecStart
| ExecStart=/usr/bin/node --title ngcp-rest-api /usr/share/ngcp-rest-api/server
| $ sudo systemctl status ngcp-rest-api | grep PID
|    Main PID: 327024 (node)
| $ ps -p 327024 -o comm
| COMMAND
| node

Underneath, goss looks at the cmdline and stat files inside procfs:

| $ cat /proc/327024/cmdline
| ngcp-rest-api
| $ cat /proc/327024/stat
| 327024 (node) S 1 327024 327024 0 -1 4194560 38500 0 47 0 121 13 0 0 20 0 7 0 552217 704745472 32511 18446744073709551615 1 1 0 0 0 0 0 4096 82434 0 0 0 17 0 0 0 1 0 0 0 0 0 0 0 0 0 0

Since those two don't match with each other, our ngcp-rest-api service,
running under the node binary, isn't identified as such a running process.

NOTE: we're already checking for goss' service named ngcp-rest-api from
within templates/510_init-daemons-ngcp.yaml.tt2, but this doesn't check
if the process is alive. We need to explicitly check for the expected
process name, which we're doing hereby.

Change-Id: Iafa63b8e9fbfeee9edb2c0d48e8ed3514da4804a
mr10.3
Michael Prokop 4 years ago
parent cf7a62fe2c
commit d54de3e4da

@ -61,9 +61,6 @@ process:
ngcp-faxserver:
running: {{if and [% is_proxy ? 1 : 0 %] .Vars.NODE_ACTIVE}} true {{else}} false {{end}}
ngcp-rest-api:
running: [% is_mgmt && rest_api.enable == 'yes' ? 'true' : 'false' %]
ngcp-snmp-agent:
running: true
@ -92,3 +89,9 @@ command:
stdout: []
{{end}}
stderr: []
# ngcp-rest-api runs under the node binary, so we can't use "process" for checking
"pgrep -c -n -f 'ngcp-rest-api'":
exit-status: [% is_mgmt && rest_api.enable == 'yes' ? '0' : '1' %]
stdout:
- "[% is_mgmt && rest_api.enable == 'yes' ? '1' : '0' %]"
stderr: []

Loading…
Cancel
Save