|
|
|
|
@ -329,7 +329,7 @@ Capsule::table('cloud_public_ip_pools')->insert([
|
|
|
|
|
'2404:c140:156:20::1'),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$seed = static function (int $n) use ($now): array {
|
|
|
|
|
$seed = static function (int $n, int $currentOfferId = 41) use ($now): array {
|
|
|
|
|
$instanceId = 100 + $n;
|
|
|
|
|
$orderId = 200 + $n;
|
|
|
|
|
$restoreId = 300 + $n;
|
|
|
|
|
@ -376,7 +376,7 @@ $seed = static function (int $n) use ($now): array {
|
|
|
|
|
Capsule::table('cloud_instances')->insert([
|
|
|
|
|
'id' => $instanceId, 'uuid' => $sourceUuid, 'host_id' => 1,
|
|
|
|
|
'user_id' => 9, 'order_id' => $orderId, 'plan_id' => 31,
|
|
|
|
|
'offer_id' => 41, 'resource_pool_id' => 10,
|
|
|
|
|
'offer_id' => $currentOfferId, 'resource_pool_id' => 10,
|
|
|
|
|
'reservation_id' => $sourceReservationId,
|
|
|
|
|
'current_period_id' => 700 + $n, 'expires_at' => $now + 86400,
|
|
|
|
|
'renewal_price' => '19.95', 'renewal_days' => 30,
|
|
|
|
|
@ -419,7 +419,8 @@ $seed = static function (int $n) use ($now): array {
|
|
|
|
|
'operation_id' => $sourceOperation, 'order_id' => $orderId,
|
|
|
|
|
'backup_restore_id' => null,
|
|
|
|
|
'backup_restore_attempt_key' => null,
|
|
|
|
|
'migration_source_debt_id' => null, 'offer_id' => 41,
|
|
|
|
|
'migration_source_debt_id' => null,
|
|
|
|
|
'offer_id' => $currentOfferId,
|
|
|
|
|
'resource_pool_id' => 10, 'host_id' => 1, 'user_id' => 9,
|
|
|
|
|
'instance_id' => $instanceId, 'network_attachment_id' => null,
|
|
|
|
|
'public_ip_pool_id' => null, 'public_ip_id' => null,
|
|
|
|
|
@ -520,7 +521,7 @@ $seed = static function (int $n) use ($now): array {
|
|
|
|
|
'instanceId', 'orderId', 'restoreId', 'migrationId',
|
|
|
|
|
'sourceReservationId', 'targetReservationId',
|
|
|
|
|
'sourceOperation', 'targetOperation', 'sourceUuid', 'targetUuid',
|
|
|
|
|
'sourceSet', 'targetSet'
|
|
|
|
|
'sourceSet', 'targetSet', 'currentOfferId'
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -786,7 +787,7 @@ $assert((string) $rolledBack->state === 'rolled_back'
|
|
|
|
|
|
|
|
|
|
// Activation must preserve a powered-off expired service exactly as frozen at
|
|
|
|
|
// migration start, including the durable guest hostname.
|
|
|
|
|
$poweredOffCase = $seed(7);
|
|
|
|
|
$poweredOffCase = $seed(7, 42);
|
|
|
|
|
$poweredOffDebt = $cutover($poweredOffCase);
|
|
|
|
|
$poweredSpec = json_decode((string) CloudInstance::findOrFail(
|
|
|
|
|
$poweredOffCase['instanceId']
|
|
|
|
|
@ -838,16 +839,23 @@ $activated = CloudInstanceMigration::findOrFail(
|
|
|
|
|
$activatedDebt = CloudInstanceMigrationSourceDebt::findOrFail(
|
|
|
|
|
(int) $poweredOffDebt->id
|
|
|
|
|
);
|
|
|
|
|
$poweredOffOrder = Capsule::table('cloud_orders')
|
|
|
|
|
->find($poweredOffCase['orderId']);
|
|
|
|
|
$poweredOffTarget = Capsule::table('cloud_resource_reservations')
|
|
|
|
|
->find($poweredOffCase['targetReservationId']);
|
|
|
|
|
$assert((string) $activated->state === 'source_retained'
|
|
|
|
|
&& (string) $activatedDebt->state === 'retained'
|
|
|
|
|
&& (string) $poweredOff->service_status === 'suspended_expired'
|
|
|
|
|
&& (string) $poweredOff->network_status === 'blocked_expired'
|
|
|
|
|
&& str_contains((string) $poweredOff->spec_json, 'retained.example'),
|
|
|
|
|
&& str_contains((string) $poweredOff->spec_json, 'retained.example')
|
|
|
|
|
&& (int) $poweredOff->offer_id === 42
|
|
|
|
|
&& (int) $poweredOffTarget->offer_id === 42
|
|
|
|
|
&& (int) $poweredOffOrder->offer_id === 41,
|
|
|
|
|
'Activation changed powered-off, expired-network, or hostname state.');
|
|
|
|
|
|
|
|
|
|
// Automatic cleanup: cutover creates prepared debt, then the exact cleanup
|
|
|
|
|
// operation releases both source families without moving either claim set.
|
|
|
|
|
$automatic = $seed(1);
|
|
|
|
|
$automatic = $seed(1, 42);
|
|
|
|
|
$historicalSourceOperation = md5('source-history-automatic');
|
|
|
|
|
$activeSourceClaims = Capsule::table('cloud_resource_reservation_ips')
|
|
|
|
|
->where('reservation_id', $automatic['sourceReservationId'])
|
|
|
|
|
@ -914,6 +922,9 @@ $releasedDebt = Capsule::table('cloud_instance_migration_source_debts')
|
|
|
|
|
->find((int) $debt->id);
|
|
|
|
|
$assert((int) $instance->reservation_id === $automatic['targetReservationId']
|
|
|
|
|
&& (int) $order->reservation_id === $automatic['targetReservationId']
|
|
|
|
|
&& (int) $instance->offer_id === 42
|
|
|
|
|
&& (int) $target->offer_id === 42
|
|
|
|
|
&& (int) $order->offer_id === 41
|
|
|
|
|
&& (int) $target->order_id === $automatic['orderId']
|
|
|
|
|
&& $target->backup_restore_id === null
|
|
|
|
|
&& (string) $target->state === 'committed'
|
|
|
|
|
|