Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -51,3 +59,6 @@ jobs:

- name: Execute tests
run: vendor/bin/pest
env:
DB_CONNECTION: mysql
DB_USERNAME: root
16 changes: 8 additions & 8 deletions database/migrations/2023_06_07_000001_create_pulse_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -78,23 +78,23 @@ 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();
// TODO: indexes?
});

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();
// TODO: indexes?
});

Schema::create('pulse_queue_sizes', function (Blueprint $table) {
$table->timestamp('date');
$table->datetime('date');
$table->string('connection');
$table->string('queue');
$table->unsignedInteger('size');
Expand Down
4 changes: 2 additions & 2 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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))
Expand Down