Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Cleans up tests.

Joao Patricioa642cc2470b0
diff --git a/app/Actions/RemoteProcess/RunRemoteProcess.php b/app/Actions/RemoteProcess/RunRemoteProcess.php
index 6627c1bd7c..ecf1d660b7 100644
--- a/app/Actions/RemoteProcess/RunRemoteProcess.php
+++ b/app/Actions/RemoteProcess/RunRemoteProcess.php
@@ -31,7 +31,7 @@ class RunRemoteProcess
/**
* Create a new job instance.
*/
- public function __construct(Activity $activity, bool $hideFromOutput)
+ public function __construct(Activity $activity, bool $hideFromOutput = false)
{
if ($activity->getExtraProperty('type') !== ActivityTypes::REMOTE_PROCESS->value && $activity->getExtraProperty('type') !== ActivityTypes::DEPLOYMENT->value) {
diff --git a/bootstrap/helpers.php b/bootstrap/helpers.php
index d68d413b44..ef1183cf7a 100644
--- a/bootstrap/helpers.php
+++ b/bootstrap/helpers.php
@@ -23,7 +23,9 @@ if (!function_exists('remoteProcess')) {
?string $deployment_uuid = null,
?Model $model = null,
): Activity {
+
$command_string = implode("\n", $command);
+
// @TODO: Check if the user has access to this server
// checkTeam($server->team_id);
@@ -31,7 +33,6 @@ if (!function_exists('remoteProcess')) {
return resolve(DispatchRemoteProcess::class, [
'remoteProcessArgs' => new RemoteProcessArgs(
- model: $model,
server_ip: $server->ip,
private_key_location: $private_key_location,
deployment_uuid: $deployment_uuid,
@@ -41,6 +42,7 @@ if (!function_exists('remoteProcess')) {
port: $server->port,
user: $server->user,
type: $deployment_uuid ? ActivityTypes::DEPLOYMENT->value : ActivityTypes::REMOTE_PROCESS->value,
+ model: $model,
),
])();
}
diff --git a/tests/Feature/DockerCommandsTest.php b/tests/Feature/DockerCommandsTest.php
index f7b88de6c6..322ca734cc 100644
--- a/tests/Feature/DockerCommandsTest.php
+++ b/tests/Feature/DockerCommandsTest.php
@@ -16,6 +16,7 @@ beforeEach(function () {
it('starts a docker container correctly', function () {
+
test()->actingAs(User::factory([
'uuid' => Str::uuid(),
'email' => Str::uuid().'@example.com',
@@ -31,22 +32,9 @@ it('starts a docker container correctly', function () {
$containerName = 'coolify_test_' . now()->format('Ymd_his');
$host = Server::where('name', 'testing-local-docker-container')->first();
- // Stop testing containers
- $activity = remoteProcess([
- "docker stop $(docker ps --filter='name={$coolifyNamePrefix}*' -aq)",
- "docker rm $(docker ps --filter='name={$coolifyNamePrefix}*' -aq)",
- ], $host);
-
- throw_if(
- $activity->getExtraProperty('exitCode') !== 0,
- new RuntimeException($activity->description),
- );
-
- expect($activity->getExtraProperty('exitCode'))->toBe(0);
-
// Assert there's no containers start with coolify_test_*
$activity = remoteProcess([$areThereCoolifyTestContainers], $host);
- $containers = formatDockerCmdOutputToJson($activity->getExtraProperty('stdout'));
+ $containers = formatDockerCmdOutputToJson($activity->description);
expect($containers)->toBeEmpty();
// start a container nginx -d --name = $containerName
@@ -55,13 +43,13 @@ it('starts a docker container correctly', function () {
// docker ps name = $container
$activity = remoteProcess([$areThereCoolifyTestContainers], $host);
- $containers = formatDockerCmdOutputToJson($activity->getExtraProperty('stdout'));
+ $containers = formatDockerCmdOutputToJson($activity->description);
expect($containers->where('Names', $containerName)->count())->toBe(1);
// Stop testing containers
$activity = remoteProcess([
- "docker stop $(docker ps --filter='name={$coolifyNamePrefix}*' -aq)",
- "docker rm $(docker ps --filter='name={$coolifyNamePrefix}*' -aq)",
+ "docker ps --filter='name={$coolifyNamePrefix}*' -aq && " .
+ "docker rm -f $(docker ps --filter='name={$coolifyNamePrefix}*' -aq)"
], $host);
expect($activity->getExtraProperty('exitCode'))->toBe(0);
});