Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --severity-min parameter to watchdog commands #5298

Merged
merged 10 commits into from
Nov 11, 2022

Conversation

jonathan1055
Copy link
Contributor

@jonathan1055 jonathan1055 commented Nov 7, 2022

Initial version of new --severity-min parameter.
Some tests failed locally, but I think that was an unrelated problem.

This feature came out of a discussion on slack

@jonathan1055
Copy link
Contributor Author

No test coverage yet obviously. Will add when the approach is agreed.

@jonathan1055
Copy link
Contributor Author

jonathan1055 commented Nov 8, 2022

At @weitzman's request I re-worked this to be a --severity-min parameter. This can be used in wd-show and wd-tail. It is not (yet) used in the interactive wd-list as that would require more work to change the user input (but could be done if required). I have also not implemented it in wd-del as I did not think it necessary. But again it could be added there if required. The two parameters --severity and --severity-min cannot both be set on the same call, because the presence of one or the other one is how we tell which filtering to do.

@jonathan1055 jonathan1055 changed the title Add --range parameter to wd commands Add --severity-min parameter to watchdog commands Nov 8, 2022
@jonathan1055
Copy link
Contributor Author

jonathan1055 commented Nov 8, 2022

The test failure is only on the D10 test build. This looks to be unrelated to my change, but I'm not really sure.

TTY mode requires /dev/tty to be read/writable.

Copy link
Member

@weitzman weitzman left a comment

Choose a reason for hiding this comment

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

LGTM. One minor adjustment needed.

I think you canadd a few lines to WatchdogTest and get decent test coverage for the new option. Thanks.

src/Drupal/Commands/core/WatchdogCommands.php Outdated Show resolved Hide resolved
@jonathan1055
Copy link
Contributor Author

jonathan1055 commented Nov 8, 2022

The additional part of the watchdog test passes on mysql and postgres but fails on sqlite. The wd-delete using text filter did not delete the row.
https://app.circleci.com/pipelines/github/drush-ops/drush/4307/workflows/62071fed-aeb5-466a-b5f9-88e27532c403/jobs/25911

@jonathan1055
Copy link
Contributor Author

I could remove that wd-delete and the tests might pass on sqlite

@jonathan1055
Copy link
Contributor Author

In the mysql deletion test, after removing all messsges and adding the new, we have

>>>>> 1
---- -------------- ------- ---------- ------------------ 
  ID   Date           Type    Severity   Message           
 ---- -------------- ------- ---------- ------------------ 
  5    09/Nov 14:41   drush   Critical   *** Exterminate!  
  4    09/Nov 14:41   drush   Error      Obliterate        
  3    09/Nov 14:41   drush   Warning    Eliminate         
  2    09/Nov 14:41   drush   Notice     Delete            
  1    09/Nov 14:41   other   Info       Scrub             
 ---- -------------- ------- ---------- ------------------

But in the postgres and sqlite tests the ids continue from the previous test (even though those messages have been deleted). We see

>>>>> 1
---- -------------- ------- ---------- ------------------ 
  ID   Date           Type    Severity   Message           
 ---- -------------- ------- ---------- ------------------ 
  10   09/Nov 14:41   drush   Critical   *** Exterminate!  
  9    09/Nov 14:41   drush   Error      Obliterate        
  8    09/Nov 14:41   drush   Warning    Eliminate         
  7    09/Nov 14:41   drush   Notice     Delete            
  6    09/Nov 14:41   other   Info       Scrub             
 ---- -------------- ------- ---------- ------------------

So I think testing 'delete by id' is not going to be worth the effort.

@jonathan1055
Copy link
Contributor Author

The test build has not been triggered. Maybe it was because I did a force-push? I thought I had done that before and it was all OK.

@jonathan1055 jonathan1055 requested review from weitzman and removed request for greg-1-anderson November 9, 2022 19:19
@jonathan1055
Copy link
Contributor Author

jonathan1055 commented Nov 9, 2022

The new integration tests pass in all builds. The failing section (same as before, rw for dev/tty) is the functional test in D10, which runs phpunit 9.5.26, whereas the others are all 9.5.25, I don't know if that is significant.

@weitzman weitzman merged commit 69e4abb into drush-ops:11.x Nov 11, 2022
@weitzman
Copy link
Member

Test failure is unrelated. Thank you!

@jonathan1055 jonathan1055 deleted the wd-range branch November 11, 2022 12:56
@jonathan1055
Copy link
Contributor Author

Thanks. That's my first committed contribution to drush :-)

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.

None yet

2 participants