PostgreSQL Support (#4486)

Co-authored-by: Matthew Penner <matthew@pterodactyl.io>
This commit is contained in:
Lance Pioch 2022-11-25 15:29:04 -05:00 committed by GitHub
parent 21613fa602
commit 3bf5a71802
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
223 changed files with 912 additions and 1052 deletions

View file

@ -249,7 +249,7 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase
*/
public function testGetMissingLocation()
{
$response = $this->getJson('/api/application/locations/nil');
$response = $this->getJson('/api/application/locations/0');
$this->assertNotFoundJson($response);
}

View file

@ -104,7 +104,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
{
$egg = Egg::query()->findOrFail(1);
$response = $this->getJson('/api/application/nests/' . $egg->nest_id . '/eggs/nil');
$response = $this->getJson('/api/application/nests/' . $egg->nest_id . '/eggs/0');
$this->assertNotFoundJson($response);
}

View file

@ -108,7 +108,7 @@ class NestControllerTest extends ApplicationApiIntegrationTestCase
*/
public function testGetMissingNest()
{
$response = $this->getJson('/api/application/nests/nil');
$response = $this->getJson('/api/application/nests/0');
$this->assertNotFoundJson($response);
}

View file

@ -51,7 +51,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
*/
public function testGetMissingUser()
{
$response = $this->getJson('/api/application/users/external/nil');
$response = $this->getJson('/api/application/users/external/0');
$this->assertNotFoundJson($response);
}

View file

@ -184,7 +184,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
*/
public function testGetMissingUser()
{
$response = $this->getJson('/api/application/users/nil');
$response = $this->getJson('/api/application/users/0');
$this->assertNotFoundJson($response);
}

View file

@ -18,10 +18,10 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testOnlyLoggedInUsersServersAreReturned()
{
/** @var \Pterodactyl\Models\User[] $users */
/** @var User[] $users */
$users = User::factory()->times(3)->create();
/** @var \Pterodactyl\Models\Server[] $servers */
/** @var Server[] $servers */
$servers = [
$this->createServerModel(['user_id' => $users[0]->id]),
$this->createServerModel(['user_id' => $users[1]->id]),
@ -45,11 +45,11 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testServersAreFilteredUsingNameAndUuidInformation()
{
/** @var \Pterodactyl\Models\User[] $users */
/** @var User[] $users */
$users = User::factory()->times(2)->create();
$users[0]->update(['root_admin' => true]);
/** @var \Pterodactyl\Models\Server[] $servers */
/** @var Server[] $servers */
$servers = [
$this->createServerModel(['user_id' => $users[0]->id, 'name' => 'Julia']),
$this->createServerModel(['user_id' => $users[1]->id, 'uuidShort' => '12121212', 'name' => 'Janice']),
@ -101,8 +101,8 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testServersAreFilteredUsingAllocationInformation()
{
/** @var \Pterodactyl\Models\User $user */
/** @var \Pterodactyl\Models\Server $server */
/** @var User $user */
/** @var Server $server */
[$user, $server] = $this->generateTestAccount();
$server2 = $this->createServerModel(['user_id' => $user->id, 'node_id' => $server->node_id]);
@ -143,7 +143,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testServersUserIsASubuserOfAreReturned()
{
/** @var \Pterodactyl\Models\User[] $users */
/** @var User[] $users */
$users = User::factory()->times(3)->create();
$servers = [
$this->createServerModel(['user_id' => $users[0]->id]),
@ -174,7 +174,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testFilterOnlyOwnerServers()
{
/** @var \Pterodactyl\Models\User[] $users */
/** @var User[] $users */
$users = User::factory()->times(3)->create();
$servers = [
$this->createServerModel(['user_id' => $users[0]->id]),
@ -203,7 +203,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testPermissionsAreReturned()
{
/** @var \Pterodactyl\Models\User $user */
/** @var User $user */
$user = User::factory()->create();
$this->actingAs($user)
@ -223,7 +223,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testOnlyAdminLevelServersAreReturned()
{
/** @var \Pterodactyl\Models\User[] $users */
/** @var User[] $users */
$users = User::factory()->times(4)->create();
$users[0]->update(['root_admin' => true]);
@ -258,7 +258,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testAllServersAreReturnedToAdmin()
{
/** @var \Pterodactyl\Models\User[] $users */
/** @var User[] $users */
$users = User::factory()->times(4)->create();
$users[0]->update(['root_admin' => true]);
@ -290,7 +290,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testNoServersAreReturnedIfAdminFilterIsPassedByRegularUser(string $type)
{
/** @var \Pterodactyl\Models\User[] $users */
/** @var User[] $users */
$users = User::factory()->times(3)->create();
$this->createServerModel(['user_id' => $users[0]->id]);
@ -309,7 +309,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
*/
public function testOnlyPrimaryAllocationIsReturnedToSubuser()
{
/** @var \Pterodactyl\Models\Server $server */
/** @var Server $server */
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
$server->allocation->notes = 'Test notes';
$server->allocation->save();

View file

@ -42,7 +42,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase
$response->assertJsonPath('object', 'list');
$response->assertJsonCount(1, 'data');
$response->assertJsonPath('data.0.object', EggVariable::RESOURCE_NAME);
$this->assertJsonTransformedWith($response->json('data.0.attributes'), $egg->variables[1]);
$this->assertJsonTransformedWith($response->json('data.0.attributes'), $egg->variables()->orderBy('id', 'desc')->first());
}
/**