-
Notifications
You must be signed in to change notification settings - Fork 45
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 health-check:health command #44
Conversation
Hi @tylerwoonton , I thought it's ready, but tests fails and I don't understand why it fails only on PHP 7.1 |
@tylerwoonton , PR is ready) tests code a little messy because of php5 && laravel 5 supports. |
@idsulik Excellent. I'll take a look. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers for the PR. I think Tyler might have some extra stuff to add, but I've noticed a couple of bits.
Thanks for adding in the docblocks too 👍
} | ||
} | ||
|
||
if (!$isOkay) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion, but instead of keeping track of an isOkay
variable, you could check if empty($problems)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a little refactoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @idsulik!
Just a couple of tweaks from @Gman98ish and I.
Tag me when you're ready for me to have another look and I'll pull it into an app and have a proper test! 😄
|
||
protected $description = 'Check health status'; | ||
|
||
public function handle() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, one thing I'd like this command to do is allow us to disable certain checks from being ran by this command per run.
If we could add a --disable=
option, that'd be great! I imagine we'd pass the $name
property of the check and then use that to determine whether to process the check.
https://laravel.com/docs/8.x/artisan#options-with-values
e.g.
php artisan health-check:status --disable=log,http
or
php artisan health-check:status --disable=log --disable=http
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add --disable=log,cache
option
$mock->shouldReceive('name')->andReturn('log'); | ||
$mock->shouldReceive('status')->andReturn($status); | ||
})); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests look great! Just leaving a note here to add a test case to cover the --disable
option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add as separate test method
I think it'll better to add ability to include or exclude specific checks, so I add |
@idsulik I like that idea! I think by default it should run all the checks and add |
Yeah, by default it checks all the checks, but you can pass --only OR --except to run/exclude specific checks. |
That sounds good to me! |
Add command to check helath in console mode -
health-check:health
.Made some refactoring