From 83fe61ad0b0f93ed5fcc115a63eff667de718840 Mon Sep 17 00:00:00 2001 From: Joe Dixon Date: Tue, 25 Apr 2023 09:47:32 +0100 Subject: [PATCH] [2.x] Adds health check command (#153) * add health check command * hide command * fix tests --- .../Commands/VaporHealthCheckCommand.php | 39 +++++++++++++++++++ src/VaporServiceProvider.php | 7 +++- tests/Feature/ApiGatewayOctaneHandlerTest.php | 2 - .../Feature/LambdaProxyOctaneHandlerTest.php | 2 - .../Feature/LoadBalancedOctaneHandlerTest.php | 2 - 5 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 src/Console/Commands/VaporHealthCheckCommand.php diff --git a/src/Console/Commands/VaporHealthCheckCommand.php b/src/Console/Commands/VaporHealthCheckCommand.php new file mode 100644 index 0000000..d962bda --- /dev/null +++ b/src/Console/Commands/VaporHealthCheckCommand.php @@ -0,0 +1,39 @@ +info('Health check complete!'); + } +} diff --git a/src/VaporServiceProvider.php b/src/VaporServiceProvider.php index 43eb0f0..0f7c0dc 100644 --- a/src/VaporServiceProvider.php +++ b/src/VaporServiceProvider.php @@ -10,6 +10,7 @@ use Illuminate\Support\ServiceProvider; use InvalidArgumentException; use Laravel\Vapor\Console\Commands\OctaneStatusCommand; +use Laravel\Vapor\Console\Commands\VaporHealthCheckCommand; use Laravel\Vapor\Console\Commands\VaporQueueListFailedCommand; use Laravel\Vapor\Console\Commands\VaporWorkCommand; use Laravel\Vapor\Http\Controllers\SignedStorageUrlController; @@ -168,7 +169,11 @@ protected function registerCommands() return new VaporQueueListFailedCommand; }); - $this->commands(['command.vapor.work', 'command.vapor.queue-failed']); + $this->app->singleton('command.vapor.health-check', function () { + return new VaporHealthCheckCommand; + }); + + $this->commands(['command.vapor.work', 'command.vapor.queue-failed', 'command.vapor.health-check']); } /** diff --git a/tests/Feature/ApiGatewayOctaneHandlerTest.php b/tests/Feature/ApiGatewayOctaneHandlerTest.php index 887ebce..48c74dc 100644 --- a/tests/Feature/ApiGatewayOctaneHandlerTest.php +++ b/tests/Feature/ApiGatewayOctaneHandlerTest.php @@ -390,7 +390,6 @@ public function test_request_file_uploads() Content-Type: text/plain foo - -----------------------------317050813134112680482597024243-- EOF ]); @@ -435,7 +434,6 @@ public function test_request_file_uploads_without_inline_input_method() Content-Type: text/plain foo - -----------------------------317050813134112680482597024243-- EOF ]); diff --git a/tests/Feature/LambdaProxyOctaneHandlerTest.php b/tests/Feature/LambdaProxyOctaneHandlerTest.php index e88aec6..7a69cb5 100644 --- a/tests/Feature/LambdaProxyOctaneHandlerTest.php +++ b/tests/Feature/LambdaProxyOctaneHandlerTest.php @@ -474,7 +474,6 @@ public function test_request_file_uploads() Content-Type: text/plain foo - -----------------------------317050813134112680482597024243-- EOF ]); @@ -524,7 +523,6 @@ public function test_request_file_uploads_without_inline_input_method() Content-Type: text/plain foo - -----------------------------317050813134112680482597024243-- EOF ]); diff --git a/tests/Feature/LoadBalancedOctaneHandlerTest.php b/tests/Feature/LoadBalancedOctaneHandlerTest.php index 9f08af6..5ec80fe 100644 --- a/tests/Feature/LoadBalancedOctaneHandlerTest.php +++ b/tests/Feature/LoadBalancedOctaneHandlerTest.php @@ -344,7 +344,6 @@ public function test_request_file_uploads() Content-Type: text/plain foo - -----------------------------317050813134112680482597024243-- EOF ]); @@ -389,7 +388,6 @@ public function test_request_file_uploads_without_inline_input_method() Content-Type: text/plain foo - -----------------------------317050813134112680482597024243-- EOF ]);