coolify/tests/Unit/GithubRunnerConfigLabelMatchTest.php
Andras Bacsai 576f38da1c feat(github): add self-hosted Actions runner orchestration
Implement end-to-end GitHub Actions runner support with provisioning,
tracking, and cleanup flows.

- handle `workflow_job` webhooks to provision and tear down runners
- add runner config/execution models, enum states, and relationships
- create jobs for provisioning, cleanup, and stale-runner reaping
- schedule periodic stale runner cleanup in the console kernel
- add Livewire server UI to manage runner configuration and executions
- store GitHub App runner permissions and runner group metadata
- add migrations for runner permissions, configs, executions, and group id
- update GitHub permissions URL generation for organization app settings
- include feature/unit tests for runner behavior and permission paths
2026-03-03 14:27:19 +01:00

35 lines
1.2 KiB
PHP

<?php
use App\Models\GithubRunnerConfig;
it('matches when all requested labels are present', function () {
$config = new GithubRunnerConfig;
$config->labels = ['self-hosted', 'linux', 'x64', 'coolify'];
expect($config->matchesLabels(['self-hosted', 'linux']))->toBeTrue();
expect($config->matchesLabels(['self-hosted', 'coolify']))->toBeTrue();
expect($config->matchesLabels(['self-hosted']))->toBeTrue();
});
it('does not match when a requested label is missing', function () {
$config = new GithubRunnerConfig;
$config->labels = ['self-hosted', 'linux', 'x64'];
expect($config->matchesLabels(['self-hosted', 'gpu']))->toBeFalse();
expect($config->matchesLabels(['self-hosted', 'arm64']))->toBeFalse();
});
it('matches labels case-insensitively', function () {
$config = new GithubRunnerConfig;
$config->labels = ['self-hosted', 'Linux', 'X64'];
expect($config->matchesLabels(['Self-Hosted', 'linux']))->toBeTrue();
expect($config->matchesLabels(['SELF-HOSTED', 'x64']))->toBeTrue();
});
it('matches when requesting empty labels', function () {
$config = new GithubRunnerConfig;
$config->labels = ['self-hosted'];
expect($config->matchesLabels([]))->toBeTrue();
});