Skip to content

Commit

Permalink
[2.x] Adds health check command (#153)
Browse files Browse the repository at this point in the history
* add health check command

* hide command

* fix tests
  • Loading branch information
joedixon authored Apr 25, 2023
1 parent a6b47a0 commit 83fe61a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
39 changes: 39 additions & 0 deletions src/Console/Commands/VaporHealthCheckCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Laravel\Vapor\Console\Commands;

use Illuminate\Console\Command;

class VaporHealthCheckCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $signature = 'vapor:health-check';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Check the health of the Vapor application';

/**
* Indicates whether the command should be shown in the Artisan command list.
*
* @var bool
*/
protected $hidden = true;

/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
return $this->info('Health check complete!');
}
}
7 changes: 6 additions & 1 deletion src/VaporServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/ApiGatewayOctaneHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ public function test_request_file_uploads()
Content-Type: text/plain
foo
-----------------------------317050813134112680482597024243--
EOF
]);
Expand Down Expand Up @@ -435,7 +434,6 @@ public function test_request_file_uploads_without_inline_input_method()
Content-Type: text/plain
foo
-----------------------------317050813134112680482597024243--
EOF
]);
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/LambdaProxyOctaneHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ public function test_request_file_uploads()
Content-Type: text/plain
foo
-----------------------------317050813134112680482597024243--
EOF
]);
Expand Down Expand Up @@ -524,7 +523,6 @@ public function test_request_file_uploads_without_inline_input_method()
Content-Type: text/plain
foo
-----------------------------317050813134112680482597024243--
EOF
]);
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/LoadBalancedOctaneHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ public function test_request_file_uploads()
Content-Type: text/plain
foo
-----------------------------317050813134112680482597024243--
EOF
]);
Expand Down Expand Up @@ -389,7 +388,6 @@ public function test_request_file_uploads_without_inline_input_method()
Content-Type: text/plain
foo
-----------------------------317050813134112680482597024243--
EOF
]);
Expand Down

0 comments on commit 83fe61a

Please sign in to comment.