|
|
|
|
@ -29,16 +29,39 @@ $schema->create('cloud_instances', static function (Blueprint $table): void {
|
|
|
|
|
});
|
|
|
|
|
$schema->create('cloud_jobs', static function (Blueprint $table): void {
|
|
|
|
|
$table->increments('id');
|
|
|
|
|
$table->string('operation_id')->default('00000000000000000000000000000000');
|
|
|
|
|
$table->string('request_idempotency_key')->default('overview-fixture-key');
|
|
|
|
|
$table->string('request_fingerprint')->default(
|
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000'
|
|
|
|
|
);
|
|
|
|
|
$table->integer('parent_job_id')->nullable();
|
|
|
|
|
$table->integer('order_id')->nullable();
|
|
|
|
|
$table->integer('invoice_id')->nullable();
|
|
|
|
|
$table->integer('instance_id')->nullable();
|
|
|
|
|
$table->integer('snapshot_id')->nullable();
|
|
|
|
|
$table->integer('user_id')->default(1);
|
|
|
|
|
$table->integer('host_id')->default(1);
|
|
|
|
|
$table->string('kind');
|
|
|
|
|
$table->string('execution_mode')->default('agent');
|
|
|
|
|
$table->string('phase');
|
|
|
|
|
$table->string('outcome')->nullable();
|
|
|
|
|
$table->integer('attempts')->default(1);
|
|
|
|
|
$table->integer('dispatch_attempts')->nullable()->default(1);
|
|
|
|
|
$table->integer('dispatch_deadline_at')->default(1);
|
|
|
|
|
$table->integer('dispatch_started_at')->nullable()->default(1);
|
|
|
|
|
$table->integer('agent_accepted_at')->nullable()->default(1);
|
|
|
|
|
$table->integer('receipt_deadline_at')->nullable()->default(1);
|
|
|
|
|
$table->integer('dispatched_at')->nullable()->default(1);
|
|
|
|
|
$table->string('completion_event_id')->nullable();
|
|
|
|
|
$table->boolean('effect_may_have_applied')->nullable()->default(0);
|
|
|
|
|
$table->boolean('safe_to_resubmit')->nullable()->default(0);
|
|
|
|
|
$table->string('effect_resolution')->default('not_applicable');
|
|
|
|
|
$table->integer('terminal_at')->nullable();
|
|
|
|
|
$table->string('status');
|
|
|
|
|
$table->string('error_code')->nullable();
|
|
|
|
|
$table->boolean('finalization_incident')->default(0);
|
|
|
|
|
$table->string('finalization_error_code')->nullable();
|
|
|
|
|
$table->text('result_json')->nullable();
|
|
|
|
|
$table->integer('created_at');
|
|
|
|
|
$table->integer('updated_at');
|
|
|
|
|
});
|
|
|
|
|
@ -127,6 +150,24 @@ Capsule::table('cloud_jobs')->insert([
|
|
|
|
|
'outcome' => 'failed', 'effect_resolution' => 'not_applicable',
|
|
|
|
|
'terminal_at' => $now - 90000, 'status' => 'failed', 'created_at' => $today - 172800,
|
|
|
|
|
'updated_at' => $now - 90000],
|
|
|
|
|
['order_id' => null, 'kind' => 'host_storage_configure', 'phase' => 'terminal',
|
|
|
|
|
'outcome' => 'failed', 'effect_resolution' => 'unknown',
|
|
|
|
|
'terminal_at' => $now - 15, 'status' => 'failed',
|
|
|
|
|
'created_at' => $today + 80, 'updated_at' => $now],
|
|
|
|
|
]);
|
|
|
|
|
Capsule::table('cloud_jobs')->insert([
|
|
|
|
|
['order_id' => null, 'kind' => 'rescue', 'phase' => 'terminal',
|
|
|
|
|
'outcome' => 'succeeded', 'effect_resolution' => 'applied',
|
|
|
|
|
'terminal_at' => $now - 14, 'status' => 'succeeded',
|
|
|
|
|
'finalization_incident' => 1,
|
|
|
|
|
'finalization_error_code' => 'recovery_dispatch_ledger_conflict',
|
|
|
|
|
'created_at' => $today + 81, 'updated_at' => $now],
|
|
|
|
|
['order_id' => null, 'kind' => 'reinstall', 'phase' => 'terminal',
|
|
|
|
|
'outcome' => 'succeeded', 'effect_resolution' => 'applied',
|
|
|
|
|
'terminal_at' => $now - 13, 'status' => 'succeeded',
|
|
|
|
|
'finalization_incident' => 1,
|
|
|
|
|
'finalization_error_code' => 'recovery_dispatch_repair_evidence_conflict',
|
|
|
|
|
'created_at' => $today + 82, 'updated_at' => $now],
|
|
|
|
|
]);
|
|
|
|
|
Capsule::table('shop')->insert(['id' => 1, 'name' => '2c4g']);
|
|
|
|
|
Capsule::table('cloud_invoices')->insert([
|
|
|
|
|
@ -173,16 +214,19 @@ $assert = static function ($condition, string $message): void {
|
|
|
|
|
|
|
|
|
|
$assert($overview['hosts'] === ['total' => 2, 'enabled' => 1],
|
|
|
|
|
'Host enabled/configured aggregation is incorrect.');
|
|
|
|
|
$assert($overview['jobs']['unresolved_effect'] === 5,
|
|
|
|
|
'Resource-lock count must include recovery incidents while excluding retryable host storage failures.');
|
|
|
|
|
$assert($overview['instances']['managed'] === 4
|
|
|
|
|
&& $overview['instances']['billable'] === 3
|
|
|
|
|
&& $overview['instances']['service_normal'] === 2
|
|
|
|
|
&& $overview['instances']['network_normal'] === 2
|
|
|
|
|
&& $overview['instances']['network_normal'] === 3
|
|
|
|
|
&& $overview['instances']['network_attention'] === 1
|
|
|
|
|
&& $overview['instances']['expiring_7d'] === 1
|
|
|
|
|
&& $overview['instances']['grace'] === 1,
|
|
|
|
|
'Instance lifecycle aggregation is incorrect.');
|
|
|
|
|
$assert($overview['jobs']['active'] === 2
|
|
|
|
|
&& $overview['jobs']['unresolved_effect'] === 3
|
|
|
|
|
&& $overview['jobs']['failed_24h'] === 4
|
|
|
|
|
&& $overview['jobs']['unresolved_effect'] === 5
|
|
|
|
|
&& $overview['jobs']['failed_24h'] === 5
|
|
|
|
|
&& $overview['jobs']['today_total'] === 5
|
|
|
|
|
&& $overview['jobs']['today_succeeded'] === 2
|
|
|
|
|
&& $overview['jobs']['today_failed'] === 3,
|
|
|
|
|
|