Fix edge agent CI setup

This commit is contained in:
Jeppe Bundgaard
2026-07-01 10:51:14 +02:00
parent 1ca42055b0
commit 9db1964038
3 changed files with 49 additions and 0 deletions
@@ -19,6 +19,7 @@ it('serves whole-department expected relay states and records successful physica
]);
$departmentId = (int)$scenario['department']['id'];
$laneId = (int)$scenario['lane']['id'];
api_fixtures()->setDepartmentShellyTransportMode($departmentId, 'gateway');
$session = api_fixtures()->createEdgeOperatorSession($departmentId, [
'modules_selfserve_lane_relay_machine_status_set',
'modules_selfserve_lane_relay_machine_cleaner_status_set',
@@ -175,6 +175,41 @@ final class ApiFixtures
$this->cleanup->add(fn() => $this->deleteById('department_variables', $variableId));
}
public function setDepartmentShellyTransportMode(int $departmentId, string $mode): void
{
if ($departmentId <= 0) {
throw new RuntimeException('Department Shelly transport fixtures require a positive department id.');
}
$mode = strtolower(trim($mode));
if (!in_array($mode, ['cloud', 'gateway'], true)) {
throw new RuntimeException('Invalid Shelly transport fixture mode.');
}
$this->cleanupDeleteWhere('department_variables', [
'department_id' => $departmentId,
'variable' => 'shelly_transport_mode',
]);
$existingIds = $this->fetchIntColumnWhere('department_variables', 'id', [
'department_id' => $departmentId,
'variable' => 'shelly_transport_mode',
]);
if ($existingIds !== []) {
$this->updateById('department_variables', (int)$existingIds[0], [
'value' => $mode,
]);
return;
}
$variableId = $this->insertRowWithExistingColumns('department_variables', [
'department_id' => $departmentId,
'variable' => 'shelly_transport_mode',
'value' => $mode,
]);
$this->cleanup->add(fn() => $this->deleteById('department_variables', $variableId));
}
public function setLaneSelfServeEnabled(int $laneId, bool $enabled): void
{
if ($laneId <= 0) {