Merge branch 'develop' into dane/restore-backups
This commit is contained in:
commit
663143de0b
575 changed files with 6080 additions and 6864 deletions
|
@ -36,7 +36,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
|||
$server2 = $this->createServerModel();
|
||||
|
||||
/** @var \Pterodactyl\Models\Allocation[] $allocations */
|
||||
$allocations = factory(Allocation::class)->times(4)->create(['node_id' => $server->node_id, 'notes' => 'Random notes']);
|
||||
$allocations = Allocation::factory()->times(4)->create(['node_id' => $server->node_id, 'notes' => 'Random notes']);
|
||||
|
||||
$initialAllocationId = $server->allocation_id;
|
||||
$allocations[0]->update(['server_id' => $server->id, 'notes' => 'Test notes']);
|
||||
|
@ -83,7 +83,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
|||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \Pterodactyl\Models\Allocation[] $allocations */
|
||||
$allocations = factory(Allocation::class)->times(4)->create(['node_id' => $server->node_id]);
|
||||
$allocations = Allocation::factory()->times(4)->create(['node_id' => $server->node_id]);
|
||||
|
||||
$allocations[0]->update(['server_id' => $server->id]);
|
||||
|
||||
|
@ -155,8 +155,8 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
|||
public function testNoExceptionIsThrownIfOnlyRemovingAllocation()
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \Pterodactyl\Models\Allocation[] $allocations */
|
||||
$allocation = factory(Allocation::class)->create(['node_id' => $server->node_id, 'server_id' => $server->id]);
|
||||
/** @var \Pterodactyl\Models\Allocation $allocation */
|
||||
$allocation = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id]);
|
||||
|
||||
$this->daemonServerRepository->expects('setServer->update')->andReturnUndefined();
|
||||
|
||||
|
@ -178,8 +178,8 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
|||
public function testAllocationInBothAddAndRemoveIsAdded()
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \Pterodactyl\Models\Allocation[] $allocations */
|
||||
$allocation = factory(Allocation::class)->create(['node_id' => $server->node_id]);
|
||||
/** @var \Pterodactyl\Models\Allocation $allocation */
|
||||
$allocation = Allocation::factory()->create(['node_id' => $server->node_id]);
|
||||
|
||||
$this->daemonServerRepository->expects('setServer->update')->andReturnUndefined();
|
||||
|
||||
|
@ -197,9 +197,10 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
|||
public function testUsingSameAllocationIdMultipleTimesDoesNotError()
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \Pterodactyl\Models\Allocation[] $allocations */
|
||||
$allocation = factory(Allocation::class)->create(['node_id' => $server->node_id, 'server_id' => $server->id]);
|
||||
$allocation2 = factory(Allocation::class)->create(['node_id' => $server->node_id]);
|
||||
/** @var \Pterodactyl\Models\Allocation $allocation */
|
||||
$allocation = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id]);
|
||||
/** @var \Pterodactyl\Models\Allocation $allocation2 */
|
||||
$allocation2 = Allocation::factory()->create(['node_id' => $server->node_id]);
|
||||
|
||||
$this->daemonServerRepository->expects('setServer->update')->andReturnUndefined();
|
||||
|
||||
|
@ -219,8 +220,8 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
|||
public function testThatUpdatesAreRolledBackIfExceptionIsEncountered()
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \Pterodactyl\Models\Allocation[] $allocations */
|
||||
$allocation = factory(Allocation::class)->create(['node_id' => $server->node_id]);
|
||||
/** @var \Pterodactyl\Models\Allocation $allocation */
|
||||
$allocation = Allocation::factory()->create(['node_id' => $server->node_id]);
|
||||
|
||||
$this->daemonServerRepository->expects('setServer->update')->andThrows(new DisplayException('Test'));
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ namespace Pterodactyl\Tests\Integration\Services\Servers;
|
|||
|
||||
use Mockery;
|
||||
use Pterodactyl\Models\Egg;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\User;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Pterodactyl\Models\Objects\DeploymentObject;
|
||||
use Pterodactyl\Tests\Integration\IntegrationTestCase;
|
||||
use Pterodactyl\Services\Servers\ServerCreationService;
|
||||
|
@ -48,15 +48,18 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
|||
public function testServerIsCreatedWithDeploymentObject()
|
||||
{
|
||||
/** @var \Pterodactyl\Models\User $user */
|
||||
$user = factory(User::class)->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
/** @var \Pterodactyl\Models\Location $location */
|
||||
$location = Location::factory()->create();
|
||||
|
||||
/** @var \Pterodactyl\Models\Node $node */
|
||||
$node = factory(Node::class)->create([
|
||||
'location_id' => factory(Location::class)->create()->id,
|
||||
$node = Node::factory()->create([
|
||||
'location_id' => $location->id,
|
||||
]);
|
||||
|
||||
/** @var \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations */
|
||||
$allocations = factory(Allocation::class)->times(5)->create([
|
||||
$allocations = Allocation::factory()->times(5)->create([
|
||||
'node_id' => $node->id,
|
||||
]);
|
||||
|
||||
|
@ -156,15 +159,18 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
|||
public function testErrorEncounteredByWingsCausesServerToBeDeleted()
|
||||
{
|
||||
/** @var \Pterodactyl\Models\User $user */
|
||||
$user = factory(User::class)->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
/** @var \Pterodactyl\Models\Location $location */
|
||||
$location = Location::factory()->create();
|
||||
|
||||
/** @var \Pterodactyl\Models\Node $node */
|
||||
$node = factory(Node::class)->create([
|
||||
'location_id' => factory(Location::class)->create()->id,
|
||||
$node = Node::factory()->create([
|
||||
'location_id' => $location->id,
|
||||
]);
|
||||
|
||||
/** @var \Pterodactyl\Models\Allocation $allocation */
|
||||
$allocation = factory(Allocation::class)->create([
|
||||
$allocation = Allocation::factory()->create([
|
||||
'node_id' => $node->id,
|
||||
]);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Mockery;
|
|||
use Exception;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
|
@ -65,7 +66,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
|||
$this->expectException(DaemonConnectionException::class);
|
||||
|
||||
$this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andThrows(
|
||||
new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test')))
|
||||
new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test'), new Response()))
|
||||
);
|
||||
|
||||
$this->getService()->handle($server);
|
||||
|
@ -113,17 +114,17 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
|||
public function testExceptionWhileDeletingStopsProcess()
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$host = factory(DatabaseHost::class)->create();
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
||||
/** @var \Pterodactyl\Models\Database $db */
|
||||
$db = factory(Database::class)->create(['database_host_id' => $host->id, 'server_id' => $server->id]);
|
||||
$db = Database::factory()->create(['database_host_id' => $host->id, 'server_id' => $server->id]);
|
||||
|
||||
$server->refresh();
|
||||
|
||||
$this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined();
|
||||
$this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) {
|
||||
return $value instanceof Database && $value->id === $db->id;
|
||||
}))->andThrows(new Exception);
|
||||
}))->andThrows(new Exception());
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->getService()->handle($server);
|
||||
|
@ -138,17 +139,17 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
|||
public function testExceptionWhileDeletingDatabasesDoesNotAbortIfForceDeleted()
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$host = factory(DatabaseHost::class)->create();
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
||||
/** @var \Pterodactyl\Models\Database $db */
|
||||
$db = factory(Database::class)->create(['database_host_id' => $host->id, 'server_id' => $server->id]);
|
||||
$db = Database::factory()->create(['database_host_id' => $host->id, 'server_id' => $server->id]);
|
||||
|
||||
$server->refresh();
|
||||
|
||||
$this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined();
|
||||
$this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) {
|
||||
return $value instanceof Database && $value->id === $db->id;
|
||||
}))->andThrows(new Exception);
|
||||
}))->andThrows(new Exception());
|
||||
|
||||
$this->getService()->withForce(true)->handle($server);
|
||||
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
namespace Pterodactyl\Tests\Integration\Services\Servers;
|
||||
|
||||
use Exception;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\ServerVariable;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
|
|
@ -92,7 +92,6 @@ class VariableValidatorServiceTest extends IntegrationTestCase
|
|||
$this->assertArrayHasKey('environment.BUNGEE_VERSION', $exception->errors());
|
||||
}
|
||||
|
||||
|
||||
$response = $this->getService()->setUserLevel(User::USER_LEVEL_ADMIN)->handle($egg->id, [
|
||||
'BUNGEE_VERSION' => '123',
|
||||
'SERVER_JARFILE' => 'server.jar',
|
||||
|
|
Reference in a new issue