balena-io-modules / device-diagnostics

on-device diagnostics tool
9 stars 8 forks source link

Add checks for container engine refusing connection #237

Closed saintaardvark closed 4 years ago

saintaardvark commented 4 years ago

[Apologies if you saw a half-done PR before...I obviously fat-fingered something, and had to come back and redo the edits I was trying the first time.]

This checks if balena engine is refusing connections. Specifically:

Local testing

Happy case (no errors):

    {
      "name": "check_container_engine",
      "success": true,
      "status": "No container_engine issues detected"
`
}

Sad case

I followed this procedure to cause problems with log messages matching #226:

root@f41b2eb:~# ls -l /var/run/*sock
srw-rw---- 1 root balena-engine 0 Jul  8 20:30 /var/run/balena-engine.sock
srw-rw---- 1 root balena-engine 0 May 26 11:27 /var/run/balena-host.sock
srw-rw---- 1 root balena-engine 0 Jul  8 20:30 /var/run/balena.sock
root@f41b2eb:~# rm /var/run/*sock
root@f41b2eb:~# !ls
ls -l /var/run/*sock
ls: cannot access '/var/run/*sock': No such file or directory

After that, running the check gives this message:

{
  "name": "check_container_engine",
  "success": false,
  "status": "Some container_engine issues detected: \ntest_container_engine_responding Error querying container engine: Cannot connect to the balenaEngine daemon at unix:///var/run/balena-engine.sock. Is the balenaEngine daemon running?"
}

Change-type: patch Signed-off-by: Hugh Brown hugh@balena.io Connects-to: #226

saintaardvark commented 4 years ago

@balena-ci rebase

roman-mazur commented 4 years ago

@balena-ci rebase

roman-mazur commented 4 years ago

Reopening as #239 because GH refuses to show new (force-pushed) commits on this PR.