Files
orca/cloud/dev/scripts/capture-terraform-plan-baseline.test.mjs
T
Jinwoo Hong 3eec77c11a chore(cloud): add the relay fence broker, ops console, Terraform root, scripts, and 24 cloud-* workflows (#18413)
Phase 6 of the relay split: the relay's deploy/operate surface moves under cloud/ with 24 cloud-* workflows gated on ORCA_CLOUD_OPERATIONS_ENABLED, the Cloud SQL rollout lease action, the relay Terraform root (dual-accept identities for both repositories), scripts, docs, CODEOWNERS, and a terraform validate job in Cloud Verify.
2026-09-03 06:55:14 -04:00

16 lines
820 B
JavaScript

import assert from 'node:assert/strict'
import { test } from 'node:test'
import { normalizePlan, summarize } from './capture-terraform-plan-baseline.mjs'
test('normalizes, sorts, and drops forgets so a removed block cannot skew equivalence', () => {
const changes = normalizePlan({
resource_changes: [
{ address: 'b.two', change: { actions: ['update'], before: { x: 1 }, after: { x: 2 } } },
{ address: 'a.one', change: { actions: ['forget'], before: {}, after: null } },
{ address: 'c.three', change: { actions: ['delete', 'create'], before: {}, after: {}, after_unknown: { id: true } } }
]
})
assert.deepEqual(changes.map((change) => change.address), ['b.two', 'c.three'])
assert.deepEqual(summarize(changes), { create: 0, update: 1, delete: 0, replace: 1, 'no-op': 0, read: 0 })
})