Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
go-vehikl committed Nov 21, 2024
1 parent 308f706 commit d8d44d0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\Exceptions\Repository\DuplicateDatabaseNameException;
use App\Exceptions\Service\Database\TooManyDatabasesException;
use App\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException;
use Database\Factories\NodeFactory;

class DatabaseManagementServiceTest extends IntegrationTestCase
{
Expand Down Expand Up @@ -118,7 +119,7 @@ public function testServerDatabaseCanBeCreated(): void
$server = $this->createServerModel();
$name = DatabaseManagementService::generateUniqueDatabaseName('something', $server->id);

$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
$host = DatabaseHost::factory()->recycle($server->node)->create();

$username = null;
$secondUsername = null;
Expand All @@ -139,7 +140,7 @@ public function testServerDatabaseCanBeCreated(): void
$this->assertDatabaseHas('databases', ['server_id' => $server->id, 'id' => $response->id]);
}

/**
/**
* Test that an exception encountered while creating the database leads to the cleanup code
* being called and any exceptions encountered while cleaning up go unreported.
*/
Expand All @@ -155,7 +156,7 @@ public function testExceptionEncounteredWhileCreatingDatabaseAttemptsToCleanup()
$server = $this->createServerModel();
$name = DatabaseManagementService::generateUniqueDatabaseName('something', $server->id);

$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
$host = DatabaseHost::factory()->recycle($server->node)->create();

$this->repository->expects('createDatabase')->with($name)->andThrows(new \BadMethodCallException());
$this->repository->expects('dropDatabase')->with($name);
Expand Down

0 comments on commit d8d44d0

Please sign in to comment.