mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 03:26:52 +01:00 
			
		
		
		
	 3d764a89f7
			
		
	
	
		3d764a89f7
		
			
		
	
	
	
	
		
			
			* chore: yarn upgrade * chore: composer upgrade * chore: php artisan filament:upgrade * chore: update filament-monaco-editor-views * chore: update filament-monaco-editor-configs * chore: move turnstile-views to plugins * fix monaco-editor loader & css
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Tests\Integration\Api\Client\Server;
 | |
| 
 | |
| use App\Models\Permission;
 | |
| use App\Repositories\Daemon\DaemonServerRepository;
 | |
| use App\Tests\Integration\Api\Client\ClientApiIntegrationTestCase;
 | |
| 
 | |
| class ResourceUtilizationControllerTest extends ClientApiIntegrationTestCase
 | |
| {
 | |
|     /**
 | |
|      * Test that the resource utilization for a server is returned in the expected format.
 | |
|      */
 | |
|     public function test_server_resource_utilization_is_returned(): void
 | |
|     {
 | |
|         $service = \Mockery::mock(DaemonServerRepository::class);
 | |
|         $this->app->instance(DaemonServerRepository::class, $service);
 | |
| 
 | |
|         [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
 | |
| 
 | |
|         $service->expects('setServer')->with(\Mockery::on(function ($value) use ($server) {
 | |
|             return $server->uuid === $value->uuid;
 | |
|         }))->andReturnSelf()->getMock()->expects('getDetails')->andReturns([]);
 | |
| 
 | |
|         $response = $this->actingAs($user)->getJson("/api/client/servers/$server->uuid/resources");
 | |
| 
 | |
|         $response->assertOk();
 | |
|         $response->assertJson([
 | |
|             'object' => 'stats',
 | |
|             'attributes' => [
 | |
|                 'current_state' => 'stopped',
 | |
|                 'is_suspended' => false,
 | |
|                 'resources' => [
 | |
|                     'memory_bytes' => 0,
 | |
|                     'cpu_absolute' => 0,
 | |
|                     'disk_bytes' => 0,
 | |
|                     'network_rx_bytes' => 0,
 | |
|                     'network_tx_bytes' => 0,
 | |
|                 ],
 | |
|             ],
 | |
|         ]);
 | |
|     }
 | |
| }
 |