Skip to content

Added journalctl lines to the failed_service_check script (BugFix)#1353

Merged
Hook25 merged 2 commits intomainfrom
journalctl-log-for-failing-services
Jul 22, 2024
Merged

Added journalctl lines to the failed_service_check script (BugFix)#1353
Hook25 merged 2 commits intomainfrom
journalctl-log-for-failing-services

Conversation

@fernando79513
Copy link
Copy Markdown
Collaborator

Description

To make test failures easily interpretable, it would be helpful to include some log output from the affected service(s) that were in an unexpected state.

I could refactor this script to python, but I think it's simple enough that It could be left as it was.

Resolved issues

https://warthogs.atlassian.net/browse/CHECKBOX-1247

Documentation

N/A

Tests

The script now includes the last 50 lines of journalctl of the failing service

$ bash failed_service_check.sh 
Found 1 failed units

Failed units:
  UNIT                        LOAD   ACTIVE SUB    DESCRIPTION                                
● snap.checkbox.agent.service loaded failed failed Service for snap application checkbox.agent

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
1 loaded units listed.

Logs for snap.checkbox.agent.service:
jul 22 15:45:15 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Main process exited, code=exited, status=1/FAILURE
jul 22 15:45:15 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Failed with result 'exit-code'.
jul 22 15:45:16 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Scheduled restart job, restart counter is at 1.
jul 22 15:45:16 IdeaPad-Pro-5 systemd[1]: Stopped Service for snap application checkbox.agent.
jul 22 15:45:16 IdeaPad-Pro-5 systemd[1]: Started Service for snap application checkbox.agent.
jul 22 15:45:16 IdeaPad-Pro-5 checkbox.agent[149978]: $PROVIDERPATH is defined, so following provider sources are ignored ['/root/.local/share/plainbox-providers-1', '/var/tmp/checkbox-providers-develop']
jul 22 15:45:16 IdeaPad-Pro-5 sudo[150005]:     root : PWD=/var/snap/checkbox/7738 ; USER=root ; COMMAND=/usr/bin/true
jul 22 15:45:16 IdeaPad-Pro-5 sudo[150005]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
jul 22 15:45:16 IdeaPad-Pro-5 sudo[150005]: pam_unix(sudo:session): session closed for user root
jul 22 15:45:16 IdeaPad-Pro-5 checkbox.agent[149978]: Found port 18871 is open. Is Checkbox agent already running?
jul 22 15:45:16 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Main process exited, code=exited, status=1/FAILURE
jul 22 15:45:16 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Failed with result 'exit-code'.
jul 22 15:45:18 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Scheduled restart job, restart counter is at 2.
jul 22 15:45:18 IdeaPad-Pro-5 systemd[1]: Stopped Service for snap application checkbox.agent.
jul 22 15:45:18 IdeaPad-Pro-5 systemd[1]: Started Service for snap application checkbox.agent.
jul 22 15:45:18 IdeaPad-Pro-5 checkbox.agent[150023]: $PROVIDERPATH is defined, so following provider sources are ignored ['/root/.local/share/plainbox-providers-1', '/var/tmp/checkbox-providers-develop']
jul 22 15:45:18 IdeaPad-Pro-5 sudo[150064]:     root : PWD=/var/snap/checkbox/7738 ; USER=root ; COMMAND=/usr/bin/true
jul 22 15:45:18 IdeaPad-Pro-5 sudo[150064]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
jul 22 15:45:18 IdeaPad-Pro-5 sudo[150064]: pam_unix(sudo:session): session closed for user root
jul 22 15:45:18 IdeaPad-Pro-5 checkbox.agent[150023]: Found port 18871 is open. Is Checkbox agent already running?
jul 22 15:45:18 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Main process exited, code=exited, status=1/FAILURE
jul 22 15:45:18 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Failed with result 'exit-code'.
jul 22 15:45:20 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Scheduled restart job, restart counter is at 3.
jul 22 15:45:20 IdeaPad-Pro-5 systemd[1]: Stopped Service for snap application checkbox.agent.
jul 22 15:45:20 IdeaPad-Pro-5 systemd[1]: Started Service for snap application checkbox.agent.
jul 22 15:45:20 IdeaPad-Pro-5 checkbox.agent[150094]: $PROVIDERPATH is defined, so following provider sources are ignored ['/root/.local/share/plainbox-providers-1', '/var/tmp/checkbox-providers-develop']
jul 22 15:45:20 IdeaPad-Pro-5 sudo[150124]:     root : PWD=/var/snap/checkbox/7738 ; USER=root ; COMMAND=/usr/bin/true
jul 22 15:45:20 IdeaPad-Pro-5 sudo[150124]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
jul 22 15:45:20 IdeaPad-Pro-5 sudo[150124]: pam_unix(sudo:session): session closed for user root
jul 22 15:45:20 IdeaPad-Pro-5 checkbox.agent[150094]: Found port 18871 is open. Is Checkbox agent already running?
jul 22 15:45:20 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Main process exited, code=exited, status=1/FAILURE
jul 22 15:45:20 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Failed with result 'exit-code'.
jul 22 15:45:21 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Scheduled restart job, restart counter is at 4.
jul 22 15:45:21 IdeaPad-Pro-5 systemd[1]: Stopped Service for snap application checkbox.agent.
jul 22 15:45:21 IdeaPad-Pro-5 systemd[1]: Started Service for snap application checkbox.agent.
jul 22 15:45:22 IdeaPad-Pro-5 checkbox.agent[150134]: $PROVIDERPATH is defined, so following provider sources are ignored ['/root/.local/share/plainbox-providers-1', '/var/tmp/checkbox-providers-develop']
jul 22 15:45:22 IdeaPad-Pro-5 sudo[150181]:     root : PWD=/var/snap/checkbox/7738 ; USER=root ; COMMAND=/usr/bin/true
jul 22 15:45:22 IdeaPad-Pro-5 sudo[150181]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
jul 22 15:45:22 IdeaPad-Pro-5 sudo[150181]: pam_unix(sudo:session): session closed for user root
jul 22 15:45:22 IdeaPad-Pro-5 checkbox.agent[150134]: Found port 18871 is open. Is Checkbox agent already running?
jul 22 15:45:22 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Main process exited, code=exited, status=1/FAILURE
jul 22 15:45:22 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Failed with result 'exit-code'.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Scheduled restart job, restart counter is at 5.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: Stopped Service for snap application checkbox.agent.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Start request repeated too quickly.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Failed with result 'exit-code'.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: Failed to start Service for snap application checkbox.agent.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Start request repeated too quickly.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: snap.checkbox.agent.service: Failed with result 'exit-code'.
jul 22 15:45:23 IdeaPad-Pro-5 systemd[1]: Failed to start Service for snap application checkbox.agent.

Copy link
Copy Markdown
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, good addition

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.19%. Comparing base (296863f) to head (f10be0f).
Report is 135 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1353   +/-   ##
=======================================
  Coverage   44.19%   44.19%           
=======================================
  Files         359      359           
  Lines       38826    38826           
  Branches     6585     6585           
=======================================
  Hits        17161    17161           
  Misses      21002    21002           
  Partials      663      663           
Flag Coverage Δ
provider-base 18.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hook25 Hook25 merged commit b0342ff into main Jul 22, 2024
@Hook25 Hook25 deleted the journalctl-log-for-failing-services branch July 22, 2024 14:05
pedro-avalos pushed a commit that referenced this pull request Jul 29, 2024
…1353)

* Added journalctl lines to the failed_service_check script

* added the plain flag to not deal with the starting dots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants