mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-11-06 11:03:33 +01:00
- ClusterSettings::enum() reads every enum setting against ENUMS; an unknown stored cluster_transport is now published as the default, auto (recorded in ADR 0004). - ClusterPolicy::ver(), one enrolment start for SSH and code enrolment, one public protocol range. - StrictQuery takes a message; the query-or-throw copies use it. - The cluster CLI commands share the 'Cluster API unavailable' and 'is an LB' helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rdv7hXd8RWhLHoj5Ma2ZqY
32 lines
1.4 KiB
PHP
32 lines
1.4 KiB
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use XcVm\Domain\Cluster\ClusterAdmin;
|
|
|
|
/**
|
|
* Which servers rows are load balancers: what the Cluster Nodes page lists
|
|
* for a code, and what cluster:enrol-code, cluster:reenrol and server:enrol
|
|
* accept.
|
|
*/
|
|
final class ClusterAdminLoadBalancerTest extends TestCase {
|
|
public function testALoadBalancerIsNeitherMainNorAProxy(): void {
|
|
$this->assertTrue(ClusterAdmin::isLoadBalancer(['is_main' => 0, 'server_type' => 0]));
|
|
$this->assertTrue(ClusterAdmin::isLoadBalancer(['is_main' => '0', 'server_type' => '0']));
|
|
$this->assertTrue(ClusterAdmin::isLoadBalancer([]), 'no type: a server, as the servers table defaults it');
|
|
$this->assertFalse(ClusterAdmin::isLoadBalancer(null));
|
|
$this->assertFalse(ClusterAdmin::isLoadBalancer(['is_main' => 1, 'server_type' => 0]));
|
|
$this->assertFalse(ClusterAdmin::isLoadBalancer(['is_main' => 0, 'server_type' => 1]));
|
|
$this->assertFalse(ClusterAdmin::isLoadBalancer(['is_main' => 0, 'server_type' => '1']));
|
|
}
|
|
|
|
public function testThePageListsOnlyLoadBalancers(): void {
|
|
$rServers = [
|
|
1 => ['is_main' => 1, 'server_type' => 0, 'server_name' => 'Main'],
|
|
2 => ['is_main' => 0, 'server_type' => 0, 'server_name' => 'LB 1'],
|
|
3 => ['is_main' => 0, 'server_type' => 1, 'server_name' => 'Proxy'],
|
|
4 => ['is_main' => 0, 'server_type' => 0],
|
|
];
|
|
$this->assertSame([2 => 'LB 1', 4 => '#4'], ClusterAdmin::loadBalancers($rServers));
|
|
}
|
|
}
|