fix(power): complete acknowledged commands without readiness locks
parent
c9f2fdb9fa
commit
2b87fe89f2
@ -1,2 +1,2 @@
|
||||
{* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *}
|
||||
{assign var=venix_asset_version value='2026101203' scope='global'}
|
||||
{assign var=venix_asset_version value='2026101301' scope='global'}
|
||||
|
||||
@ -0,0 +1,168 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import vm from 'node:vm';
|
||||
|
||||
// Run the shipped command, job polling, status merging and button rendering.
|
||||
// Only browser I/O is replaced so delayed reads cannot be hidden by a mock loader.
|
||||
const moduleSource = await readFile(new URL('../public/cloud/runtime.js', import.meta.url), 'utf8');
|
||||
const source = moduleSource.replace(/^import[^\n]+\n/u, '')
|
||||
.replace(/^export \{[\s\S]*?\};\s*$/mu, '')
|
||||
+ '\n;globalThis.__power = { state, selectedVm, renderVmDetail, powerAction, loadVmStatus };\n';
|
||||
|
||||
class Element {
|
||||
constructor() {
|
||||
this.children = []; this.textContent = ''; this.hidden = false; this.disabled = false;
|
||||
this.dataset = {}; this.attributes = new Map(); this.listeners = new Map();
|
||||
this.style = {}; this.classList = { add() {}, remove() {}, toggle() {} };
|
||||
}
|
||||
append(...children) { this.children.push(...children); }
|
||||
replaceChildren(...children) { this.children = children; }
|
||||
setAttribute(name, value) { this.attributes.set(name, String(value)); }
|
||||
removeAttribute(name) { this.attributes.delete(name); }
|
||||
addEventListener(name, callback) { this.listeners.set(name, callback); }
|
||||
closest() { return this; }
|
||||
}
|
||||
|
||||
const flush = async () => { for (let turn = 0; turn < 30; turn += 1) await Promise.resolve(); };
|
||||
|
||||
function fixture() {
|
||||
const elements = new Map();
|
||||
elements.set('cloud-page-error', new Element());
|
||||
const requests = [];
|
||||
const notices = [];
|
||||
const timers = [];
|
||||
const context = {
|
||||
document: {
|
||||
visibilityState: 'visible', body: { dataset: { vmId: '17' } },
|
||||
getElementById(id) {
|
||||
if (!elements.has(id)) elements.set(id, new Element());
|
||||
return elements.get(id);
|
||||
},
|
||||
createElement() { return new Element(); },
|
||||
querySelectorAll() { return []; },
|
||||
addEventListener() {},
|
||||
},
|
||||
location: { protocol: 'https:', hostname: 'panel.test' },
|
||||
Headers, AbortController, URL,
|
||||
confirm() { return true; },
|
||||
toast(...args) { notices.push(args); },
|
||||
setTimeout(callback, delay) { timers.push({ callback, delay }); return timers.length; },
|
||||
fetch(path, options = {}) {
|
||||
return new Promise((resolve, reject) => requests.push({ path, ...options, resolve, reject, settled: false }));
|
||||
},
|
||||
};
|
||||
vm.runInNewContext(source, context, { filename: 'runtime.js' });
|
||||
const runtime = context.__power;
|
||||
const machine = { id: '17', api_id: '17', uuid: 'vm-uuid', name: 'test-vm',
|
||||
can_operate: true, can_delete: true, state: 'running', state_fresh: true,
|
||||
os_source: 'cloud_template' };
|
||||
Object.assign(runtime.state, { csrfToken: 'test-csrf', vms: [machine], selectedVmId: machine.uuid, view: 'detail' });
|
||||
runtime.renderVmDetail(machine);
|
||||
return {
|
||||
...runtime, requests, notices, timers, elements,
|
||||
button(label) {
|
||||
const buttons = ['vm-detail-primary-actions', 'vm-detail-danger-actions']
|
||||
.flatMap(id => elements.get(id).children);
|
||||
const button = buttons.find(item => item.textContent === label);
|
||||
assert.ok(button, `Missing button: ${label}`);
|
||||
return button;
|
||||
},
|
||||
pending(path) {
|
||||
const request = requests.find(item => !item.settled && item.path === path);
|
||||
assert.ok(request, `Missing request: ${path}`);
|
||||
return request;
|
||||
},
|
||||
async respond(request, payload, status = 200) {
|
||||
request.settled = true;
|
||||
request.resolve({ status, ok: status >= 200 && status < 300, json: async () => payload });
|
||||
await flush();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function accept(h, action, jobId = '41') {
|
||||
const promise = h.powerAction(action, action === 'poweroff');
|
||||
await h.respond(h.pending('/api/v1/vms/17/actions'), { job_id: jobId, action_label: '电源' });
|
||||
return { promise, request: h.pending(`/api/v1/jobs/${jobId}`) };
|
||||
}
|
||||
|
||||
// A request is not a command receipt: keep all power mutations serialized
|
||||
// until the existing job has actually confirmed execution.
|
||||
{
|
||||
const h = fixture();
|
||||
const pending = await accept(h, 'shutdown');
|
||||
assert.equal(h.button('强制断电').disabled, true);
|
||||
await h.powerAction('poweroff', true);
|
||||
assert.equal(h.requests.filter(item => item.method === 'POST').length, 1);
|
||||
assert.equal(h.notices.some(([, kind]) => kind === 'success'), false);
|
||||
await h.respond(pending.request, { status: 'succeeded' });
|
||||
await pending.promise;
|
||||
assert.equal(h.state.powerMutation, null);
|
||||
assert.equal(h.button('强制断电').disabled, false, 'A pending observation must not retain the power lock');
|
||||
assert.equal(h.selectedVm().state, 'running', 'The receipt does not invent a stopped state');
|
||||
assert.equal(h.timers.length, 0, 'No special shutdown convergence timer remains');
|
||||
|
||||
const observation = h.pending('/api/v1/vms/17/status?live=1');
|
||||
await h.respond(observation, { state: 'running', state_fresh: true });
|
||||
assert.equal(h.elements.get('vm-detail-state').textContent, '运行中');
|
||||
const forced = await accept(h, 'poweroff', '42');
|
||||
assert.equal(h.requests.filter(item => item.method === 'POST').length, 2);
|
||||
await h.respond(forced.request, { status: 'succeeded' });
|
||||
await forced.promise;
|
||||
await h.respond(h.pending('/api/v1/vms/17/status?live=1'), { state: 'shutoff', state_fresh: true });
|
||||
assert.equal(h.selectedVm().state, 'shutoff');
|
||||
}
|
||||
|
||||
// A slow observation is invalidated when a newer action starts, even if fetch
|
||||
// ignores abort and returns before the new command's post-completion refresh.
|
||||
for (const lateError of [false, true]) {
|
||||
const h = fixture();
|
||||
const shutdown = await accept(h, 'shutdown');
|
||||
await h.respond(shutdown.request, { status: 'succeeded' });
|
||||
await shutdown.promise;
|
||||
const oldRead = h.pending('/api/v1/vms/17/status?live=1');
|
||||
const forced = await accept(h, 'poweroff', '42');
|
||||
assert.equal(oldRead.signal.aborted, true);
|
||||
await h.respond(oldRead, lateError ? { message: 'stale observation error' }
|
||||
: { state: 'shutoff', state_fresh: true }, lateError ? 502 : 200);
|
||||
assert.equal(h.selectedVm().state, 'running', 'An old observation cannot update the newer command');
|
||||
assert.equal(h.elements.get('cloud-page-error').textContent, '');
|
||||
assert.equal(h.state.powerMutation.action, 'poweroff');
|
||||
await h.respond(forced.request, { status: 'succeeded' });
|
||||
await forced.promise;
|
||||
await h.respond(h.pending('/api/v1/vms/17/status?live=1'), { state: 'shutoff', state_fresh: true });
|
||||
assert.equal(h.selectedVm().state, 'shutoff');
|
||||
}
|
||||
|
||||
// Observation failure remains an observation error after a successful command;
|
||||
// it neither changes the receipt nor disables a subsequent force-poweroff.
|
||||
{
|
||||
const h = fixture();
|
||||
const shutdown = await accept(h, 'shutdown');
|
||||
await h.respond(shutdown.request, { status: 'succeeded' });
|
||||
await shutdown.promise;
|
||||
await h.respond(h.pending('/api/v1/vms/17/status?live=1'), { message: '状态暂不可用' }, 502);
|
||||
assert.equal(h.button('强制断电').disabled, false);
|
||||
assert.equal(h.selectedVm().state, 'running');
|
||||
assert.equal(h.notices.filter(([, kind]) => kind === 'success').length, 1);
|
||||
assert.equal(h.elements.get('cloud-page-error').textContent, '状态暂不可用');
|
||||
}
|
||||
|
||||
// A genuinely unknown job is never presented as command success or replayed.
|
||||
// Existing server-side admission still rejects a later explicit mutation.
|
||||
{
|
||||
const h = fixture();
|
||||
const shutdown = await accept(h, 'shutdown');
|
||||
await h.respond(shutdown.request, { status: 'uncertain', error: '命令回执未知,请核对原操作' });
|
||||
await shutdown.promise;
|
||||
assert.equal(h.notices.some(([, kind]) => kind === 'success'), false);
|
||||
assert.equal(h.notices.at(-1)[1], 'error');
|
||||
assert.equal(h.requests.filter(item => item.method === 'POST').length, 1);
|
||||
const forced = h.powerAction('poweroff', true);
|
||||
await h.respond(h.pending('/api/v1/vms/17/actions'), { message: '已有待核对的任务' }, 409);
|
||||
await forced;
|
||||
assert.equal(h.notices.at(-1)[0], '已有待核对的任务');
|
||||
assert.equal(h.requests.filter(item => item.path.startsWith('/api/v1/jobs/')).length, 1);
|
||||
}
|
||||
|
||||
console.log('Cloud power command completion, independent observations and stale response checks passed.');
|
||||
@ -0,0 +1,256 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services {
|
||||
final class Config
|
||||
{
|
||||
public static function get($name, $default = null) { return $default; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace App\Services\Cloud {
|
||||
/** Test-only keyring; never used by the application. */
|
||||
final class CloudSecrets
|
||||
{
|
||||
private static array $values = [];
|
||||
public static function encrypt(array $value): string
|
||||
{
|
||||
$key = bin2hex(random_bytes(16));
|
||||
self::$values[$key] = $value;
|
||||
return $key;
|
||||
}
|
||||
public static function decrypt(string $key): array { return self::$values[$key]; }
|
||||
}
|
||||
|
||||
/** Simulate a healthy power API and unavailable guest/private readback. */
|
||||
final class CloudEngineClient
|
||||
{
|
||||
public array $calls = [];
|
||||
public array $response = [];
|
||||
public $afterCommand = null;
|
||||
public function host(int $host, string $method, string $resource,
|
||||
array $actor, ?array $body, string $operation): array
|
||||
{
|
||||
$this->calls[] = [$host, $method, $resource, $body];
|
||||
if (!str_ends_with($resource, '/actions')) {
|
||||
throw new CloudError('Private network/QGA unavailable', 503);
|
||||
}
|
||||
if ($this->afterCommand !== null) { ($this->afterCommand)(); }
|
||||
return $this->response + ['operation_id' => $operation];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
use App\Models\CloudInstance;
|
||||
use App\Models\CloudInstanceRuntime;
|
||||
use App\Models\CloudJob;
|
||||
use App\Services\Cloud\CloudEngineClient;
|
||||
use App\Services\Cloud\CloudError;
|
||||
use App\Services\Cloud\CloudInstanceRuntimeService;
|
||||
use App\Services\Cloud\CloudJobService;
|
||||
use App\Services\Cloud\CloudOperationErrorCatalog;
|
||||
use App\Services\Cloud\CloudSecrets;
|
||||
use App\Services\Cloud\CloudVpcService;
|
||||
use App\Services\Cloud\CloudWorkerService;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
$assert = static function (bool $condition, string $message): void {
|
||||
if (!$condition) { throw new RuntimeException($message); }
|
||||
};
|
||||
$capsule = new Capsule();
|
||||
$capsule->addConnection(['driver' => 'sqlite', 'database' => ':memory:'], 'default');
|
||||
$capsule->setAsGlobal();
|
||||
$capsule->bootEloquent();
|
||||
$schema = $capsule->schema();
|
||||
$schema->create('user', static function (Blueprint $t): void {
|
||||
$t->increments('id'); $t->integer('enable')->default(1);
|
||||
$t->boolean('is_admin')->default(false);
|
||||
});
|
||||
$schema->create('cloud_instances', static function (Blueprint $t): void {
|
||||
$t->increments('id'); $t->integer('host_id'); $t->integer('user_id');
|
||||
$t->integer('order_id')->nullable(); $t->string('uuid'); $t->string('name');
|
||||
$t->string('status')->default('active');
|
||||
$t->string('service_status')->default('exempt');
|
||||
$t->string('network_status')->default('active');
|
||||
$t->integer('expires_at')->nullable(); $t->text('spec_json')->default('{}');
|
||||
$t->integer('updated_at')->default(0);
|
||||
});
|
||||
$schema->create('cloud_jobs', static function (Blueprint $t): void {
|
||||
$t->increments('id'); $t->string('operation_id')->unique();
|
||||
$t->integer('order_id')->nullable(); $t->integer('instance_id')->nullable();
|
||||
$t->integer('snapshot_id')->nullable(); $t->integer('user_id'); $t->integer('host_id');
|
||||
$t->string('kind'); $t->string('status'); $t->text('payload_cipher');
|
||||
$t->integer('attempts')->default(0); $t->integer('dispatched_at')->nullable();
|
||||
$t->string('lease_token')->nullable(); $t->integer('lease_until')->default(0);
|
||||
$t->integer('available_at'); $t->integer('created_at'); $t->integer('updated_at');
|
||||
$t->string('error_code')->nullable(); $t->text('result_json')->nullable();
|
||||
});
|
||||
$schema->create('cloud_instance_runtime', static function (Blueprint $t): void {
|
||||
$t->integer('instance_id')->primary(); $t->integer('host_id'); $t->string('uuid');
|
||||
$t->string('power_state'); $t->string('sync_state'); $t->string('last_error_code');
|
||||
foreach (['last_success_at', 'last_attempt_at', 'revision', 'created_at', 'updated_at'] as $key) {
|
||||
$t->integer($key);
|
||||
}
|
||||
});
|
||||
$schema->create('cloud_vpcs', static function (Blueprint $t): void {
|
||||
$t->increments('id'); $t->string('vpc_key'); $t->integer('desired_revision');
|
||||
$t->string('desired_digest'); $t->string('state'); $t->string('sync_state');
|
||||
});
|
||||
$schema->create('cloud_vpc_host_deployments', static function (Blueprint $t): void {
|
||||
$t->increments('id'); $t->integer('vpc_id'); $t->integer('host_id'); $t->string('state');
|
||||
});
|
||||
foreach (['cloud_vpc_members', 'cloud_vpc_private_ips'] as $table) {
|
||||
$schema->create($table, static function (Blueprint $t) use ($table): void {
|
||||
$t->increments('id'); $t->integer('vpc_id'); $t->integer('subnet_id');
|
||||
$t->integer('instance_id'); $t->string('private_ip'); $t->string('state');
|
||||
$t->integer('desired_revision'); $t->string('desired_digest');
|
||||
$t->integer('observed_revision')->default(0); $t->string('observed_digest')->nullable();
|
||||
$t->string('last_error_code')->nullable(); $t->integer('updated_at')->default(0);
|
||||
if ($table === 'cloud_vpc_members') {
|
||||
$t->string('member_key'); $t->integer('host_id'); $t->integer('private_ip_id');
|
||||
$t->string('last_operation_id')->nullable();
|
||||
} else {
|
||||
$t->integer('member_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
$uuid = '11111111-1111-4111-8111-111111111110';
|
||||
Capsule::table('user')->insert(['id' => 1]);
|
||||
Capsule::table('cloud_instances')->insert([
|
||||
'id' => 10, 'host_id' => 7, 'user_id' => 1, 'uuid' => $uuid, 'name' => 'Power VM',
|
||||
]);
|
||||
Capsule::table('cloud_vpcs')->insert([
|
||||
'id' => 1, 'vpc_key' => str_repeat('a', 32), 'desired_revision' => 1,
|
||||
'desired_digest' => str_repeat('d', 64), 'state' => 'active', 'sync_state' => 'failed',
|
||||
]);
|
||||
$member = ['id' => 1, 'vpc_id' => 1, 'subnet_id' => 1, 'instance_id' => 10,
|
||||
'private_ip' => '10.0.0.1', 'state' => 'uncertain',
|
||||
'desired_revision' => 1, 'desired_digest' => str_repeat('d', 64)];
|
||||
Capsule::table('cloud_vpc_members')->insert($member + [
|
||||
'member_key' => str_repeat('b', 32), 'host_id' => 7, 'private_ip_id' => 1,
|
||||
]);
|
||||
Capsule::table('cloud_vpc_private_ips')->insert($member + ['member_id' => 1]);
|
||||
$actor = ['user_id' => 1, 'is_admin' => false, 'is_super_admin' => false,
|
||||
'can_manage' => false, 'session_id' => ''];
|
||||
$engine = new CloudEngineClient();
|
||||
$worker = new CloudWorkerService($engine);
|
||||
$enqueue = static fn (string $action): CloudJob => CloudJobService::enqueue(
|
||||
CloudInstance::find(10), $actor, 'action', 'POST', '/actions', ['action' => $action]
|
||||
);
|
||||
$expectation = CloudVpcService::instancePrivateExpectation(10);
|
||||
$assert($expectation['required'] === true && $expectation['reason_code'] === null,
|
||||
'Fixture must have a valid attached private target despite failed readiness.');
|
||||
|
||||
// Each command can be followed immediately by another command even when
|
||||
// the guest is broken and every private-readback endpoint would fail.
|
||||
foreach (['shutdown', 'poweroff', 'start', 'reboot', 'reset'] as $action) {
|
||||
$instance = CloudInstance::find(10);
|
||||
$instance->network_status = $action === 'start' ? 'blocked_traffic' : 'active';
|
||||
$instance->save();
|
||||
$beforeState = $action === 'start' ? 'stopped' : 'running';
|
||||
CloudInstanceRuntimeService::markObserved(10, 7, $uuid, $beforeState);
|
||||
$job = $enqueue($action);
|
||||
$engine->response = ['status' => 'succeeded', 'result' => [
|
||||
'uuid' => $uuid, 'action' => $action, 'command_accepted' => true,
|
||||
]];
|
||||
$count = count($engine->calls);
|
||||
$assert($worker->tick(), 'Worker did not claim the power request.');
|
||||
$done = CloudJob::find($job->id);
|
||||
$receipt = json_decode($done->result_json, true);
|
||||
$assert($done->status === 'succeeded' && $done->lease_token === null
|
||||
&& (int) $done->lease_until === 0 && count($engine->calls) === $count + 1,
|
||||
'Confirmed ' . $action . ' waited for or dispatched private reconciliation.');
|
||||
$assert(($receipt['command_accepted'] ?? null) === true
|
||||
&& ($receipt['action'] ?? null) === $action && !isset($receipt['state']),
|
||||
'Power receipt was discarded or fabricated an observed power state.');
|
||||
$assert(CloudInstanceRuntime::find(10)->power_state
|
||||
=== ($action === 'shutdown' ? 'shutdown' : $beforeState),
|
||||
'Receipt-only command fabricated a running/stopped observation.');
|
||||
$assert(CloudInstance::find(10)->network_status === $instance->network_status
|
||||
&& Capsule::table('cloud_vpc_members')->value('state') === 'uncertain'
|
||||
&& Capsule::table('cloud_vpcs')->value('sync_state') === 'failed',
|
||||
'Ordinary power command changed independent network policy/readiness.');
|
||||
}
|
||||
|
||||
// A changing private target does not invalidate an already accepted power
|
||||
// command in finish()'s transaction either.
|
||||
$job = $enqueue('shutdown');
|
||||
$engine->response = ['status' => 'succeeded', 'result' => [
|
||||
'uuid' => $uuid, 'action' => 'shutdown', 'command_accepted' => true,
|
||||
]];
|
||||
$engine->afterCommand = static function (): void {
|
||||
foreach (['cloud_vpcs', 'cloud_vpc_members', 'cloud_vpc_private_ips'] as $table) {
|
||||
Capsule::table($table)->update(['desired_revision' => 2]);
|
||||
}
|
||||
};
|
||||
$worker->tick();
|
||||
$assert(CloudJob::find($job->id)->status === 'succeeded',
|
||||
'Private revision change retroactively blocked confirmed power receipt.');
|
||||
$engine->afterCommand = null;
|
||||
$next = $enqueue('poweroff');
|
||||
$assert($next->status === 'queued', 'Accepted shutdown still blocks force poweroff.');
|
||||
// Isolate the following rejection cases; no production cancellation code is used.
|
||||
$next->status = 'cancelled'; $next->save();
|
||||
|
||||
$gate = new ReflectionMethod(CloudWorkerService::class, 'applyPrivateLifecycleGate');
|
||||
$confirmed = new ReflectionMethod(CloudWorkerService::class, 'confirmedPowerReceipt');
|
||||
$job = $enqueue('shutdown');
|
||||
$payload = CloudSecrets::decrypt($job->payload_cipher);
|
||||
$success = ['operation_id' => $job->operation_id, 'status' => 'succeeded', 'result' => [
|
||||
'uuid' => $uuid, 'action' => 'shutdown', 'command_accepted' => true,
|
||||
]];
|
||||
$assert($confirmed->invoke(null, $job, $success, $payload), 'Valid receipt not recognized.');
|
||||
$invalid = [
|
||||
array_replace_recursive($success, ['result' => ['uuid' => '22222222-2222-4222-8222-222222222222']]),
|
||||
array_replace_recursive($success, ['result' => ['action' => 'poweroff']]),
|
||||
array_replace_recursive($success, ['result' => ['command_accepted' => 'true']]),
|
||||
array_replace_recursive($success, ['result' => ['command_accepted' => false]]),
|
||||
array_replace($success, ['operation_id' => str_repeat('f', 32)]),
|
||||
array_replace($success, ['status' => 'uncertain']),
|
||||
array_replace($success, ['status' => 'running']),
|
||||
array_replace($success, ['status' => 'failed']),
|
||||
];
|
||||
foreach ($invalid as $operation) {
|
||||
$assert(!$confirmed->invoke(null, $job, $operation, $payload),
|
||||
'Mismatched, unconfirmed or nonterminal receipt bypassed the private gate.');
|
||||
}
|
||||
foreach ([['method' => 'GET'], ['resource' => 'vms/' . $uuid . '/reinstall'],
|
||||
['body' => ['action' => 'delete']]] as $change) {
|
||||
$assert(!$confirmed->invoke(null, $job, $success, array_replace($payload, $change)),
|
||||
'Receipt bypass was not bound to the immutable power request.');
|
||||
}
|
||||
$safe = CloudOperationErrorCatalog::workerResult([
|
||||
'command_accepted' => 'true', 'action' => 'arbitrary-host-message',
|
||||
]);
|
||||
$assert($safe === [], 'Unvalidated power receipt fields reached stored/user results.');
|
||||
|
||||
// A lost power response is still uncertain, and the next write is rejected.
|
||||
$engine->response = ['status' => 'uncertain', 'mutation_started' => true,
|
||||
'error_code' => 'libvirt_execution_uncertain'];
|
||||
$worker->tick();
|
||||
$assert(CloudJob::find($job->id)->status === 'uncertain',
|
||||
'A truly uncertain write was upgraded to success.');
|
||||
try {
|
||||
$enqueue('poweroff');
|
||||
throw new RuntimeException('Unknown write allowed a new power mutation.');
|
||||
} catch (CloudError $error) {
|
||||
$assert($error->httpStatus === 409, 'Unknown write had an unexpected admission result.');
|
||||
}
|
||||
|
||||
// Unavailable private proof still gates destructive and policy mutations.
|
||||
// Invoke the production gate directly to avoid manufacturing their finance
|
||||
// ledgers; these are not ordinary action jobs even if a result carries a receipt.
|
||||
foreach (['delete', 'expiry_delete', 'reinstall', 'network_change',
|
||||
'network_suspend', 'network_resume', 'service_suspend', 'service_resume'] as $kind) {
|
||||
$other = clone $job;
|
||||
$other->kind = $kind;
|
||||
$count = count($engine->calls);
|
||||
$result = $gate->invoke($worker, $other, $success, $payload, $actor);
|
||||
$assert($result['status'] === 'uncertain' && count($engine->calls) > $count,
|
||||
'Power receipt weakened private readback for ' . $kind . '.');
|
||||
}
|
||||
echo "Power command receipt workflow tests passed.\n";
|
||||
}
|
||||
Loading…
Reference in New Issue