diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 46c06e8c..98eb041b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,6 +14,14 @@ jobs: runs-on: ubuntu-22.04 services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: testing + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 redis: image: redis ports: @@ -36,7 +44,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, redis, zip + extensions: dom, curl, libxml, mbstring, redis, pcntl, zip ini-values: error_reporting=E_ALL tools: composer:v2 coverage: none @@ -51,3 +59,6 @@ jobs: - name: Execute tests run: vendor/bin/pest + env: + DB_CONNECTION: mysql + DB_USERNAME: root diff --git a/database/migrations/2023_06_07_000001_create_pulse_tables.php b/database/migrations/2023_06_07_000001_create_pulse_tables.php index 77bc0056..9735e112 100644 --- a/database/migrations/2023_06_07_000001_create_pulse_tables.php +++ b/database/migrations/2023_06_07_000001_create_pulse_tables.php @@ -25,7 +25,7 @@ public function up(): void // - We may need to keep a hashed version of the text columns to index and group by. // - Do another pass at the indexes to ensure that they are optimized correctly. Schema::create('pulse_system_stats', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('server'); $table->unsignedTinyInteger('cpu_percent'); $table->unsignedInteger('memory_used'); @@ -36,7 +36,7 @@ public function up(): void }); Schema::create('pulse_requests', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('user_id')->nullable(); $table->string('route'); $table->unsignedInteger('duration'); @@ -46,7 +46,7 @@ public function up(): void }); Schema::create('pulse_exceptions', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('user_id')->nullable(); $table->string('class'); $table->string('location'); @@ -55,7 +55,7 @@ public function up(): void }); Schema::create('pulse_slow_queries', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('user_id')->nullable(); $table->string('sql'); $table->unsignedInteger('duration'); @@ -64,7 +64,7 @@ public function up(): void }); Schema::create('pulse_jobs', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('user_id')->nullable(); $table->string('job'); $table->uuid('job_uuid'); @@ -78,7 +78,7 @@ public function up(): void }); Schema::create('pulse_cache_interactions', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('key'); $table->boolean('hit'); $table->string('user_id')->nullable(); @@ -86,7 +86,7 @@ public function up(): void }); Schema::create('pulse_outgoing_requests', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('uri'); $table->unsignedInteger('duration'); $table->string('user_id')->nullable(); @@ -94,7 +94,7 @@ public function up(): void }); Schema::create('pulse_queue_sizes', function (Blueprint $table) { - $table->timestamp('date'); + $table->datetime('date'); $table->string('connection'); $table->string('queue'); $table->unsignedInteger('size'); diff --git a/tests/Pest.php b/tests/Pest.php index e5b00947..3440ff2b 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -69,7 +69,7 @@ function prependListener(string $event, callable $listener): void function captureRedisCommands(callable $callback) { - $process = Process::timeout(5)->start('redis-cli MONITOR'); + $process = Process::timeout(10)->start('redis-cli MONITOR'); Sleep::for(50)->milliseconds(); @@ -102,7 +102,7 @@ function captureRedisCommands(callable $callback) throw new Exception('Redis after PING was never recorded.'); } - return collect(explode("\n", tap($process->signal(SIGINT)->wait(), fn ($p) => $p->throwIf($p->exitCode() !== 130))->output())) + return collect(explode("\n", $process->signal(SIGINT)->output())) ->skipUntil(fn ($value) => str_contains($value, $beforeFlag)) ->skip(1) ->filter(fn ($output) => $output && ! str_contains($output, $afterFlag))