Skip to content

Commit 3b34033

Browse files
denikIsaac
andcommitted
acc: run the recreate-reference tests on the direct engine only
Terraform is being removed, so pin these tests to the direct engine and drop the terraform goldens. The comments describe terraform's behavior for context rather than running it, and the field-level proof (the saved value vs the still-unresolved reference, with the remote unchanged) demonstrates the bug without a terraform comparison. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent a04514f commit 3b34033

21 files changed

Lines changed: 55 additions & 130 deletions

File tree

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/databricks.yml.tmpl‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ sync:
1616
# recreate-postgres-role). role_id is unchanged, so my_role.name (projects/.../roles/app-owner)
1717
# is stable. The direct engine cannot resolve ${my_role.name} while the role is recreated, so
1818
# my_database.role diffs the saved name against the "${...}" placeholder and plans an
19-
# unnecessary update. Terraform updates the role in place against the lenient testserver,
20-
# resolves the stable name, and leaves my_database unchanged.
19+
# unnecessary update.
20+
#
21+
# This test runs the direct engine only. For context, the terraform engine (now being removed)
22+
# left my_database alone: against the lenient testserver it updates the role in place, so the
23+
# name reference resolved at plan and never diffed.
2124
resources:
2225
postgres_projects:
2326
my_project:

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/out.database_role.terraform.json‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/out.plan.terraform.txt‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/out.requests.terraform.txt‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/out.test.toml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/output.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ Resources: 4 created, 0 changed, 0 deleted, 0 unchanged
1212
=== Recreate the role; my_database.role references the role's (unchanged) name
1313
>>> update_file.py databricks.yml postgres_role: app_role postgres_role: new_role
1414

15+
=== Plan
1516
>>> [CLI] bundle plan
1617

1718
>>> [CLI] bundle plan -o json
1819

19-
=== Deploy and record per-engine requests (see out.plan.*, out.requests.*)
20+
=== Deploy and record the requests (see out.plan.direct.txt, out.requests.direct.txt)
2021
>>> print_requests.py --sort //postgres
2122

2223
>>> [CLI] bundle destroy --auto-approve

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/script‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ rm -f "$OUT_REQUESTS" # drop create requests; capture only the edit below
1616
title "Recreate the role; my_database.role references the role's (unchanged) name"
1717
trace update_file.py databricks.yml "postgres_role: app_role" "postgres_role: new_role"
1818

19-
# PLANNED (diverges by engine, so captured per engine):
20-
# - direct recreates the role, so it cannot resolve ${my_role.name} (a recreate does not
21-
# preserve the id) and diffs the saved name against the literal "${...}" placeholder ->
22-
# spurious "update postgres_databases.my_database".
23-
# - terraform updates the role in place against the lenient testserver, resolves the stable
24-
# name, and leaves my_database unchanged.
19+
# PLANNED: the direct engine recreates the role, so it cannot resolve ${my_role.name} (a
20+
# recreate does not preserve the id) and diffs the saved name against the literal "${...}"
21+
# placeholder -> spurious "update postgres_databases.my_database".
22+
title "Plan"
2523
trace $CLI bundle plan > out.plan.$DATABRICKS_BUNDLE_ENGINE.txt
26-
# Field-level proof (direct): old is the real name, new is the still-unresolved reference.
24+
# Field-level proof: old is the real name, new is the still-unresolved reference.
2725
trace $CLI bundle plan -o json | nostamp | jq '.plan."resources.postgres_databases.my_database".changes.role' > out.database_role.$DATABRICKS_BUNDLE_ENGINE.json
2826

29-
# WHAT ACTUALLY HAPPENED: deploy and record per-engine requests (deploy stdout -> LOG.deploy;
30-
# parallel completion order is nondeterministic). out.requests.* shows direct issues a PATCH
31-
# against my_database -- a spurious update writing back the unchanged role -- whereas terraform
32-
# issues no request for my_database at all.
33-
title "Deploy and record per-engine requests (see out.plan.*, out.requests.*)"
27+
# WHAT ACTUALLY HAPPENED: deploy and record the requests (deploy stdout -> LOG.deploy; parallel
28+
# completion order is nondeterministic). out.requests.direct.txt shows the direct engine issues
29+
# a PATCH against my_database -- a spurious update writing back the unchanged role.
30+
title "Deploy and record the requests (see out.plan.direct.txt, out.requests.direct.txt)"
3431
$CLI bundle deploy --auto-approve &> LOG.deploy
3532
trace print_requests.py --sort '//postgres' > out.requests.$DATABRICKS_BUNDLE_ENGINE.txt

‎acceptance/bundle/resources/postgres_databases/recreate_ref_spurious_update/test.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
Cloud = false
55
RecordRequests = true
66
EnvMatrix.DMS = []
7+
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]

‎acceptance/bundle/resources/postgres_projects/recreate_ref_both_engines/databricks.yml.tmpl‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ sync:
1111
# unchanged. The dependent's action depends on the field: an immutable/id field -> recreate, a
1212
# mutable field -> update. This test covers the immutable case (a spurious RECREATE).
1313
#
14-
# pg_version is spec:immutable, so BOTH engines recreate the project on a bump -- an
15-
# apples-to-apples recreate with no engine disagreement on the field. project_id is unchanged,
16-
# so the project name (projects/{project_id}) is stable, and my_catalog.branch -- built from
14+
# pg_version is spec:immutable, so a bump recreates the project. project_id is unchanged, so the
15+
# project name (projects/{project_id}) is stable, and my_catalog.branch -- built from
1716
# ${my_project.name} -- resolves to the same value: the catalog does not actually change, yet
18-
# both engines plan and execute its recreate.
17+
# the direct engine plans and executes its recreate.
18+
#
19+
# This test runs the direct engine only. For context, the terraform engine (now being removed)
20+
# behaved the same here -- it also recreated the catalog, because it cannot cancel a replace
21+
# once the plan commits it to separate destroy/create graph nodes.
1922
resources:
2023
postgres_projects:
2124
my_project:

‎acceptance/bundle/resources/postgres_projects/recreate_ref_both_engines/out.requests.terraform.txt‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)