From eef66216da979af33dda068fdfcbe7b3a98d2a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Olivera?= Date: Tue, 17 Sep 2019 18:31:23 -0300 Subject: [PATCH] test(servidor): evitar exceder los limites de memoria MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La librería Eloquence utiliza una cantidad excesiva de memoria RAM (memory leak), lo que provoca un error fatal (Allowed memory size of 134217728 bytes exhausted) cuando se ejecutan los tests --- .circleci/config.yml | 2 +- server/tests/Feature/app/ClienteDomicilioTest.php | 2 ++ server/tests/Feature/app/ClienteRazonSocialTest.php | 2 ++ server/tests/Feature/app/ClienteTelefonoTest.php | 2 ++ server/tests/Feature/app/ClienteTest.php | 2 ++ server/tests/Feature/app/CotizacionEstadoTest.php | 2 ++ server/tests/Feature/app/CotizacionProductoTest.php | 2 ++ server/tests/Feature/app/CotizacionTest.php | 2 ++ server/tests/Feature/app/EmpleadoCargoTest.php | 2 ++ server/tests/Feature/app/EmpleadoTest.php | 2 ++ server/tests/Feature/app/PedidoEstadoTest.php | 2 ++ server/tests/Feature/app/PedidoTest.php | 2 ++ server/tests/Feature/app/ProductoTest.php | 2 ++ 13 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 200389f0..e60187a4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,7 +89,7 @@ jobs: - run: cd server && php artisan migrate --env=testing --force # ejecutar los tests unitarios - - run: cd server && phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage/clover.xml + - run: cd server && phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage/clover.xml -d memory_limit=512M - store_artifacts: path: server/coverage/clover.xml # subir la cobertura del código a codecov diff --git a/server/tests/Feature/app/ClienteDomicilioTest.php b/server/tests/Feature/app/ClienteDomicilioTest.php index 1f53513f..b7051ead 100644 --- a/server/tests/Feature/app/ClienteDomicilioTest.php +++ b/server/tests/Feature/app/ClienteDomicilioTest.php @@ -6,11 +6,13 @@ use Tests\TestCase; use App\ClienteDomicilio; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; class ClienteDomicilioTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; public function test_deberia_acceder_a_la_relacion_cotizaciones() { diff --git a/server/tests/Feature/app/ClienteRazonSocialTest.php b/server/tests/Feature/app/ClienteRazonSocialTest.php index ec5537b5..677a400f 100644 --- a/server/tests/Feature/app/ClienteRazonSocialTest.php +++ b/server/tests/Feature/app/ClienteRazonSocialTest.php @@ -6,11 +6,13 @@ use Tests\TestCase; use App\ClienteRazonSocial; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; class ClienteRazonSocialTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; public function test_deberia_acceder_a_la_relacion_cotizaciones() { diff --git a/server/tests/Feature/app/ClienteTelefonoTest.php b/server/tests/Feature/app/ClienteTelefonoTest.php index 6f969c61..0d5eadab 100644 --- a/server/tests/Feature/app/ClienteTelefonoTest.php +++ b/server/tests/Feature/app/ClienteTelefonoTest.php @@ -6,11 +6,13 @@ use Tests\TestCase; use App\ClienteTelefono; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; class ClienteTelefonoTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; public function test_deberia_acceder_a_la_relacion_cotizaciones() { diff --git a/server/tests/Feature/app/ClienteTest.php b/server/tests/Feature/app/ClienteTest.php index c83c4c6e..9f4f9752 100644 --- a/server/tests/Feature/app/ClienteTest.php +++ b/server/tests/Feature/app/ClienteTest.php @@ -6,11 +6,13 @@ use App\Cotizacion; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; class ClienteTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; public function test_deberia_acceder_a_la_relacion_cotizaciones() { diff --git a/server/tests/Feature/app/CotizacionEstadoTest.php b/server/tests/Feature/app/CotizacionEstadoTest.php index 289281ee..44f0f72d 100644 --- a/server/tests/Feature/app/CotizacionEstadoTest.php +++ b/server/tests/Feature/app/CotizacionEstadoTest.php @@ -6,12 +6,14 @@ use Tests\TestCase; use App\CotizacionEstado; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\Feature\Utilidades\EstructuraCotizacionEstado; class CotizacionEstadoTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; use EstructuraCotizacionEstado; public function test_deberia_crear_un_estado() diff --git a/server/tests/Feature/app/CotizacionProductoTest.php b/server/tests/Feature/app/CotizacionProductoTest.php index 05d4d55d..6bec97bb 100644 --- a/server/tests/Feature/app/CotizacionProductoTest.php +++ b/server/tests/Feature/app/CotizacionProductoTest.php @@ -9,12 +9,14 @@ use CotizacionEstadoSeeder; use CategoriaProductoSeeder; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\Feature\Utilidades\EstructuraCotizacionProducto; class CotizacionProductoTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; use EstructuraCotizacionProducto; protected function setUp(): void diff --git a/server/tests/Feature/app/CotizacionTest.php b/server/tests/Feature/app/CotizacionTest.php index 1f8ef846..64744c01 100644 --- a/server/tests/Feature/app/CotizacionTest.php +++ b/server/tests/Feature/app/CotizacionTest.php @@ -15,12 +15,14 @@ use App\CotizacionProducto; use CategoriaProductoSeeder; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\Feature\Utilidades\EstructuraCotizacion; class CotizacionTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; use EstructuraCotizacion; protected function setUp(): void diff --git a/server/tests/Feature/app/EmpleadoCargoTest.php b/server/tests/Feature/app/EmpleadoCargoTest.php index c541d448..ff0a1ba3 100644 --- a/server/tests/Feature/app/EmpleadoCargoTest.php +++ b/server/tests/Feature/app/EmpleadoCargoTest.php @@ -6,12 +6,14 @@ use Tests\TestCase; use App\EmpleadoCargo; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\Feature\Utilidades\EstructuraEmpleadoCargo; class EmpleadoCargoTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; use EstructuraEmpleadoCargo; public function test_deberia_crear_un_cargo() diff --git a/server/tests/Feature/app/EmpleadoTest.php b/server/tests/Feature/app/EmpleadoTest.php index 5757b4f8..c717fafb 100644 --- a/server/tests/Feature/app/EmpleadoTest.php +++ b/server/tests/Feature/app/EmpleadoTest.php @@ -7,12 +7,14 @@ use Tests\TestCase; use App\EmpleadoCargo; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Tests\Feature\Utilidades\EstructuraEmpleado; use Illuminate\Foundation\Testing\RefreshDatabase; class EmpleadoTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; use EstructuraEmpleado; public function test_deberia_crear_un_empleado() diff --git a/server/tests/Feature/app/PedidoEstadoTest.php b/server/tests/Feature/app/PedidoEstadoTest.php index 1fcc236a..19be31f3 100644 --- a/server/tests/Feature/app/PedidoEstadoTest.php +++ b/server/tests/Feature/app/PedidoEstadoTest.php @@ -6,12 +6,14 @@ use Tests\TestCase; use App\PedidoEstado; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\Feature\Utilidades\EstructuraPedidoEstado; class PedidoEstadoTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; use EstructuraPedidoEstado; public function test_deberia_crear_un_estado() diff --git a/server/tests/Feature/app/PedidoTest.php b/server/tests/Feature/app/PedidoTest.php index cb3fa07a..4fb184e8 100644 --- a/server/tests/Feature/app/PedidoTest.php +++ b/server/tests/Feature/app/PedidoTest.php @@ -15,12 +15,14 @@ use App\ClienteRazonSocial; use Illuminate\Foundation\Testing\WithFaker; use Tests\Feature\Utilidades\EstructuraPedido; +use Tests\Feature\Utilidades\EloquenceSolucion; use Illuminate\Foundation\Testing\RefreshDatabase; class PedidoTest extends TestCase { use RefreshDatabase; use EstructuraPedido; + use EloquenceSolucion; public function test_deberia_crear_un_pedido() { diff --git a/server/tests/Feature/app/ProductoTest.php b/server/tests/Feature/app/ProductoTest.php index a0fa19d1..a0d5f5af 100644 --- a/server/tests/Feature/app/ProductoTest.php +++ b/server/tests/Feature/app/ProductoTest.php @@ -8,12 +8,14 @@ use App\CotizacionProducto; use CategoriaProductoSeeder; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Feature\Utilidades\EloquenceSolucion; use Tests\Feature\Utilidades\EstructuraProducto; use Illuminate\Foundation\Testing\RefreshDatabase; class ProductoTest extends TestCase { use RefreshDatabase; + use EloquenceSolucion; use EstructuraProducto; protected function setUp(): void