From 35083e486349044e3ccc21278475ea4a6430acbe Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 14:37:43 +0000 Subject: [PATCH 01/10] Test bundle commands with individual DMS API failures --- acceptance/bundle/dms_fault/README.md | 7 + .../dms_fault/complete_version/out.test.toml | 2 + .../dms_fault/complete_version/output.txt | 8 + .../bundle/dms_fault/complete_version/script | 1 + .../dms_fault/create_deployment/out.test.toml | 2 + .../dms_fault/create_deployment/output.txt | 8 + .../bundle/dms_fault/create_deployment/script | 1 + .../dms_fault/create_version/out.test.toml | 2 + .../dms_fault/create_version/output.txt | 8 + .../bundle/dms_fault/create_version/script | 1 + .../bundle/dms_fault/databricks.yml.tmpl | 11 + .../dms_fault/delete_deployment/out.test.toml | 2 + .../dms_fault/delete_deployment/output.txt | 8 + .../bundle/dms_fault/delete_deployment/script | 1 + .../dms_fault/get_deployment/out.test.toml | 2 + .../dms_fault/get_deployment/output.txt | 8 + .../bundle/dms_fault/get_deployment/script | 1 + acceptance/bundle/dms_fault/job.yml.tmpl | 4 + acceptance/bundle/dms_fault/pipeline.sql.tmpl | 1 + acceptance/bundle/dms_fault/pipeline.yml.tmpl | 10 + acceptance/bundle/dms_fault/run.py | 196 ++++++++++++++++++ acceptance/bundle/dms_fault/test.toml | 7 + .../dms_fault/update_deployment/out.test.toml | 2 + .../dms_fault/update_deployment/output.txt | 7 + .../bundle/dms_fault/update_deployment/script | 1 + .../dms_fault/update_operation/out.test.toml | 2 + .../dms_fault/update_operation/output.txt | 8 + .../bundle/dms_fault/update_operation/script | 1 + 28 files changed, 312 insertions(+) create mode 100644 acceptance/bundle/dms_fault/README.md create mode 100644 acceptance/bundle/dms_fault/complete_version/out.test.toml create mode 100644 acceptance/bundle/dms_fault/complete_version/output.txt create mode 100644 acceptance/bundle/dms_fault/complete_version/script create mode 100644 acceptance/bundle/dms_fault/create_deployment/out.test.toml create mode 100644 acceptance/bundle/dms_fault/create_deployment/output.txt create mode 100644 acceptance/bundle/dms_fault/create_deployment/script create mode 100644 acceptance/bundle/dms_fault/create_version/out.test.toml create mode 100644 acceptance/bundle/dms_fault/create_version/output.txt create mode 100644 acceptance/bundle/dms_fault/create_version/script create mode 100644 acceptance/bundle/dms_fault/databricks.yml.tmpl create mode 100644 acceptance/bundle/dms_fault/delete_deployment/out.test.toml create mode 100644 acceptance/bundle/dms_fault/delete_deployment/output.txt create mode 100644 acceptance/bundle/dms_fault/delete_deployment/script create mode 100644 acceptance/bundle/dms_fault/get_deployment/out.test.toml create mode 100644 acceptance/bundle/dms_fault/get_deployment/output.txt create mode 100644 acceptance/bundle/dms_fault/get_deployment/script create mode 100644 acceptance/bundle/dms_fault/job.yml.tmpl create mode 100644 acceptance/bundle/dms_fault/pipeline.sql.tmpl create mode 100644 acceptance/bundle/dms_fault/pipeline.yml.tmpl create mode 100644 acceptance/bundle/dms_fault/run.py create mode 100644 acceptance/bundle/dms_fault/test.toml create mode 100644 acceptance/bundle/dms_fault/update_deployment/out.test.toml create mode 100644 acceptance/bundle/dms_fault/update_deployment/output.txt create mode 100644 acceptance/bundle/dms_fault/update_deployment/script create mode 100644 acceptance/bundle/dms_fault/update_operation/out.test.toml create mode 100644 acceptance/bundle/dms_fault/update_operation/output.txt create mode 100644 acceptance/bundle/dms_fault/update_operation/script diff --git a/acceptance/bundle/dms_fault/README.md b/acceptance/bundle/dms_fault/README.md new file mode 100644 index 00000000000..03399e24888 --- /dev/null +++ b/acceptance/bundle/dms_fault/README.md @@ -0,0 +1,7 @@ +These tests exercise file-backed deployment history while one DMS API persistently returns HTTP 500. Each directory selects an endpoint; the shared runner installs an endpoint-specific `fault.py` rule and checks deploy, validate, summary, generation, unbind, generation with binding, redeploy, and destroy for a job and a pipeline. + +The setup deliberately reaches the selected API: metadata updates rename the bundle with its workspace root pinned, and resource updates force version creation and operation uploads. Destroy uses a separate healthy deployment so a failed deploy-history call cannot prevent the destroy call from being exercised. `UpdateDeployment` is not used by destroy. Deployment creation is also tested when earlier history registration failed. + +Every used fault must produce the injected error and a recorded request. Assertions check live resource names, authoritative file-state IDs, generated pipeline source, successful rebinding, and deletion of the resources and workspace state. + +The file-backed path uses `GetDeployment` for version metadata; it does not call `GetVersion` or read resources from DMS. Fault cases are local only because `fault.py` is provided by the fake server, not the cloud recording proxy. diff --git a/acceptance/bundle/dms_fault/complete_version/out.test.toml b/acceptance/bundle/dms_fault/complete_version/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/complete_version/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/complete_version/output.txt b/acceptance/bundle/dms_fault/complete_version/output.txt new file mode 100644 index 00000000000..1735561f359 --- /dev/null +++ b/acceptance/bundle/dms_fault/complete_version/output.txt @@ -0,0 +1,8 @@ +deploy: ok +validate: ok +summary: ok +generate job, unbind, generate --bind: ok +generate pipeline, unbind, generate --bind: ok +redeploy preserves IDs: ok +destroy: ok +isolated destroy fault exercised: ok diff --git a/acceptance/bundle/dms_fault/complete_version/script b/acceptance/bundle/dms_fault/complete_version/script new file mode 100644 index 00000000000..57bef3e61e8 --- /dev/null +++ b/acceptance/bundle/dms_fault/complete_version/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" complete_version diff --git a/acceptance/bundle/dms_fault/create_deployment/out.test.toml b/acceptance/bundle/dms_fault/create_deployment/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/create_deployment/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/create_deployment/output.txt b/acceptance/bundle/dms_fault/create_deployment/output.txt new file mode 100644 index 00000000000..1735561f359 --- /dev/null +++ b/acceptance/bundle/dms_fault/create_deployment/output.txt @@ -0,0 +1,8 @@ +deploy: ok +validate: ok +summary: ok +generate job, unbind, generate --bind: ok +generate pipeline, unbind, generate --bind: ok +redeploy preserves IDs: ok +destroy: ok +isolated destroy fault exercised: ok diff --git a/acceptance/bundle/dms_fault/create_deployment/script b/acceptance/bundle/dms_fault/create_deployment/script new file mode 100644 index 00000000000..c8f37780f9e --- /dev/null +++ b/acceptance/bundle/dms_fault/create_deployment/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" create_deployment diff --git a/acceptance/bundle/dms_fault/create_version/out.test.toml b/acceptance/bundle/dms_fault/create_version/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/create_version/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/create_version/output.txt b/acceptance/bundle/dms_fault/create_version/output.txt new file mode 100644 index 00000000000..1735561f359 --- /dev/null +++ b/acceptance/bundle/dms_fault/create_version/output.txt @@ -0,0 +1,8 @@ +deploy: ok +validate: ok +summary: ok +generate job, unbind, generate --bind: ok +generate pipeline, unbind, generate --bind: ok +redeploy preserves IDs: ok +destroy: ok +isolated destroy fault exercised: ok diff --git a/acceptance/bundle/dms_fault/create_version/script b/acceptance/bundle/dms_fault/create_version/script new file mode 100644 index 00000000000..3261ce61321 --- /dev/null +++ b/acceptance/bundle/dms_fault/create_version/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" create_version diff --git a/acceptance/bundle/dms_fault/databricks.yml.tmpl b/acceptance/bundle/dms_fault/databricks.yml.tmpl new file mode 100644 index 00000000000..74e22923ff1 --- /dev/null +++ b/acceptance/bundle/dms_fault/databricks.yml.tmpl @@ -0,0 +1,11 @@ +bundle: + name: $RESOURCE_NAME + +workspace: + root_path: $ROOT_PATH + +experimental: + deployment_history: true + +include: + - resources/*.yml diff --git a/acceptance/bundle/dms_fault/delete_deployment/out.test.toml b/acceptance/bundle/dms_fault/delete_deployment/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/delete_deployment/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/delete_deployment/output.txt b/acceptance/bundle/dms_fault/delete_deployment/output.txt new file mode 100644 index 00000000000..1735561f359 --- /dev/null +++ b/acceptance/bundle/dms_fault/delete_deployment/output.txt @@ -0,0 +1,8 @@ +deploy: ok +validate: ok +summary: ok +generate job, unbind, generate --bind: ok +generate pipeline, unbind, generate --bind: ok +redeploy preserves IDs: ok +destroy: ok +isolated destroy fault exercised: ok diff --git a/acceptance/bundle/dms_fault/delete_deployment/script b/acceptance/bundle/dms_fault/delete_deployment/script new file mode 100644 index 00000000000..8d34a920f4f --- /dev/null +++ b/acceptance/bundle/dms_fault/delete_deployment/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" delete_deployment diff --git a/acceptance/bundle/dms_fault/get_deployment/out.test.toml b/acceptance/bundle/dms_fault/get_deployment/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/get_deployment/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/get_deployment/output.txt b/acceptance/bundle/dms_fault/get_deployment/output.txt new file mode 100644 index 00000000000..1735561f359 --- /dev/null +++ b/acceptance/bundle/dms_fault/get_deployment/output.txt @@ -0,0 +1,8 @@ +deploy: ok +validate: ok +summary: ok +generate job, unbind, generate --bind: ok +generate pipeline, unbind, generate --bind: ok +redeploy preserves IDs: ok +destroy: ok +isolated destroy fault exercised: ok diff --git a/acceptance/bundle/dms_fault/get_deployment/script b/acceptance/bundle/dms_fault/get_deployment/script new file mode 100644 index 00000000000..25f1c6fe032 --- /dev/null +++ b/acceptance/bundle/dms_fault/get_deployment/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" get_deployment diff --git a/acceptance/bundle/dms_fault/job.yml.tmpl b/acceptance/bundle/dms_fault/job.yml.tmpl new file mode 100644 index 00000000000..52fbad736a9 --- /dev/null +++ b/acceptance/bundle/dms_fault/job.yml.tmpl @@ -0,0 +1,4 @@ +resources: + jobs: + foo: + name: $RESOURCE_NAME diff --git a/acceptance/bundle/dms_fault/pipeline.sql.tmpl b/acceptance/bundle/dms_fault/pipeline.sql.tmpl new file mode 100644 index 00000000000..2d54c9c6e56 --- /dev/null +++ b/acceptance/bundle/dms_fault/pipeline.sql.tmpl @@ -0,0 +1 @@ +CREATE OR REFRESH MATERIALIZED VIEW $DATASET_NAME AS SELECT 1 AS value; diff --git a/acceptance/bundle/dms_fault/pipeline.yml.tmpl b/acceptance/bundle/dms_fault/pipeline.yml.tmpl new file mode 100644 index 00000000000..a4752c44730 --- /dev/null +++ b/acceptance/bundle/dms_fault/pipeline.yml.tmpl @@ -0,0 +1,10 @@ +resources: + pipelines: + bar: + name: $RESOURCE_NAME + catalog: main + schema: default + serverless: true + libraries: + - file: + path: ../pipeline.sql diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py new file mode 100644 index 00000000000..443d0d17d85 --- /dev/null +++ b/acceptance/bundle/dms_fault/run.py @@ -0,0 +1,196 @@ +#!/usr/bin/env python3 +"""Exercise file-backed bundle commands while one DMS API persistently fails.""" + +import json +import os +import shutil +import subprocess +import sys +from pathlib import Path +from string import Template + +sys.path.insert(0, str(Path(shutil.which("print_requests.py")).parent)) +from print_requests import read_json_many + +API = sys.argv[1] +FIXTURES = Path(__file__).parent +CLI = os.environ["CLI"] +REQUESTS = Path(os.environ["OUT_REQUESTS"]) +LOG = Path("LOG.commands").resolve() +PATTERNS = { + "create_deployment": "POST /api/2.0/bundle/deployments", + "get_deployment": "GET /api/2.0/bundle/deployments/{id}", + "update_deployment": "PATCH /api/2.0/bundle/deployments/{id}", + "delete_deployment": "DELETE /api/2.0/bundle/deployments/{id}", + "create_version": "POST /api/2.0/bundle/deployments/{id}/versions", + "update_operation": "PATCH /api/2.0/bundle/deployments/{id}/versions/*", + "complete_version": "POST /api/2.0/bundle/deployments/{id}/versions/*", +} + + +def run(cwd, *args, expected=0): + result = subprocess.run([CLI, *args], cwd=cwd, text=True, capture_output=True) + with LOG.open("a") as out: + out.write(f"\n{cwd.name}: {args}\nexit={result.returncode}\n{result.stdout}{result.stderr}") + assert result.returncode == expected, result.stdout + result.stderr + return result + + +def fault(pattern, enabled): + subprocess.run( + [sys.executable, shutil.which("fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True + ) + + +def hits(pattern): + if not REQUESTS.exists(): + return 0 + requests = read_json_many(REQUESTS.read_text()) + return sum( + ( + f"{r['method']} {r['path']}".startswith(pattern[:-1]) + if pattern.endswith("*") + else f"{r['method']} {r['path']}" == pattern + ) + for r in requests + ) + + +def state(cwd): + return json.loads((cwd / ".databricks/bundle/default/resources.json").read_text()) + + +def ids(cwd): + data = state(cwd) + assert "deployment_history_shadow" in data["features"], data + assert "deployment_history" not in data["features"], data + return {key: value["__id__"] for key, value in data["state"].items()} + + +def setup(phase): + cwd = Path("work", phase).resolve() + (cwd / "resources").mkdir(parents=True) + name = f"dms-fault-{API}-{phase}-{os.environ['UNIQUE_NAME']}" + root = f"/Workspace/Users/{os.environ['CURRENT_USER_NAME']}/.bundle/{name}" + values = {"RESOURCE_NAME": name, "ROOT_PATH": root, "DATASET_NAME": name.replace("-", "_")} + for source, target in [ + ("databricks.yml.tmpl", "databricks.yml"), + ("job.yml.tmpl", "resources/foo.job.yml"), + ("pipeline.yml.tmpl", "resources/bar.pipeline.yml"), + ("pipeline.sql.tmpl", "pipeline.sql"), + ]: + (cwd / target).write_text(Template((FIXTURES / source).read_text()).substitute(values)) + return cwd, root + + +def activate(cwd, root): + deployment = None + if API != "create_deployment": + run(cwd, "bundle", "deploy", "--auto-approve") + node = json.loads( + run(cwd, "workspace", "get-status", root + "/state/resources.deployment.json", "-o", "json").stdout + ) + deployment = str(node["object_id"]) + pattern = PATTERNS[API].format(id=deployment) + fault(pattern, True) + return pattern + + +def assert_fault(result, pattern, before): + assert hits(pattern) > before, f"{API} was never called" + assert "Fault injected by test." in result.stdout + result.stderr, result.stdout + result.stderr + + +def assert_alive(cwd, current): + job = json.loads(run(cwd, "jobs", "get", current["resources.jobs.foo"], "-o", "json").stdout) + pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) + assert str(job["job_id"]) == current["resources.jobs.foo"] + assert pipeline["pipeline_id"] == current["resources.pipelines.bar"] + assert job["settings"]["name"].startswith("updated-dms-fault-") + assert pipeline["spec"]["name"].startswith("updated-dms-fault-") + + +def generate(cwd, kind, key, identifier, bind=False): + args = ["bundle", "generate", kind, f"--existing-{kind}-id", identifier, "--key", key] + args += [ + "--config-dir", + "resources" if bind else "exported", + "--source-dir", + "src" if bind else "exported-src", + "--force", + ] + if bind: + args.append("--bind") + run(cwd, *args) + + +def assert_destroyed(cwd, root, current): + job = run(cwd, "jobs", "get", current["resources.jobs.foo"], expected=1) + assert "does not exist" in job.stderr.lower(), job.stderr + pipeline = run(cwd, "pipelines", "get", current["resources.pipelines.bar"], expected=1) + assert "not found" in pipeline.stderr.lower(), pipeline.stderr + file = run(cwd, "workspace", "get-status", root + "/state/resources.json", expected=1) + assert "doesn't exist" in file.stderr.lower() or "does not exist" in file.stderr.lower(), file.stderr + + +cwd, root = setup("commands") +pattern = activate(cwd, root) +try: + # Pinning the root lets a bundle-name change exercise UpdateDeployment in place. + config = cwd / "databricks.yml" + config.write_text(config.read_text().replace("name: dms-fault-", "name: updated-dms-fault-")) + for path in (cwd / "resources").glob("*.yml"): + path.write_text(path.read_text().replace("name: dms-fault-", "name: updated-dms-fault-")) + previous = hits(pattern) + result = run(cwd, "bundle", "deploy", "--auto-approve") + current = ids(cwd) + if API != "delete_deployment": + assert_fault(result, pattern, previous) + print("deploy: ok", flush=True) + run(cwd, "bundle", "validate") + print("validate: ok", flush=True) + summary = json.loads(run(cwd, "bundle", "summary", "-o", "json").stdout) + assert str(summary["resources"]["jobs"]["foo"]["id"]) == current["resources.jobs.foo"] + assert summary["resources"]["pipelines"]["bar"]["id"] == current["resources.pipelines.bar"] + print("summary: ok", flush=True) + for kind, key in [("job", "foo"), ("pipeline", "bar")]: + group = "jobs" if kind == "job" else "pipelines" + resource = f"resources.{group}.{key}" + generate(cwd, kind, key, current[resource]) + assert (cwd / "exported" / f"{key}.{kind}.yml").is_file() + if kind == "pipeline": + assert (cwd / "exported-src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() + run(cwd, "bundle", "deployment", "unbind", key) + assert resource not in state(cwd)["state"] + assert_alive(cwd, current) + generate(cwd, kind, key, current[resource], bind=True) + assert ids(cwd)[resource] == current[resource] + if kind == "pipeline": + assert (cwd / "src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() + print(f"generate {kind}, unbind, generate --bind: ok", flush=True) + run(cwd, "bundle", "validate") + run(cwd, "bundle", "deploy", "--auto-approve") + assert ids(cwd) == current + pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) + assert pipeline["spec"]["libraries"][0]["file"]["path"] == root + "/files/src/pipeline.sql" + print("redeploy preserves IDs: ok", flush=True) + run(cwd, "bundle", "destroy", "--auto-approve") + assert_destroyed(cwd, root, current) + print("destroy: ok", flush=True) +finally: + fault(pattern, False) + +if API != "update_deployment": + cwd, root = setup("destroy") + pattern = activate(cwd, root) + try: + if API == "create_deployment": + run(cwd, "bundle", "deploy", "--auto-approve") + current = ids(cwd) + previous = hits(pattern) + result = run(cwd, "bundle", "destroy", "--auto-approve") + assert_fault(result, pattern, previous) + assert_destroyed(cwd, root, current) + print("isolated destroy fault exercised: ok", flush=True) + finally: + fault(pattern, False) diff --git a/acceptance/bundle/dms_fault/test.toml b/acceptance/bundle/dms_fault/test.toml new file mode 100644 index 00000000000..f342e1db31b --- /dev/null +++ b/acceptance/bundle/dms_fault/test.toml @@ -0,0 +1,7 @@ +Cloud = false +RecordRequests = true +Timeout = '120s' +EnvMatrix.DMS = ['true'] +Env.DATABRICKS_BUNDLE_DEV_DEPLOYMENT_HISTORY_ONLY = 'false' +Env.DATABRICKS_BUNDLE_RETRY_INTERVAL_MS = '0' +Ignore = ['work'] diff --git a/acceptance/bundle/dms_fault/update_deployment/out.test.toml b/acceptance/bundle/dms_fault/update_deployment/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/update_deployment/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/update_deployment/output.txt b/acceptance/bundle/dms_fault/update_deployment/output.txt new file mode 100644 index 00000000000..3ab01928ca0 --- /dev/null +++ b/acceptance/bundle/dms_fault/update_deployment/output.txt @@ -0,0 +1,7 @@ +deploy: ok +validate: ok +summary: ok +generate job, unbind, generate --bind: ok +generate pipeline, unbind, generate --bind: ok +redeploy preserves IDs: ok +destroy: ok diff --git a/acceptance/bundle/dms_fault/update_deployment/script b/acceptance/bundle/dms_fault/update_deployment/script new file mode 100644 index 00000000000..94fdf6e7f40 --- /dev/null +++ b/acceptance/bundle/dms_fault/update_deployment/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" update_deployment diff --git a/acceptance/bundle/dms_fault/update_operation/out.test.toml b/acceptance/bundle/dms_fault/update_operation/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/update_operation/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/update_operation/output.txt b/acceptance/bundle/dms_fault/update_operation/output.txt new file mode 100644 index 00000000000..1735561f359 --- /dev/null +++ b/acceptance/bundle/dms_fault/update_operation/output.txt @@ -0,0 +1,8 @@ +deploy: ok +validate: ok +summary: ok +generate job, unbind, generate --bind: ok +generate pipeline, unbind, generate --bind: ok +redeploy preserves IDs: ok +destroy: ok +isolated destroy fault exercised: ok diff --git a/acceptance/bundle/dms_fault/update_operation/script b/acceptance/bundle/dms_fault/update_operation/script new file mode 100644 index 00000000000..4400cd94944 --- /dev/null +++ b/acceptance/bundle/dms_fault/update_operation/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" update_operation From c7004c5ac247cac21173c7a2f16256a4b54e2294 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 15:02:03 +0000 Subject: [PATCH 02/10] Record bundle output for faults across all DMS APIs --- acceptance/bundle/dms_fault/README.md | 22 ++- .../dms_fault/complete_version/output.txt | 151 ++++++++++++++++- .../dms_fault/create_deployment/output.txt | 141 +++++++++++++++- .../dms_fault/create_version/output.txt | 149 ++++++++++++++++- .../dms_fault/delete_deployment/output.txt | 153 +++++++++++++++++- .../dms_fault/get_deployment/output.txt | 153 +++++++++++++++++- .../dms_fault/get_operation/out.test.toml | 2 + .../bundle/dms_fault/get_operation/output.txt | 139 ++++++++++++++++ .../bundle/dms_fault/get_operation/script | 1 + .../dms_fault/get_resource/out.test.toml | 2 + .../bundle/dms_fault/get_resource/output.txt | 139 ++++++++++++++++ .../bundle/dms_fault/get_resource/script | 1 + .../dms_fault/get_version/out.test.toml | 2 + .../bundle/dms_fault/get_version/output.txt | 139 ++++++++++++++++ .../bundle/dms_fault/get_version/script | 1 + .../bundle/dms_fault/heartbeat/out.test.toml | 2 + .../bundle/dms_fault/heartbeat/output.txt | 139 ++++++++++++++++ acceptance/bundle/dms_fault/heartbeat/script | 1 + .../dms_fault/list_deployments/out.test.toml | 2 + .../dms_fault/list_deployments/output.txt | 139 ++++++++++++++++ .../bundle/dms_fault/list_deployments/script | 1 + .../dms_fault/list_operations/out.test.toml | 2 + .../dms_fault/list_operations/output.txt | 139 ++++++++++++++++ .../bundle/dms_fault/list_operations/script | 1 + .../dms_fault/list_resources/out.test.toml | 2 + .../dms_fault/list_resources/output.txt | 139 ++++++++++++++++ .../bundle/dms_fault/list_resources/script | 1 + .../dms_fault/list_versions/out.test.toml | 2 + .../bundle/dms_fault/list_versions/output.txt | 139 ++++++++++++++++ .../bundle/dms_fault/list_versions/script | 1 + acceptance/bundle/dms_fault/run.py | 142 ++++++++++------ acceptance/bundle/dms_fault/test.toml | 5 + .../dms_fault/update_deployment/output.txt | 150 ++++++++++++++++- .../dms_fault/update_operation/output.txt | 151 ++++++++++++++++- 34 files changed, 2242 insertions(+), 111 deletions(-) create mode 100644 acceptance/bundle/dms_fault/get_operation/out.test.toml create mode 100644 acceptance/bundle/dms_fault/get_operation/output.txt create mode 100644 acceptance/bundle/dms_fault/get_operation/script create mode 100644 acceptance/bundle/dms_fault/get_resource/out.test.toml create mode 100644 acceptance/bundle/dms_fault/get_resource/output.txt create mode 100644 acceptance/bundle/dms_fault/get_resource/script create mode 100644 acceptance/bundle/dms_fault/get_version/out.test.toml create mode 100644 acceptance/bundle/dms_fault/get_version/output.txt create mode 100644 acceptance/bundle/dms_fault/get_version/script create mode 100644 acceptance/bundle/dms_fault/heartbeat/out.test.toml create mode 100644 acceptance/bundle/dms_fault/heartbeat/output.txt create mode 100644 acceptance/bundle/dms_fault/heartbeat/script create mode 100644 acceptance/bundle/dms_fault/list_deployments/out.test.toml create mode 100644 acceptance/bundle/dms_fault/list_deployments/output.txt create mode 100644 acceptance/bundle/dms_fault/list_deployments/script create mode 100644 acceptance/bundle/dms_fault/list_operations/out.test.toml create mode 100644 acceptance/bundle/dms_fault/list_operations/output.txt create mode 100644 acceptance/bundle/dms_fault/list_operations/script create mode 100644 acceptance/bundle/dms_fault/list_resources/out.test.toml create mode 100644 acceptance/bundle/dms_fault/list_resources/output.txt create mode 100644 acceptance/bundle/dms_fault/list_resources/script create mode 100644 acceptance/bundle/dms_fault/list_versions/out.test.toml create mode 100644 acceptance/bundle/dms_fault/list_versions/output.txt create mode 100644 acceptance/bundle/dms_fault/list_versions/script diff --git a/acceptance/bundle/dms_fault/README.md b/acceptance/bundle/dms_fault/README.md index 03399e24888..c31a99e2ddf 100644 --- a/acceptance/bundle/dms_fault/README.md +++ b/acceptance/bundle/dms_fault/README.md @@ -1,7 +1,19 @@ -These tests exercise file-backed deployment history while one DMS API persistently returns HTTP 500. Each directory selects an endpoint; the shared runner installs an endpoint-specific `fault.py` rule and checks deploy, validate, summary, generation, unbind, generation with binding, redeploy, and destroy for a job and a pipeline. +Fault cases cover all DMS APIs: -The setup deliberately reaches the selected API: metadata updates rename the bundle with its workspace root pinned, and resource updates force version creation and operation uploads. Destroy uses a separate healthy deployment so a failed deploy-history call cannot prevent the destroy call from being exercised. `UpdateDeployment` is not used by destroy. Deployment creation is also tested when earlier history registration failed. +- `CompleteVersion` +- `CreateDeployment` +- `CreateVersion` +- `DeleteDeployment` +- `GetDeployment` +- `GetOperation` +- `GetResource` +- `GetVersion` +- `Heartbeat` +- `ListDeployments` +- `ListOperations` +- `ListResources` +- `ListVersions` +- `UpdateDeployment` +- `UpdateOperation` -Every used fault must produce the injected error and a recorded request. Assertions check live resource names, authoritative file-state IDs, generated pipeline source, successful rebinding, and deletion of the resources and workspace state. - -The file-backed path uses `GetDeployment` for version metadata; it does not call `GetVersion` or read resources from DMS. Fault cases are local only because `fault.py` is provided by the fake server, not the cloud recording proxy. +Missing APIs: none. Each snapshot records the bundle commands, their output, and whether the injected endpoint was called. diff --git a/acceptance/bundle/dms_fault/complete_version/output.txt b/acceptance/bundle/dms_fault/complete_version/output.txt index 1735561f359..23577dcceb7 100644 --- a/acceptance/bundle/dms_fault/complete_version/output.txt +++ b/acceptance/bundle/dms_fault/complete_version/output.txt @@ -1,8 +1,143 @@ -deploy: ok -validate: ok -summary: ok -generate job, unbind, generate --bind: ok -generate pipeline, unbind, generate --bind: ok -redeploy preserves IDs: ok -destroy: ok -isolated destroy fault exercised: ok + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: complete_version fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + Warn: Failed to complete deployment history version: Fault injected by test. + +>>> bundle validate + Name: updated-dms-fault-complete_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-complete_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-complete_version-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-complete_version-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-complete_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + Warn: Failed to complete deployment history version: Fault injected by test. + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME] + + Warn: Failed to complete deployment history version: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: complete_version fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-destroy-[UNIQUE_NAME] + + Warn: Failed to complete deployment history version: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes diff --git a/acceptance/bundle/dms_fault/create_deployment/output.txt b/acceptance/bundle/dms_fault/create_deployment/output.txt index 1735561f359..493ed5990f4 100644 --- a/acceptance/bundle/dms_fault/create_deployment/output.txt +++ b/acceptance/bundle/dms_fault/create_deployment/output.txt @@ -1,8 +1,133 @@ -deploy: ok -validate: ok -summary: ok -generate job, unbind, generate --bind: ok -generate pipeline, unbind, generate --bind: ok -redeploy preserves IDs: ok -destroy: ok -isolated destroy fault exercised: ok + +=== commands: setup + +=== commands: create_deployment fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME]/files... + Warn: Could not enable deployment history for this deploy: failed to create deployment: Fault injected by test. + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-create_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-create_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-create_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-create_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-create_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME]/files... + Warn: Could not enable deployment history for this deploy: failed to create deployment: Fault injected by test. + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME] + + Warn: Could not record deployment history for this destroy: failed to create deployment: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes + +=== destroy: setup + +=== destroy: create_deployment fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-destroy-[UNIQUE_NAME]/files... + Warn: Could not enable deployment history for this deploy: failed to create deployment: Fault injected by test. + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-destroy-[UNIQUE_NAME] + + Warn: Could not record deployment history for this destroy: failed to create deployment: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes diff --git a/acceptance/bundle/dms_fault/create_version/output.txt b/acceptance/bundle/dms_fault/create_version/output.txt index 1735561f359..bb1082bcfb7 100644 --- a/acceptance/bundle/dms_fault/create_version/output.txt +++ b/acceptance/bundle/dms_fault/create_version/output.txt @@ -1,8 +1,141 @@ -deploy: ok -validate: ok -summary: ok -generate job, unbind, generate --bind: ok -generate pipeline, unbind, generate --bind: ok -redeploy preserves IDs: ok -destroy: ok -isolated destroy fault exercised: ok + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: create_version fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME]/files... + Warn: Could not enable deployment history for this deploy: failed to create deployment version: Fault injected by test. + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-create_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-create_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-create_version-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-create_version-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-create_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME]/files... + Warn: Could not enable deployment history for this deploy: failed to create deployment version: Fault injected by test. + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME] + + Warn: Could not record deployment history for this destroy: failed to create deployment version: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: create_version fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-destroy-[UNIQUE_NAME] + + Warn: Could not record deployment history for this destroy: failed to create deployment version: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes diff --git a/acceptance/bundle/dms_fault/delete_deployment/output.txt b/acceptance/bundle/dms_fault/delete_deployment/output.txt index 1735561f359..6e59f572abb 100644 --- a/acceptance/bundle/dms_fault/delete_deployment/output.txt +++ b/acceptance/bundle/dms_fault/delete_deployment/output.txt @@ -1,8 +1,145 @@ -deploy: ok -validate: ok -summary: ok -generate job, unbind, generate --bind: ok -generate pipeline, unbind, generate --bind: ok -redeploy preserves IDs: ok -destroy: ok -isolated destroy fault exercised: ok + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: delete_deployment fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-delete_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-delete_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-delete_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-delete_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-delete_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME] + + Warn: retrying after 500 Internal Server Error from DELETE /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from DELETE /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not delete deployment history: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: delete_deployment fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-destroy-[UNIQUE_NAME] + + Warn: retrying after 500 Internal Server Error from DELETE /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from DELETE /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not delete deployment history: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes diff --git a/acceptance/bundle/dms_fault/get_deployment/output.txt b/acceptance/bundle/dms_fault/get_deployment/output.txt index 1735561f359..6c1e6751ddf 100644 --- a/acceptance/bundle/dms_fault/get_deployment/output.txt +++ b/acceptance/bundle/dms_fault/get_deployment/output.txt @@ -1,8 +1,145 @@ -deploy: ok -validate: ok -summary: ok -generate job, unbind, generate --bind: ok -generate pipeline, unbind, generate --bind: ok -redeploy preserves IDs: ok -destroy: ok -isolated destroy fault exercised: ok + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: get_deployment fault enabled + +>>> bundle deploy --auto-approve + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not read deployment history: Fault injected by test. + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: yes + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: get_deployment fault enabled + +>>> bundle destroy --auto-approve + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not read deployment history: Fault injected by test. + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: yes diff --git a/acceptance/bundle/dms_fault/get_operation/out.test.toml b/acceptance/bundle/dms_fault/get_operation/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/get_operation/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/get_operation/output.txt b/acceptance/bundle/dms_fault/get_operation/output.txt new file mode 100644 index 00000000000..bee143ede24 --- /dev/null +++ b/acceptance/bundle/dms_fault/get_operation/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: get_operation fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-get_operation-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-get_operation-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-get_operation-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-get_operation-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-get_operation-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: get_operation fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/get_operation/script b/acceptance/bundle/dms_fault/get_operation/script new file mode 100644 index 00000000000..ed38a0ce0cd --- /dev/null +++ b/acceptance/bundle/dms_fault/get_operation/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" get_operation diff --git a/acceptance/bundle/dms_fault/get_resource/out.test.toml b/acceptance/bundle/dms_fault/get_resource/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/get_resource/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/get_resource/output.txt b/acceptance/bundle/dms_fault/get_resource/output.txt new file mode 100644 index 00000000000..6d78b88bed3 --- /dev/null +++ b/acceptance/bundle/dms_fault/get_resource/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: get_resource fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-get_resource-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-get_resource-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-get_resource-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-get_resource-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-get_resource-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: get_resource fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/get_resource/script b/acceptance/bundle/dms_fault/get_resource/script new file mode 100644 index 00000000000..8f4f5e8b9b5 --- /dev/null +++ b/acceptance/bundle/dms_fault/get_resource/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" get_resource diff --git a/acceptance/bundle/dms_fault/get_version/out.test.toml b/acceptance/bundle/dms_fault/get_version/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/get_version/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/get_version/output.txt b/acceptance/bundle/dms_fault/get_version/output.txt new file mode 100644 index 00000000000..976e3b760ee --- /dev/null +++ b/acceptance/bundle/dms_fault/get_version/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: get_version fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-get_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-get_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-get_version-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-get_version-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-get_version-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: get_version fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/get_version/script b/acceptance/bundle/dms_fault/get_version/script new file mode 100644 index 00000000000..30468ab5e64 --- /dev/null +++ b/acceptance/bundle/dms_fault/get_version/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" get_version diff --git a/acceptance/bundle/dms_fault/heartbeat/out.test.toml b/acceptance/bundle/dms_fault/heartbeat/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/heartbeat/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/heartbeat/output.txt b/acceptance/bundle/dms_fault/heartbeat/output.txt new file mode 100644 index 00000000000..7666c0efefd --- /dev/null +++ b/acceptance/bundle/dms_fault/heartbeat/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: heartbeat fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-heartbeat-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-heartbeat-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-heartbeat-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-heartbeat-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-heartbeat-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: heartbeat fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/heartbeat/script b/acceptance/bundle/dms_fault/heartbeat/script new file mode 100644 index 00000000000..5fe90e5f2c9 --- /dev/null +++ b/acceptance/bundle/dms_fault/heartbeat/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" heartbeat diff --git a/acceptance/bundle/dms_fault/list_deployments/out.test.toml b/acceptance/bundle/dms_fault/list_deployments/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/list_deployments/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/list_deployments/output.txt b/acceptance/bundle/dms_fault/list_deployments/output.txt new file mode 100644 index 00000000000..9bae5e3e696 --- /dev/null +++ b/acceptance/bundle/dms_fault/list_deployments/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: list_deployments fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-list_deployments-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-list_deployments-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-list_deployments-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-list_deployments-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-list_deployments-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: list_deployments fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_deployments/script b/acceptance/bundle/dms_fault/list_deployments/script new file mode 100644 index 00000000000..49edc815cf9 --- /dev/null +++ b/acceptance/bundle/dms_fault/list_deployments/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" list_deployments diff --git a/acceptance/bundle/dms_fault/list_operations/out.test.toml b/acceptance/bundle/dms_fault/list_operations/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/list_operations/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/list_operations/output.txt b/acceptance/bundle/dms_fault/list_operations/output.txt new file mode 100644 index 00000000000..c3ec32d7083 --- /dev/null +++ b/acceptance/bundle/dms_fault/list_operations/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: list_operations fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-list_operations-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-list_operations-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-list_operations-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-list_operations-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-list_operations-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: list_operations fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_operations/script b/acceptance/bundle/dms_fault/list_operations/script new file mode 100644 index 00000000000..3c63f9567c2 --- /dev/null +++ b/acceptance/bundle/dms_fault/list_operations/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" list_operations diff --git a/acceptance/bundle/dms_fault/list_resources/out.test.toml b/acceptance/bundle/dms_fault/list_resources/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/list_resources/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/list_resources/output.txt b/acceptance/bundle/dms_fault/list_resources/output.txt new file mode 100644 index 00000000000..8d4d4aafcfa --- /dev/null +++ b/acceptance/bundle/dms_fault/list_resources/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: list_resources fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-list_resources-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-list_resources-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-list_resources-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-list_resources-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-list_resources-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: list_resources fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_resources/script b/acceptance/bundle/dms_fault/list_resources/script new file mode 100644 index 00000000000..1c3c3bffa5d --- /dev/null +++ b/acceptance/bundle/dms_fault/list_resources/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" list_resources diff --git a/acceptance/bundle/dms_fault/list_versions/out.test.toml b/acceptance/bundle/dms_fault/list_versions/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/dms_fault/list_versions/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/dms_fault/list_versions/output.txt b/acceptance/bundle/dms_fault/list_versions/output.txt new file mode 100644 index 00000000000..4bfff0f00ef --- /dev/null +++ b/acceptance/bundle/dms_fault/list_versions/output.txt @@ -0,0 +1,139 @@ + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: list_versions fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-list_versions-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-list_versions-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-list_versions-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-list_versions-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-list_versions-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: list_versions fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_versions/script b/acceptance/bundle/dms_fault/list_versions/script new file mode 100644 index 00000000000..7582b7fb740 --- /dev/null +++ b/acceptance/bundle/dms_fault/list_versions/script @@ -0,0 +1 @@ +python3 "$TESTDIR/../run.py" list_versions diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index 443d0d17d85..668658b1deb 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -3,6 +3,8 @@ import json import os +import re +import shlex import shutil import subprocess import sys @@ -10,6 +12,7 @@ from string import Template sys.path.insert(0, str(Path(shutil.which("print_requests.py")).parent)) +from add_repl import add_repl from print_requests import read_json_many API = sys.argv[1] @@ -18,21 +21,46 @@ REQUESTS = Path(os.environ["OUT_REQUESTS"]) LOG = Path("LOG.commands").resolve() PATTERNS = { + "complete_version": "POST /api/2.0/bundle/deployments/{id}/versions/{version}/complete", "create_deployment": "POST /api/2.0/bundle/deployments", + "create_version": "POST /api/2.0/bundle/deployments/{id}/versions", + "delete_deployment": "DELETE /api/2.0/bundle/deployments/{id}", "get_deployment": "GET /api/2.0/bundle/deployments/{id}", + "get_operation": "GET /api/2.0/bundle/deployments/{id}/versions/{version}/operations/*", + "get_resource": "GET /api/2.0/bundle/deployments/{id}/resources/*", + "get_version": "GET /api/2.0/bundle/deployments/{id}/versions/{version}", + "heartbeat": "POST /api/2.0/bundle/deployments/{id}/versions/{version}/heartbeat", + "list_deployments": "GET /api/2.0/bundle/deployments", + "list_operations": "GET /api/2.0/bundle/deployments/{id}/versions/{version}/operations", + "list_resources": "GET /api/2.0/bundle/deployments/{id}/resources", + "list_versions": "GET /api/2.0/bundle/deployments/{id}/versions", "update_deployment": "PATCH /api/2.0/bundle/deployments/{id}", - "delete_deployment": "DELETE /api/2.0/bundle/deployments/{id}", - "create_version": "POST /api/2.0/bundle/deployments/{id}/versions", "update_operation": "PATCH /api/2.0/bundle/deployments/{id}/versions/*", - "complete_version": "POST /api/2.0/bundle/deployments/{id}/versions/*", } +ACTIVE = None +REGISTERED = set() +KNOWN_IDS = set() def run(cwd, *args, expected=0): - result = subprocess.run([CLI, *args], cwd=cwd, text=True, capture_output=True) + visible = args[0] == "bundle" + if visible: + refresh_faults(cwd) + result = subprocess.run( + [CLI, *args], + cwd=cwd, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT if visible else subprocess.PIPE, + ) + output = result.stdout + (result.stderr or "") with LOG.open("a") as out: - out.write(f"\n{cwd.name}: {args}\nexit={result.returncode}\n{result.stdout}{result.stderr}") - assert result.returncode == expected, result.stdout + result.stderr + out.write(f"\n{cwd.name}: {args}\nexit={result.returncode}\n{output}") + if visible: + print("\n>>> " + shlex.join(args), flush=True) + for line in output.splitlines(): + print(" " + line if line else "", flush=True) + assert result.returncode == expected, output return result @@ -42,18 +70,34 @@ def fault(pattern, enabled): ) +def refresh_faults(cwd): + if ACTIVE is None: + return + if "{version}" in ACTIVE: + # Cover existing versions and the next version a command can create. + serial = state(cwd).get("serial", 0) + patterns = [ACTIVE.format(version=version) for version in range(1, serial + 2)] + else: + patterns = [ACTIVE] + for pattern in patterns: + if pattern not in REGISTERED: + fault(pattern, True) + REGISTERED.add(pattern) + + +def clear_faults(): + global ACTIVE + ACTIVE = None + for pattern in REGISTERED: + fault(pattern, False) + REGISTERED.clear() + + def hits(pattern): if not REQUESTS.exists(): return 0 - requests = read_json_many(REQUESTS.read_text()) - return sum( - ( - f"{r['method']} {r['path']}".startswith(pattern[:-1]) - if pattern.endswith("*") - else f"{r['method']} {r['path']}" == pattern - ) - for r in requests - ) + regex = re.escape(pattern).replace(r"\{version\}", r"[^/]+").replace(r"\*", ".*") + "$" + return sum(bool(re.fullmatch(regex, f"{r['method']} {r['path']}")) for r in read_json_many(REQUESTS.read_text())) def state(cwd): @@ -64,7 +108,12 @@ def ids(cwd): data = state(cwd) assert "deployment_history_shadow" in data["features"], data assert "deployment_history" not in data["features"], data - return {key: value["__id__"] for key, value in data["state"].items()} + current = {key: value["__id__"] for key, value in data["state"].items()} + for key, value in current.items(): + if value not in KNOWN_IDS: + add_repl(value, key.rsplit(".", 1)[1].upper() + "_ID") + KNOWN_IDS.add(value) + return current def setup(phase): @@ -84,6 +133,8 @@ def setup(phase): def activate(cwd, root): + global ACTIVE + print(f"\n=== {cwd.name}: setup", flush=True) deployment = None if API != "create_deployment": run(cwd, "bundle", "deploy", "--auto-approve") @@ -91,16 +142,13 @@ def activate(cwd, root): run(cwd, "workspace", "get-status", root + "/state/resources.deployment.json", "-o", "json").stdout ) deployment = str(node["object_id"]) - pattern = PATTERNS[API].format(id=deployment) - fault(pattern, True) + pattern = PATTERNS[API].format(id=deployment, version="{version}") + ACTIVE = pattern + refresh_faults(cwd) + print(f"\n=== {cwd.name}: {API} fault enabled", flush=True) return pattern -def assert_fault(result, pattern, before): - assert hits(pattern) > before, f"{API} was never called" - assert "Fault injected by test." in result.stdout + result.stderr, result.stdout + result.stderr - - def assert_alive(cwd, current): job = json.loads(run(cwd, "jobs", "get", current["resources.jobs.foo"], "-o", "json").stdout) pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) @@ -142,17 +190,12 @@ def assert_destroyed(cwd, root, current): for path in (cwd / "resources").glob("*.yml"): path.write_text(path.read_text().replace("name: dms-fault-", "name: updated-dms-fault-")) previous = hits(pattern) - result = run(cwd, "bundle", "deploy", "--auto-approve") + run(cwd, "bundle", "deploy", "--auto-approve") current = ids(cwd) - if API != "delete_deployment": - assert_fault(result, pattern, previous) - print("deploy: ok", flush=True) run(cwd, "bundle", "validate") - print("validate: ok", flush=True) - summary = json.loads(run(cwd, "bundle", "summary", "-o", "json").stdout) - assert str(summary["resources"]["jobs"]["foo"]["id"]) == current["resources.jobs.foo"] - assert summary["resources"]["pipelines"]["bar"]["id"] == current["resources.pipelines.bar"] - print("summary: ok", flush=True) + summary = run(cwd, "bundle", "summary").stdout + assert current["resources.jobs.foo"] in summary + assert current["resources.pipelines.bar"] in summary for kind, key in [("job", "foo"), ("pipeline", "bar")]: group = "jobs" if kind == "job" else "pipelines" resource = f"resources.{group}.{key}" @@ -167,30 +210,27 @@ def assert_destroyed(cwd, root, current): assert ids(cwd)[resource] == current[resource] if kind == "pipeline": assert (cwd / "src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() - print(f"generate {kind}, unbind, generate --bind: ok", flush=True) run(cwd, "bundle", "validate") run(cwd, "bundle", "deploy", "--auto-approve") assert ids(cwd) == current pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) assert pipeline["spec"]["libraries"][0]["file"]["path"] == root + "/files/src/pipeline.sql" - print("redeploy preserves IDs: ok", flush=True) run(cwd, "bundle", "destroy", "--auto-approve") assert_destroyed(cwd, root, current) - print("destroy: ok", flush=True) + print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) finally: - fault(pattern, False) - -if API != "update_deployment": - cwd, root = setup("destroy") - pattern = activate(cwd, root) - try: - if API == "create_deployment": - run(cwd, "bundle", "deploy", "--auto-approve") - current = ids(cwd) - previous = hits(pattern) - result = run(cwd, "bundle", "destroy", "--auto-approve") - assert_fault(result, pattern, previous) - assert_destroyed(cwd, root, current) - print("isolated destroy fault exercised: ok", flush=True) - finally: - fault(pattern, False) + clear_faults() + + +cwd, root = setup("destroy") +pattern = activate(cwd, root) +try: + if API == "create_deployment": + run(cwd, "bundle", "deploy", "--auto-approve") + current = ids(cwd) + previous = hits(pattern) + run(cwd, "bundle", "destroy", "--auto-approve") + assert_destroyed(cwd, root, current) + print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) +finally: + clear_faults() diff --git a/acceptance/bundle/dms_fault/test.toml b/acceptance/bundle/dms_fault/test.toml index f342e1db31b..b4bb3e15d02 100644 --- a/acceptance/bundle/dms_fault/test.toml +++ b/acceptance/bundle/dms_fault/test.toml @@ -5,3 +5,8 @@ EnvMatrix.DMS = ['true'] Env.DATABRICKS_BUNDLE_DEV_DEPLOYMENT_HISTORY_ONLY = 'false' Env.DATABRICKS_BUNDLE_RETRY_INTERVAL_MS = '0' Ignore = ['work'] +SortLines.deploy_actions = '^ (Created|Updated|Deleted|Recreated|Resized) \S+$' + +[[Repls]] +Old = 'recording operation for resources\.[^:]+:' +New = 'recording operation for [RESOURCE_KEY]:' diff --git a/acceptance/bundle/dms_fault/update_deployment/output.txt b/acceptance/bundle/dms_fault/update_deployment/output.txt index 3ab01928ca0..e2add863e74 100644 --- a/acceptance/bundle/dms_fault/update_deployment/output.txt +++ b/acceptance/bundle/dms_fault/update_deployment/output.txt @@ -1,7 +1,143 @@ -deploy: ok -validate: ok -summary: ok -generate job, unbind, generate --bind: ok -generate pipeline, unbind, generate --bind: ok -redeploy preserves IDs: ok -destroy: ok + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: update_deployment fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME]/files... + Warn: retrying after 500 Internal Server Error from PATCH /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from PATCH /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not enable deployment history for this deploy: failed to update deployment: Fault injected by test. + Updated jobs.foo + Updated pipelines.bar + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-update_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-update_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-update_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-update_deployment-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-update_deployment-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME]/files... + Warn: retrying after 500 Internal Server Error from PATCH /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from PATCH /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not enable deployment history for this deploy: failed to update deployment: Fault injected by test. + Updated pipelines.bar + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: yes + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: update_deployment fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-destroy-[UNIQUE_NAME] + + Destroy: 2 deleted + +DMS API called: no diff --git a/acceptance/bundle/dms_fault/update_operation/output.txt b/acceptance/bundle/dms_fault/update_operation/output.txt index 1735561f359..52b0e5d4bc8 100644 --- a/acceptance/bundle/dms_fault/update_operation/output.txt +++ b/acceptance/bundle/dms_fault/update_operation/output.txt @@ -1,8 +1,143 @@ -deploy: ok -validate: ok -summary: ok -generate job, unbind, generate --bind: ok -generate pipeline, unbind, generate --bind: ok -redeploy preserves IDs: ok -destroy: ok -isolated destroy fault exercised: ok + +=== commands: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== commands: update_operation fault enabled + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=2 + Updated jobs.foo + Updated pipelines.bar + Warn: Failed to record deployment history: recording operation for [RESOURCE_KEY]: Fault injected by test. + Files: 3 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle validate + Name: updated-dms-fault-update_operation-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle summary + Name: updated-dms-fault-update_operation-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME] + Resources: + Jobs: + foo: + Name: updated-dms-fault-update_operation-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] + Pipelines: + bar: + Name: updated-dms-fault-update_operation-commands-[UNIQUE_NAME] + URL: [DATABRICKS_URL]/pipelines/[BAR_ID]?w=[WORKSPACE_ID] + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir exported --source-dir exported-src --force + Job configuration successfully saved to exported/foo.job.yml + Warning: Generated configuration is not included in the bundle + + The file exported/foo.job.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind foo + +>>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind + Job configuration successfully saved to resources/foo.job.yml + Successfully bound job with an id '[FOO_ID]' + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force + File successfully saved to exported-src/pipeline.sql + Pipeline configuration successfully saved to exported/bar.pipeline.yml + Warning: Generated configuration is not included in the bundle + + The file exported/bar.pipeline.yml is not matched by any pattern in the 'include' section of databricks.yml, + so it will not be deployed. Add a matching entry to the 'include' section, for example: + + include: + - exported/*.yml + + +>>> bundle deployment unbind bar + +>>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind + File successfully saved to src/pipeline.sql + Pipeline configuration successfully saved to resources/bar.pipeline.yml + Successfully bound pipeline with an id '[BAR_ID]' + +>>> bundle validate + Name: updated-dms-fault-update_operation-commands-[UNIQUE_NAME] + Target: default + Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME] + + Validation OK! + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated pipelines.bar + Warn: Failed to record deployment history: recording operation for [RESOURCE_KEY]: Fault injected by test. + Files: 6 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME] + + Warn: Failed to record deployment history: recording operation for [RESOURCE_KEY]: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes + +=== destroy: setup + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-destroy-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 + Created jobs.foo + Created pipelines.bar + Files: 4 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== destroy: update_operation fault enabled + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-destroy-[UNIQUE_NAME] + + Warn: Failed to record deployment history: recording operation for [RESOURCE_KEY]: Fault injected by test. + Destroy: 2 deleted + +DMS API called: yes From e47506a6878d49eb9b2e091edb176909280ba510 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 15:31:41 +0000 Subject: [PATCH 03/10] Simplify and document the DMS fault test workflow --- acceptance/bundle/dms_fault/README.md | 25 +++++++++++- .../dms_fault/complete_version/output.txt | 37 ------------------ .../dms_fault/create_deployment/output.txt | 37 ------------------ .../dms_fault/create_version/output.txt | 37 ------------------ .../dms_fault/delete_deployment/output.txt | 39 ------------------- .../dms_fault/get_deployment/output.txt | 39 ------------------- .../bundle/dms_fault/get_operation/output.txt | 36 ----------------- .../bundle/dms_fault/get_resource/output.txt | 36 ----------------- .../bundle/dms_fault/get_version/output.txt | 36 ----------------- .../bundle/dms_fault/heartbeat/output.txt | 36 ----------------- .../dms_fault/list_deployments/output.txt | 36 ----------------- .../dms_fault/list_operations/output.txt | 36 ----------------- .../dms_fault/list_resources/output.txt | 36 ----------------- .../bundle/dms_fault/list_versions/output.txt | 36 ----------------- acceptance/bundle/dms_fault/run.py | 17 +------- .../dms_fault/update_deployment/output.txt | 36 ----------------- .../dms_fault/update_operation/output.txt | 37 ------------------ 17 files changed, 25 insertions(+), 567 deletions(-) diff --git a/acceptance/bundle/dms_fault/README.md b/acceptance/bundle/dms_fault/README.md index c31a99e2ddf..9c69b629b11 100644 --- a/acceptance/bundle/dms_fault/README.md +++ b/acceptance/bundle/dms_fault/README.md @@ -1,3 +1,26 @@ +Each API case runs the same linear workflow with a job and a pipeline. DMS records +deployment history while files remain the source of truth. All bundle commands +must succeed with the selected API configured to return HTTP 500. + +| Step | Command or action | Assertion | +| --- | --- | --- | +| 1 | Deploy with DMS healthy. | Establish an existing deployment and its DMS deployment ID. | +| 2 | Enable the API fault, rename the bundle and resources with the workspace root pinned, then deploy. | Both resources exist with their updated names. State retains file-backed history recording. The bundle rename exercises `UpdateDeployment`. | +| 3 | Run `bundle summary`. | Output contains both resource IDs. | +| 4 | Run `bundle generate` into the export directory. | The resource YAML exists; pipeline SQL is downloaded with its original content. | +| 5 | Run `bundle deployment unbind`. | The resource ID is removed from bundle state. | +| 6 | Run `bundle generate --bind` into the bundle's resource directory. | Generation and binding succeed for the original resource ID, proving unbind preserved the remote resource. Pipeline SQL is downloaded with its original content. | +| 7 | Run `bundle validate`, then deploy again. | Generated configuration is valid, both resource IDs stay unchanged, and the pipeline references the newly downloaded SQL path. | +| 8 | Run `bundle destroy`. | Both remote resources and remote state are gone. | + +Steps 4–6 run first for the job, then for the pipeline. The fault stays enabled +through step 8 and is cleared in `finally`. For `CreateDeployment`, skip the healthy +setup deployment so the fault applies to the first deployment. + +Each snapshot records the command invocations and output, including warnings and +deployment-version links, then reports whether the injected endpoint was called. +An unused endpoint records `DMS API called: no`. + Fault cases cover all DMS APIs: - `CompleteVersion` @@ -16,4 +39,4 @@ Fault cases cover all DMS APIs: - `UpdateDeployment` - `UpdateOperation` -Missing APIs: none. Each snapshot records the bundle commands, their output, and whether the injected endpoint was called. +Missing APIs: none. diff --git a/acceptance/bundle/dms_fault/complete_version/output.txt b/acceptance/bundle/dms_fault/complete_version/output.txt index 23577dcceb7..db651a38651 100644 --- a/acceptance/bundle/dms_fault/complete_version/output.txt +++ b/acceptance/bundle/dms_fault/complete_version/output.txt @@ -20,15 +20,6 @@ Resources: 0 created, 2 changed, 0 deleted, 0 unchanged Warn: Failed to complete deployment history version: Fault injected by test. ->>> bundle validate - Name: updated-dms-fault-complete_version-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-complete_version-commands-[UNIQUE_NAME] Target: default @@ -113,31 +104,3 @@ Destroy: 2 deleted DMS API called: yes - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: complete_version fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-destroy-[UNIQUE_NAME] - - Warn: Failed to complete deployment history version: Fault injected by test. - Destroy: 2 deleted - -DMS API called: yes diff --git a/acceptance/bundle/dms_fault/create_deployment/output.txt b/acceptance/bundle/dms_fault/create_deployment/output.txt index 493ed5990f4..2fae9d41f7f 100644 --- a/acceptance/bundle/dms_fault/create_deployment/output.txt +++ b/acceptance/bundle/dms_fault/create_deployment/output.txt @@ -11,15 +11,6 @@ Files: 4 uploaded, 0 deleted Resources: 2 created, 0 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-create_deployment-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-create_deployment-commands-[UNIQUE_NAME] Target: default @@ -103,31 +94,3 @@ Destroy: 2 deleted DMS API called: yes - -=== destroy: setup - -=== destroy: create_deployment fault enabled - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-destroy-[UNIQUE_NAME]/files... - Warn: Could not enable deployment history for this deploy: failed to create deployment: Fault injected by test. - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-destroy-[UNIQUE_NAME] - - Warn: Could not record deployment history for this destroy: failed to create deployment: Fault injected by test. - Destroy: 2 deleted - -DMS API called: yes diff --git a/acceptance/bundle/dms_fault/create_version/output.txt b/acceptance/bundle/dms_fault/create_version/output.txt index bb1082bcfb7..0e173b2417a 100644 --- a/acceptance/bundle/dms_fault/create_version/output.txt +++ b/acceptance/bundle/dms_fault/create_version/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-create_version-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-create_version-commands-[UNIQUE_NAME] Target: default @@ -111,31 +102,3 @@ Destroy: 2 deleted DMS API called: yes - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: create_version fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-destroy-[UNIQUE_NAME] - - Warn: Could not record deployment history for this destroy: failed to create deployment version: Fault injected by test. - Destroy: 2 deleted - -DMS API called: yes diff --git a/acceptance/bundle/dms_fault/delete_deployment/output.txt b/acceptance/bundle/dms_fault/delete_deployment/output.txt index 6e59f572abb..c299d240931 100644 --- a/acceptance/bundle/dms_fault/delete_deployment/output.txt +++ b/acceptance/bundle/dms_fault/delete_deployment/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-delete_deployment-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-delete_deployment-commands-[UNIQUE_NAME] Target: default @@ -113,33 +104,3 @@ Destroy: 2 deleted DMS API called: yes - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: delete_deployment fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-destroy-[UNIQUE_NAME] - - Warn: retrying after 500 Internal Server Error from DELETE /api/2.0/bundle/deployments/[DEPLOYMENT_ID] - Warn: retrying after 500 Internal Server Error from DELETE /api/2.0/bundle/deployments/[DEPLOYMENT_ID] - Warn: Could not delete deployment history: Fault injected by test. - Destroy: 2 deleted - -DMS API called: yes diff --git a/acceptance/bundle/dms_fault/get_deployment/output.txt b/acceptance/bundle/dms_fault/get_deployment/output.txt index 6c1e6751ddf..d3588b19cb4 100644 --- a/acceptance/bundle/dms_fault/get_deployment/output.txt +++ b/acceptance/bundle/dms_fault/get_deployment/output.txt @@ -22,15 +22,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] Target: default @@ -113,33 +104,3 @@ Destroy: 2 deleted DMS API called: yes - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: get_deployment fault enabled - ->>> bundle destroy --auto-approve - Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] - Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] - Warn: Could not read deployment history: Fault injected by test. - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: yes diff --git a/acceptance/bundle/dms_fault/get_operation/output.txt b/acceptance/bundle/dms_fault/get_operation/output.txt index bee143ede24..374178b0511 100644 --- a/acceptance/bundle/dms_fault/get_operation/output.txt +++ b/acceptance/bundle/dms_fault/get_operation/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-get_operation-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-get_operation-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: get_operation fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/get_resource/output.txt b/acceptance/bundle/dms_fault/get_resource/output.txt index 6d78b88bed3..9b27f7cfb89 100644 --- a/acceptance/bundle/dms_fault/get_resource/output.txt +++ b/acceptance/bundle/dms_fault/get_resource/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-get_resource-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-get_resource-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: get_resource fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/get_version/output.txt b/acceptance/bundle/dms_fault/get_version/output.txt index 976e3b760ee..f13e11e745d 100644 --- a/acceptance/bundle/dms_fault/get_version/output.txt +++ b/acceptance/bundle/dms_fault/get_version/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-get_version-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-get_version-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: get_version fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/heartbeat/output.txt b/acceptance/bundle/dms_fault/heartbeat/output.txt index 7666c0efefd..d6adb02914c 100644 --- a/acceptance/bundle/dms_fault/heartbeat/output.txt +++ b/acceptance/bundle/dms_fault/heartbeat/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-heartbeat-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-heartbeat-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: heartbeat fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_deployments/output.txt b/acceptance/bundle/dms_fault/list_deployments/output.txt index 9bae5e3e696..e1b797d6536 100644 --- a/acceptance/bundle/dms_fault/list_deployments/output.txt +++ b/acceptance/bundle/dms_fault/list_deployments/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-list_deployments-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-list_deployments-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: list_deployments fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_operations/output.txt b/acceptance/bundle/dms_fault/list_operations/output.txt index c3ec32d7083..054d692d490 100644 --- a/acceptance/bundle/dms_fault/list_operations/output.txt +++ b/acceptance/bundle/dms_fault/list_operations/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-list_operations-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-list_operations-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: list_operations fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_resources/output.txt b/acceptance/bundle/dms_fault/list_resources/output.txt index 8d4d4aafcfa..88da41ef5f9 100644 --- a/acceptance/bundle/dms_fault/list_resources/output.txt +++ b/acceptance/bundle/dms_fault/list_resources/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-list_resources-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-list_resources-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: list_resources fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/list_versions/output.txt b/acceptance/bundle/dms_fault/list_versions/output.txt index 4bfff0f00ef..975fe6c9e93 100644 --- a/acceptance/bundle/dms_fault/list_versions/output.txt +++ b/acceptance/bundle/dms_fault/list_versions/output.txt @@ -19,15 +19,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-list_versions-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-list_versions-commands-[UNIQUE_NAME] Target: default @@ -110,30 +101,3 @@ Destroy: 2 deleted DMS API called: no - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: list_versions fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index 668658b1deb..a4768914463 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -192,7 +192,7 @@ def assert_destroyed(cwd, root, current): previous = hits(pattern) run(cwd, "bundle", "deploy", "--auto-approve") current = ids(cwd) - run(cwd, "bundle", "validate") + assert_alive(cwd, current) summary = run(cwd, "bundle", "summary").stdout assert current["resources.jobs.foo"] in summary assert current["resources.pipelines.bar"] in summary @@ -205,7 +205,6 @@ def assert_destroyed(cwd, root, current): assert (cwd / "exported-src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() run(cwd, "bundle", "deployment", "unbind", key) assert resource not in state(cwd)["state"] - assert_alive(cwd, current) generate(cwd, kind, key, current[resource], bind=True) assert ids(cwd)[resource] == current[resource] if kind == "pipeline": @@ -220,17 +219,3 @@ def assert_destroyed(cwd, root, current): print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) finally: clear_faults() - - -cwd, root = setup("destroy") -pattern = activate(cwd, root) -try: - if API == "create_deployment": - run(cwd, "bundle", "deploy", "--auto-approve") - current = ids(cwd) - previous = hits(pattern) - run(cwd, "bundle", "destroy", "--auto-approve") - assert_destroyed(cwd, root, current) - print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) -finally: - clear_faults() diff --git a/acceptance/bundle/dms_fault/update_deployment/output.txt b/acceptance/bundle/dms_fault/update_deployment/output.txt index e2add863e74..0d1f7148132 100644 --- a/acceptance/bundle/dms_fault/update_deployment/output.txt +++ b/acceptance/bundle/dms_fault/update_deployment/output.txt @@ -21,15 +21,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-update_deployment-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-update_deployment-commands-[UNIQUE_NAME] Target: default @@ -114,30 +105,3 @@ Destroy: 2 deleted DMS API called: yes - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: update_deployment fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-destroy-[UNIQUE_NAME] - - Destroy: 2 deleted - -DMS API called: no diff --git a/acceptance/bundle/dms_fault/update_operation/output.txt b/acceptance/bundle/dms_fault/update_operation/output.txt index 52b0e5d4bc8..d54febfdd7d 100644 --- a/acceptance/bundle/dms_fault/update_operation/output.txt +++ b/acceptance/bundle/dms_fault/update_operation/output.txt @@ -20,15 +20,6 @@ Files: 3 uploaded, 0 deleted Resources: 0 created, 2 changed, 0 deleted, 0 unchanged ->>> bundle validate - Name: updated-dms-fault-update_operation-commands-[UNIQUE_NAME] - Target: default - Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME] - - Validation OK! - >>> bundle summary Name: updated-dms-fault-update_operation-commands-[UNIQUE_NAME] Target: default @@ -113,31 +104,3 @@ Destroy: 2 deleted DMS API called: yes - -=== destroy: setup - ->>> bundle deploy --auto-approve - Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-destroy-[UNIQUE_NAME]/files... - Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=1 - Created jobs.foo - Created pipelines.bar - Files: 4 uploaded, 0 deleted - Resources: 2 created, 0 changed, 0 deleted, 0 unchanged - -=== destroy: update_operation fault enabled - ->>> bundle destroy --auto-approve - The following resources will be deleted: - delete resources.jobs.foo - delete resources.pipelines.bar - - This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the - Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: - delete resources.pipelines.bar - - All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-destroy-[UNIQUE_NAME] - - Warn: Failed to record deployment history: recording operation for [RESOURCE_KEY]: Fault injected by test. - Destroy: 2 deleted - -DMS API called: yes From c458b750def2e8cb5bf16c651e21f7db692a71e7 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 15:53:09 +0000 Subject: [PATCH 04/10] Support middle wildcards in fault injection patterns --- acceptance/bundle/dms_fault/README.md | 5 +++ acceptance/bundle/dms_fault/run.py | 49 ++++++--------------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/acceptance/bundle/dms_fault/README.md b/acceptance/bundle/dms_fault/README.md index 9c69b629b11..c75af64abdb 100644 --- a/acceptance/bundle/dms_fault/README.md +++ b/acceptance/bundle/dms_fault/README.md @@ -17,6 +17,11 @@ Steps 4–6 run first for the job, then for the pipeline. The fault stays enable through step 8 and is cleared in `finally`. For `CreateDeployment`, skip the healthy setup deployment so the fault applies to the first deployment. +Each case registers one fault rule. A version wildcard such as +`POST .../versions/*/complete` covers every version the workflow accesses or creates. +Each `*` stays within one path segment, so a version read fault cannot also match +nested operation endpoints. + Each snapshot records the command invocations and output, including warnings and deployment-version links, then reports whether the injected endpoint was called. An unused endpoint records `DMS API called: no`. diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index a4768914463..a1b18a87459 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -21,31 +21,27 @@ REQUESTS = Path(os.environ["OUT_REQUESTS"]) LOG = Path("LOG.commands").resolve() PATTERNS = { - "complete_version": "POST /api/2.0/bundle/deployments/{id}/versions/{version}/complete", + "complete_version": "POST /api/2.0/bundle/deployments/{id}/versions/*/complete", "create_deployment": "POST /api/2.0/bundle/deployments", "create_version": "POST /api/2.0/bundle/deployments/{id}/versions", "delete_deployment": "DELETE /api/2.0/bundle/deployments/{id}", "get_deployment": "GET /api/2.0/bundle/deployments/{id}", - "get_operation": "GET /api/2.0/bundle/deployments/{id}/versions/{version}/operations/*", + "get_operation": "GET /api/2.0/bundle/deployments/{id}/versions/*/operations/*", "get_resource": "GET /api/2.0/bundle/deployments/{id}/resources/*", - "get_version": "GET /api/2.0/bundle/deployments/{id}/versions/{version}", - "heartbeat": "POST /api/2.0/bundle/deployments/{id}/versions/{version}/heartbeat", + "get_version": "GET /api/2.0/bundle/deployments/{id}/versions/*", + "heartbeat": "POST /api/2.0/bundle/deployments/{id}/versions/*/heartbeat", "list_deployments": "GET /api/2.0/bundle/deployments", - "list_operations": "GET /api/2.0/bundle/deployments/{id}/versions/{version}/operations", + "list_operations": "GET /api/2.0/bundle/deployments/{id}/versions/*/operations", "list_resources": "GET /api/2.0/bundle/deployments/{id}/resources", "list_versions": "GET /api/2.0/bundle/deployments/{id}/versions", "update_deployment": "PATCH /api/2.0/bundle/deployments/{id}", - "update_operation": "PATCH /api/2.0/bundle/deployments/{id}/versions/*", + "update_operation": "PATCH /api/2.0/bundle/deployments/{id}/versions/*/operations/*", } -ACTIVE = None -REGISTERED = set() KNOWN_IDS = set() def run(cwd, *args, expected=0): visible = args[0] == "bundle" - if visible: - refresh_faults(cwd) result = subprocess.run( [CLI, *args], cwd=cwd, @@ -70,33 +66,10 @@ def fault(pattern, enabled): ) -def refresh_faults(cwd): - if ACTIVE is None: - return - if "{version}" in ACTIVE: - # Cover existing versions and the next version a command can create. - serial = state(cwd).get("serial", 0) - patterns = [ACTIVE.format(version=version) for version in range(1, serial + 2)] - else: - patterns = [ACTIVE] - for pattern in patterns: - if pattern not in REGISTERED: - fault(pattern, True) - REGISTERED.add(pattern) - - -def clear_faults(): - global ACTIVE - ACTIVE = None - for pattern in REGISTERED: - fault(pattern, False) - REGISTERED.clear() - - def hits(pattern): if not REQUESTS.exists(): return 0 - regex = re.escape(pattern).replace(r"\{version\}", r"[^/]+").replace(r"\*", ".*") + "$" + regex = re.escape(pattern).replace(r"\*\*", ".*").replace(r"\*", "[^/]*") return sum(bool(re.fullmatch(regex, f"{r['method']} {r['path']}")) for r in read_json_many(REQUESTS.read_text())) @@ -133,7 +106,6 @@ def setup(phase): def activate(cwd, root): - global ACTIVE print(f"\n=== {cwd.name}: setup", flush=True) deployment = None if API != "create_deployment": @@ -142,9 +114,8 @@ def activate(cwd, root): run(cwd, "workspace", "get-status", root + "/state/resources.deployment.json", "-o", "json").stdout ) deployment = str(node["object_id"]) - pattern = PATTERNS[API].format(id=deployment, version="{version}") - ACTIVE = pattern - refresh_faults(cwd) + pattern = PATTERNS[API].format(id=deployment) + fault(pattern, True) print(f"\n=== {cwd.name}: {API} fault enabled", flush=True) return pattern @@ -218,4 +189,4 @@ def assert_destroyed(cwd, root, current): assert_destroyed(cwd, root, current) print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) finally: - clear_faults() + fault(pattern, False) From a9e52ebccf9e37a9970a5fa241a6b23a2681e77c Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 17:01:23 +0000 Subject: [PATCH 05/10] Document DMS fault test helpers with short comments --- acceptance/bundle/dms_fault/run.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index a1b18a87459..702dd0811ed 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -40,6 +40,8 @@ KNOWN_IDS = set() +# Run the CLI and check its exit code. +# Log all commands; show bundle commands in the snapshot. def run(cwd, *args, expected=0): visible = args[0] == "bundle" result = subprocess.run( @@ -60,12 +62,15 @@ def run(cwd, *args, expected=0): return result +# Enable or clear an HTTP 500 fault for this endpoint. def fault(pattern, enabled): subprocess.run( [sys.executable, shutil.which("fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True ) +# Count recorded method/path matches to report whether this API was called. +# Here * stays within one path segment; ** can span /. def hits(pattern): if not REQUESTS.exists(): return 0 @@ -73,10 +78,12 @@ def hits(pattern): return sum(bool(re.fullmatch(regex, f"{r['method']} {r['path']}")) for r in read_json_many(REQUESTS.read_text())) +# Read the bundle's local deployment state. def state(cwd): return json.loads((cwd / ".databricks/bundle/default/resources.json").read_text()) +# Check that files remain the source of truth, then collect and label resource IDs. def ids(cwd): data = state(cwd) assert "deployment_history_shadow" in data["features"], data @@ -89,6 +96,7 @@ def ids(cwd): return current +# Create a unique bundle from the job, pipeline, and SQL fixtures. def setup(phase): cwd = Path("work", phase).resolve() (cwd / "resources").mkdir(parents=True) @@ -105,6 +113,8 @@ def setup(phase): return cwd, root +# Prepare an existing deployment and enable its API fault. +# Skip the initial deploy for CreateDeployment so its first call fails. def activate(cwd, root): print(f"\n=== {cwd.name}: setup", flush=True) deployment = None @@ -120,6 +130,7 @@ def activate(cwd, root): return pattern +# Verify both remote resources exist with their updated names. def assert_alive(cwd, current): job = json.loads(run(cwd, "jobs", "get", current["resources.jobs.foo"], "-o", "json").stdout) pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) @@ -129,6 +140,7 @@ def assert_alive(cwd, current): assert pipeline["spec"]["name"].startswith("updated-dms-fault-") +# Export a resource, optionally adding it to the bundle and binding its original ID. def generate(cwd, kind, key, identifier, bind=False): args = ["bundle", "generate", kind, f"--existing-{kind}-id", identifier, "--key", key] args += [ @@ -143,6 +155,7 @@ def generate(cwd, kind, key, identifier, bind=False): run(cwd, *args) +# Verify the job, pipeline, and remote state were deleted. def assert_destroyed(cwd, root, current): job = run(cwd, "jobs", "get", current["resources.jobs.foo"], expected=1) assert "does not exist" in job.stderr.lower(), job.stderr From d62813eff3bdca56a3ac314a71a2f98c17b7d60c Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 17:23:35 +0000 Subject: [PATCH 06/10] Test deployment history toggles under DMS API faults --- acceptance/bundle/dms_fault/README.md | 9 +++- .../dms_fault/complete_version/output.txt | 42 +++++++++++++++ .../dms_fault/create_deployment/output.txt | 39 ++++++++++++++ .../dms_fault/create_version/output.txt | 41 +++++++++++++++ .../dms_fault/delete_deployment/output.txt | 41 +++++++++++++++ .../dms_fault/get_deployment/output.txt | 41 +++++++++++++++ .../bundle/dms_fault/get_operation/output.txt | 41 +++++++++++++++ .../bundle/dms_fault/get_resource/output.txt | 41 +++++++++++++++ .../bundle/dms_fault/get_version/output.txt | 41 +++++++++++++++ .../bundle/dms_fault/heartbeat/output.txt | 41 +++++++++++++++ acceptance/bundle/dms_fault/job.yml.tmpl | 1 + .../dms_fault/list_deployments/output.txt | 41 +++++++++++++++ .../dms_fault/list_operations/output.txt | 41 +++++++++++++++ .../dms_fault/list_resources/output.txt | 41 +++++++++++++++ .../bundle/dms_fault/list_versions/output.txt | 41 +++++++++++++++ acceptance/bundle/dms_fault/run.py | 51 ++++++++++++++++--- acceptance/bundle/dms_fault/test.toml | 1 - .../dms_fault/update_deployment/output.txt | 43 ++++++++++++++++ .../dms_fault/update_operation/output.txt | 42 +++++++++++++++ 19 files changed, 670 insertions(+), 9 deletions(-) diff --git a/acceptance/bundle/dms_fault/README.md b/acceptance/bundle/dms_fault/README.md index c75af64abdb..53477eb506a 100644 --- a/acceptance/bundle/dms_fault/README.md +++ b/acceptance/bundle/dms_fault/README.md @@ -11,12 +11,17 @@ must succeed with the selected API configured to return HTTP 500. | 5 | Run `bundle deployment unbind`. | The resource ID is removed from bundle state. | | 6 | Run `bundle generate --bind` into the bundle's resource directory. | Generation and binding succeed for the original resource ID, proving unbind preserved the remote resource. Pipeline SQL is downloaded with its original content. | | 7 | Run `bundle validate`, then deploy again. | Generated configuration is valid, both resource IDs stay unchanged, and the pipeline references the newly downloaded SQL path. | -| 8 | Run `bundle destroy`. | Both remote resources and remote state are gone. | +| 8 | Disable history and deploy, then enable it and deploy. | Both IDs stay unchanged. The file-backed history marker follows the setting, and disabling history makes no DMS calls. Each toggle changes the job description to exercise an actual resource update. | +| 9 | Run `bundle destroy` with history enabled. | Both remote resources and remote state are gone. | +| 10 | Disable history, deploy fresh resources, then destroy. | The resources exist after deploy and are gone after destroy. Neither command calls DMS. | Steps 4–6 run first for the job, then for the pipeline. The fault stays enabled -through step 8 and is cleared in `finally`. For `CreateDeployment`, skip the healthy +through step 10 and is cleared in `finally`. For `CreateDeployment`, skip the healthy setup deployment so the fault applies to the first deployment. +History is toggled with `experimental.deployment_history: true/false` in YAML. +That explicit setting takes priority over the suite's environment override. + Each case registers one fault rule. A version wildcard such as `POST .../versions/*/complete` covers every version the workflow accesses or creates. Each `*` stays within one path segment, so a version read fault cannot also match diff --git a/acceptance/bundle/dms_fault/complete_version/output.txt b/acceptance/bundle/dms_fault/complete_version/output.txt index db651a38651..c7d574f4431 100644 --- a/acceptance/bundle/dms_fault/complete_version/output.txt +++ b/acceptance/bundle/dms_fault/complete_version/output.txt @@ -89,6 +89,26 @@ Resources: 0 created, 1 changed, 0 deleted, 1 unchanged Warn: Failed to complete deployment history version: Fault injected by test. +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + Warn: Failed to complete deployment history version: Fault injected by test. + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo @@ -103,4 +123,26 @@ Warn: Failed to complete deployment history version: Fault injected by test. Destroy: 2 deleted +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-complete_version-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + DMS API called: yes diff --git a/acceptance/bundle/dms_fault/create_deployment/output.txt b/acceptance/bundle/dms_fault/create_deployment/output.txt index 2fae9d41f7f..2b1b3f5a082 100644 --- a/acceptance/bundle/dms_fault/create_deployment/output.txt +++ b/acceptance/bundle/dms_fault/create_deployment/output.txt @@ -79,6 +79,23 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Files: 2 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME]/files... + Warn: Could not enable deployment history for this deploy: failed to create deployment: Fault injected by test. + Updated jobs.foo + Files: 2 uploaded, 0 deleted + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo @@ -93,4 +110,26 @@ Warn: Could not record deployment history for this destroy: failed to create deployment: Fault injected by test. Destroy: 2 deleted +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_deployment-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + DMS API called: yes diff --git a/acceptance/bundle/dms_fault/create_version/output.txt b/acceptance/bundle/dms_fault/create_version/output.txt index 0e173b2417a..f58fd56b675 100644 --- a/acceptance/bundle/dms_fault/create_version/output.txt +++ b/acceptance/bundle/dms_fault/create_version/output.txt @@ -87,6 +87,25 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME]/files... + Warn: Could not enable deployment history for this deploy: failed to create deployment version: Fault injected by test. + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo @@ -101,4 +120,26 @@ Warn: Could not record deployment history for this destroy: failed to create deployment version: Fault injected by test. Destroy: 2 deleted +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-create_version-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + DMS API called: yes diff --git a/acceptance/bundle/dms_fault/delete_deployment/output.txt b/acceptance/bundle/dms_fault/delete_deployment/output.txt index c299d240931..8efdbc07a0d 100644 --- a/acceptance/bundle/dms_fault/delete_deployment/output.txt +++ b/acceptance/bundle/dms_fault/delete_deployment/output.txt @@ -87,6 +87,25 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo @@ -103,4 +122,26 @@ Warn: Could not delete deployment history: Fault injected by test. Destroy: 2 deleted +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-delete_deployment-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + DMS API called: yes diff --git a/acceptance/bundle/dms_fault/get_deployment/output.txt b/acceptance/bundle/dms_fault/get_deployment/output.txt index d3588b19cb4..911d8c8664e 100644 --- a/acceptance/bundle/dms_fault/get_deployment/output.txt +++ b/acceptance/bundle/dms_fault/get_deployment/output.txt @@ -90,6 +90,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/get_operation/output.txt b/acceptance/bundle/dms_fault/get_operation/output.txt index 374178b0511..65498809a65 100644 --- a/acceptance/bundle/dms_fault/get_operation/output.txt +++ b/acceptance/bundle/dms_fault/get_operation/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_operation-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/get_resource/output.txt b/acceptance/bundle/dms_fault/get_resource/output.txt index 9b27f7cfb89..a562c0f5264 100644 --- a/acceptance/bundle/dms_fault/get_resource/output.txt +++ b/acceptance/bundle/dms_fault/get_resource/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_resource-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/get_version/output.txt b/acceptance/bundle/dms_fault/get_version/output.txt index f13e11e745d..b4473435fe9 100644 --- a/acceptance/bundle/dms_fault/get_version/output.txt +++ b/acceptance/bundle/dms_fault/get_version/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_version-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/heartbeat/output.txt b/acceptance/bundle/dms_fault/heartbeat/output.txt index d6adb02914c..b512e794a75 100644 --- a/acceptance/bundle/dms_fault/heartbeat/output.txt +++ b/acceptance/bundle/dms_fault/heartbeat/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-heartbeat-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/job.yml.tmpl b/acceptance/bundle/dms_fault/job.yml.tmpl index 52fbad736a9..930af269d00 100644 --- a/acceptance/bundle/dms_fault/job.yml.tmpl +++ b/acceptance/bundle/dms_fault/job.yml.tmpl @@ -2,3 +2,4 @@ resources: jobs: foo: name: $RESOURCE_NAME + description: history-true diff --git a/acceptance/bundle/dms_fault/list_deployments/output.txt b/acceptance/bundle/dms_fault/list_deployments/output.txt index e1b797d6536..0710bf48939 100644 --- a/acceptance/bundle/dms_fault/list_deployments/output.txt +++ b/acceptance/bundle/dms_fault/list_deployments/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_deployments-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/list_operations/output.txt b/acceptance/bundle/dms_fault/list_operations/output.txt index 054d692d490..5764b81d690 100644 --- a/acceptance/bundle/dms_fault/list_operations/output.txt +++ b/acceptance/bundle/dms_fault/list_operations/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_operations-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/list_resources/output.txt b/acceptance/bundle/dms_fault/list_resources/output.txt index 88da41ef5f9..9f45951b03a 100644 --- a/acceptance/bundle/dms_fault/list_resources/output.txt +++ b/acceptance/bundle/dms_fault/list_resources/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_resources-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/list_versions/output.txt b/acceptance/bundle/dms_fault/list_versions/output.txt index 975fe6c9e93..dabee52cbcd 100644 --- a/acceptance/bundle/dms_fault/list_versions/output.txt +++ b/acceptance/bundle/dms_fault/list_versions/output.txt @@ -87,6 +87,47 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-list_versions-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index 702dd0811ed..080df53ce3f 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -83,11 +83,12 @@ def state(cwd): return json.loads((cwd / ".databricks/bundle/default/resources.json").read_text()) -# Check that files remain the source of truth, then collect and label resource IDs. -def ids(cwd): +# Check the history marker and file-backed state, then collect and label resource IDs. +def ids(cwd, history=True): data = state(cwd) - assert "deployment_history_shadow" in data["features"], data - assert "deployment_history" not in data["features"], data + features = data.get("features", {}) + assert ("deployment_history_shadow" in features) == history, data + assert "deployment_history" not in features, data current = {key: value["__id__"] for key, value in data["state"].items()} for key, value in current.items(): if value not in KNOWN_IDS: @@ -130,13 +131,14 @@ def activate(cwd, root): return pattern -# Verify both remote resources exist with their updated names. -def assert_alive(cwd, current): +# Verify resource names and IDs, plus the job's updated description. +def assert_alive(cwd, current, history=True): job = json.loads(run(cwd, "jobs", "get", current["resources.jobs.foo"], "-o", "json").stdout) pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) assert str(job["job_id"]) == current["resources.jobs.foo"] assert pipeline["pipeline_id"] == current["resources.pipelines.bar"] assert job["settings"]["name"].startswith("updated-dms-fault-") + assert job["settings"]["description"] == f"history-{str(history).lower()}" assert pipeline["spec"]["name"].startswith("updated-dms-fault-") @@ -155,6 +157,21 @@ def generate(cwd, kind, key, identifier, bind=False): run(cwd, *args) +# Toggle YAML history and change the job description to force a real update. +def set_history(cwd, enabled): + value = str(enabled).lower() + previous = str(not enabled).lower() + print(f"\n=== deployment_history: {value}", flush=True) + for filename, prefix in [ + ("databricks.yml", "deployment_history: "), + ("resources/foo.job.yml", "description: history-"), + ]: + subprocess.run( + [sys.executable, shutil.which("update_file.py"), str(cwd / filename), prefix + previous, prefix + value], + check=True, + ) + + # Verify the job, pipeline, and remote state were deleted. def assert_destroyed(cwd, root, current): job = run(cwd, "jobs", "get", current["resources.jobs.foo"], expected=1) @@ -198,8 +215,30 @@ def assert_destroyed(cwd, root, current): assert ids(cwd) == current pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) assert pipeline["spec"]["libraries"][0]["file"]["path"] == root + "/files/src/pipeline.sql" + + # Toggle existing resources without replacing them. Disabled history must make no DMS calls. + all_dms = "* /api/2.0/bundle/**" + for enabled in [False, True]: + set_history(cwd, enabled) + before = hits(all_dms) + run(cwd, "bundle", "deploy", "--auto-approve") + assert ids(cwd, history=enabled) == current + assert_alive(cwd, current, history=enabled) + if not enabled: + assert hits(all_dms) == before, "History-disabled deploy called DMS" + + run(cwd, "bundle", "destroy", "--auto-approve") + assert_destroyed(cwd, root, current) + + # A fresh deployment and its destroy must also work with history disabled. + set_history(cwd, False) + before = hits(all_dms) + run(cwd, "bundle", "deploy", "--auto-approve") + current = ids(cwd, history=False) + assert_alive(cwd, current, history=False) run(cwd, "bundle", "destroy", "--auto-approve") assert_destroyed(cwd, root, current) + assert hits(all_dms) == before, "History-disabled deploy/destroy called DMS" print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) finally: fault(pattern, False) diff --git a/acceptance/bundle/dms_fault/test.toml b/acceptance/bundle/dms_fault/test.toml index b4bb3e15d02..0a01bdac577 100644 --- a/acceptance/bundle/dms_fault/test.toml +++ b/acceptance/bundle/dms_fault/test.toml @@ -2,7 +2,6 @@ Cloud = false RecordRequests = true Timeout = '120s' EnvMatrix.DMS = ['true'] -Env.DATABRICKS_BUNDLE_DEV_DEPLOYMENT_HISTORY_ONLY = 'false' Env.DATABRICKS_BUNDLE_RETRY_INTERVAL_MS = '0' Ignore = ['work'] SortLines.deploy_actions = '^ (Created|Updated|Deleted|Recreated|Resized) \S+$' diff --git a/acceptance/bundle/dms_fault/update_deployment/output.txt b/acceptance/bundle/dms_fault/update_deployment/output.txt index 0d1f7148132..09b82f8c549 100644 --- a/acceptance/bundle/dms_fault/update_deployment/output.txt +++ b/acceptance/bundle/dms_fault/update_deployment/output.txt @@ -91,6 +91,49 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME]/files... + Warn: retrying after 500 Internal Server Error from PATCH /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from PATCH /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not enable deployment history for this deploy: failed to update deployment: Fault injected by test. + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_deployment-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo diff --git a/acceptance/bundle/dms_fault/update_operation/output.txt b/acceptance/bundle/dms_fault/update_operation/output.txt index d54febfdd7d..308345c48c4 100644 --- a/acceptance/bundle/dms_fault/update_operation/output.txt +++ b/acceptance/bundle/dms_fault/update_operation/output.txt @@ -89,6 +89,26 @@ Files: 6 uploaded, 0 deleted Resources: 0 created, 1 changed, 0 deleted, 1 unchanged +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME]/files... + Updated jobs.foo + Updated pipelines.bar + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + +=== deployment_history: true + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME]/files... + Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 + Updated jobs.foo + Updated pipelines.bar + Warn: Failed to record deployment history: recording operation for [RESOURCE_KEY]: Fault injected by test. + Files: 2 uploaded, 0 deleted + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + >>> bundle destroy --auto-approve The following resources will be deleted: delete resources.jobs.foo @@ -103,4 +123,26 @@ Warn: Failed to record deployment history: recording operation for [RESOURCE_KEY]: Fault injected by test. Destroy: 2 deleted +=== deployment_history: false + +>>> bundle deploy --auto-approve + Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME]/files... + Created jobs.foo + Created pipelines.bar + Files: 8 uploaded, 0 deleted + Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +>>> bundle destroy --auto-approve + The following resources will be deleted: + delete resources.jobs.foo + delete resources.pipelines.bar + + This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the + Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion: + delete resources.pipelines.bar + + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-fault-update_operation-commands-[UNIQUE_NAME] + + Destroy: 2 deleted + DMS API called: yes From 21caced88251e38baea14c6211c655d7b7f9c8b9 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 22:29:19 +0000 Subject: [PATCH 07/10] Keep GetDeployment faults active across deployment IDs --- acceptance/bundle/dms_fault/README.md | 2 ++ .../bundle/dms_fault/get_deployment/output.txt | 18 +++++++++++++++--- acceptance/bundle/dms_fault/run.py | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/acceptance/bundle/dms_fault/README.md b/acceptance/bundle/dms_fault/README.md index 53477eb506a..76ddea99005 100644 --- a/acceptance/bundle/dms_fault/README.md +++ b/acceptance/bundle/dms_fault/README.md @@ -26,6 +26,8 @@ Each case registers one fault rule. A version wildcard such as `POST .../versions/*/complete` covers every version the workflow accesses or creates. Each `*` stays within one path segment, so a version read fault cannot also match nested operation endpoints. +`GetDeployment` also uses a deployment-ID wildcard so its fault stays active if a +failed lookup triggers a replacement deployment record. Each snapshot records the command invocations and output, including warnings and deployment-version links, then reports whether the injected endpoint was called. diff --git a/acceptance/bundle/dms_fault/get_deployment/output.txt b/acceptance/bundle/dms_fault/get_deployment/output.txt index 911d8c8664e..0dda68edc1e 100644 --- a/acceptance/bundle/dms_fault/get_deployment/output.txt +++ b/acceptance/bundle/dms_fault/get_deployment/output.txt @@ -23,6 +23,9 @@ Resources: 0 created, 2 changed, 0 deleted, 0 unchanged >>> bundle summary + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not read deployment history: Fault injected by test. Name: updated-dms-fault-get_deployment-commands-[UNIQUE_NAME] Target: default Workspace: @@ -84,11 +87,15 @@ Validation OK! >>> bundle deploy --auto-approve + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not read deployment history: Fault injected by test. Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=9 + Updated jobs.foo Updated pipelines.bar Files: 6 uploaded, 0 deleted - Resources: 0 created, 1 changed, 0 deleted, 1 unchanged + Resources: 0 created, 2 changed, 0 deleted, 0 unchanged === deployment_history: false @@ -102,14 +109,19 @@ === deployment_history: true >>> bundle deploy --auto-approve + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not read deployment history: Fault injected by test. Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-fault-get_deployment-commands-[UNIQUE_NAME]/files... Current Deployment Version: [DATABRICKS_URL]/deployments/[DEPLOYMENT_ID]?version=11 Updated jobs.foo - Updated pipelines.bar Files: 2 uploaded, 0 deleted - Resources: 0 created, 2 changed, 0 deleted, 0 unchanged + Resources: 0 created, 1 changed, 0 deleted, 1 unchanged >>> bundle destroy --auto-approve + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: retrying after 500 Internal Server Error from GET /api/2.0/bundle/deployments/[DEPLOYMENT_ID] + Warn: Could not read deployment history: Fault injected by test. The following resources will be deleted: delete resources.jobs.foo delete resources.pipelines.bar diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index 080df53ce3f..86fb984bc6d 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -25,7 +25,8 @@ "create_deployment": "POST /api/2.0/bundle/deployments", "create_version": "POST /api/2.0/bundle/deployments/{id}/versions", "delete_deployment": "DELETE /api/2.0/bundle/deployments/{id}", - "get_deployment": "GET /api/2.0/bundle/deployments/{id}", + # Keep failing lookups even if the CLI registers a replacement deployment. + "get_deployment": "GET /api/2.0/bundle/deployments/*", "get_operation": "GET /api/2.0/bundle/deployments/{id}/versions/*/operations/*", "get_resource": "GET /api/2.0/bundle/deployments/{id}/resources/*", "get_version": "GET /api/2.0/bundle/deployments/{id}/versions/*", From a571955149743adfc4cc7f5e9064c740cf0d8051 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 22:34:21 +0000 Subject: [PATCH 08/10] Clarify the DMS fault bundle setup comment --- acceptance/bundle/dms_fault/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index 86fb984bc6d..42769d2e2b4 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -98,7 +98,7 @@ def ids(cwd, history=True): return current -# Create a unique bundle from the job, pipeline, and SQL fixtures. +# Write the test bundle files with unique resource names and a workspace path. def setup(phase): cwd = Path("work", phase).resolve() (cwd / "resources").mkdir(parents=True) From 6afc1d894e458fe04b83c6de0b5f1c1628454777 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 28 Oct 2026 22:48:31 +0000 Subject: [PATCH 09/10] Make DMS fault runner safe to import for doctests --- acceptance/bundle/dms_fault/run.py | 453 +++++++++++++++-------------- 1 file changed, 228 insertions(+), 225 deletions(-) diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index 42769d2e2b4..b8710841839 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -11,235 +11,238 @@ from pathlib import Path from string import Template -sys.path.insert(0, str(Path(shutil.which("print_requests.py")).parent)) -from add_repl import add_repl -from print_requests import read_json_many - -API = sys.argv[1] -FIXTURES = Path(__file__).parent -CLI = os.environ["CLI"] -REQUESTS = Path(os.environ["OUT_REQUESTS"]) -LOG = Path("LOG.commands").resolve() -PATTERNS = { - "complete_version": "POST /api/2.0/bundle/deployments/{id}/versions/*/complete", - "create_deployment": "POST /api/2.0/bundle/deployments", - "create_version": "POST /api/2.0/bundle/deployments/{id}/versions", - "delete_deployment": "DELETE /api/2.0/bundle/deployments/{id}", - # Keep failing lookups even if the CLI registers a replacement deployment. - "get_deployment": "GET /api/2.0/bundle/deployments/*", - "get_operation": "GET /api/2.0/bundle/deployments/{id}/versions/*/operations/*", - "get_resource": "GET /api/2.0/bundle/deployments/{id}/resources/*", - "get_version": "GET /api/2.0/bundle/deployments/{id}/versions/*", - "heartbeat": "POST /api/2.0/bundle/deployments/{id}/versions/*/heartbeat", - "list_deployments": "GET /api/2.0/bundle/deployments", - "list_operations": "GET /api/2.0/bundle/deployments/{id}/versions/*/operations", - "list_resources": "GET /api/2.0/bundle/deployments/{id}/resources", - "list_versions": "GET /api/2.0/bundle/deployments/{id}/versions", - "update_deployment": "PATCH /api/2.0/bundle/deployments/{id}", - "update_operation": "PATCH /api/2.0/bundle/deployments/{id}/versions/*/operations/*", -} -KNOWN_IDS = set() - - -# Run the CLI and check its exit code. -# Log all commands; show bundle commands in the snapshot. -def run(cwd, *args, expected=0): - visible = args[0] == "bundle" - result = subprocess.run( - [CLI, *args], - cwd=cwd, - text=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT if visible else subprocess.PIPE, - ) - output = result.stdout + (result.stderr or "") - with LOG.open("a") as out: - out.write(f"\n{cwd.name}: {args}\nexit={result.returncode}\n{output}") - if visible: - print("\n>>> " + shlex.join(args), flush=True) - for line in output.splitlines(): - print(" " + line if line else "", flush=True) - assert result.returncode == expected, output - return result - - -# Enable or clear an HTTP 500 fault for this endpoint. -def fault(pattern, enabled): - subprocess.run( - [sys.executable, shutil.which("fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True - ) - - -# Count recorded method/path matches to report whether this API was called. -# Here * stays within one path segment; ** can span /. -def hits(pattern): - if not REQUESTS.exists(): - return 0 - regex = re.escape(pattern).replace(r"\*\*", ".*").replace(r"\*", "[^/]*") - return sum(bool(re.fullmatch(regex, f"{r['method']} {r['path']}")) for r in read_json_many(REQUESTS.read_text())) - - -# Read the bundle's local deployment state. -def state(cwd): - return json.loads((cwd / ".databricks/bundle/default/resources.json").read_text()) - - -# Check the history marker and file-backed state, then collect and label resource IDs. -def ids(cwd, history=True): - data = state(cwd) - features = data.get("features", {}) - assert ("deployment_history_shadow" in features) == history, data - assert "deployment_history" not in features, data - current = {key: value["__id__"] for key, value in data["state"].items()} - for key, value in current.items(): - if value not in KNOWN_IDS: - add_repl(value, key.rsplit(".", 1)[1].upper() + "_ID") - KNOWN_IDS.add(value) - return current - - -# Write the test bundle files with unique resource names and a workspace path. -def setup(phase): - cwd = Path("work", phase).resolve() - (cwd / "resources").mkdir(parents=True) - name = f"dms-fault-{API}-{phase}-{os.environ['UNIQUE_NAME']}" - root = f"/Workspace/Users/{os.environ['CURRENT_USER_NAME']}/.bundle/{name}" - values = {"RESOURCE_NAME": name, "ROOT_PATH": root, "DATASET_NAME": name.replace("-", "_")} - for source, target in [ - ("databricks.yml.tmpl", "databricks.yml"), - ("job.yml.tmpl", "resources/foo.job.yml"), - ("pipeline.yml.tmpl", "resources/bar.pipeline.yml"), - ("pipeline.sql.tmpl", "pipeline.sql"), - ]: - (cwd / target).write_text(Template((FIXTURES / source).read_text()).substitute(values)) - return cwd, root - - -# Prepare an existing deployment and enable its API fault. -# Skip the initial deploy for CreateDeployment so its first call fails. -def activate(cwd, root): - print(f"\n=== {cwd.name}: setup", flush=True) - deployment = None - if API != "create_deployment": - run(cwd, "bundle", "deploy", "--auto-approve") - node = json.loads( - run(cwd, "workspace", "get-status", root + "/state/resources.deployment.json", "-o", "json").stdout + +# Keep acceptance-only setup out of imports used by doctest. +def main(): + sys.path.insert(0, str(Path(shutil.which("print_requests.py")).parent)) + from add_repl import add_repl + from print_requests import read_json_many + + API = sys.argv[1] + FIXTURES = Path(__file__).parent + CLI = os.environ["CLI"] + REQUESTS = Path(os.environ["OUT_REQUESTS"]) + LOG = Path("LOG.commands").resolve() + PATTERNS = { + "complete_version": "POST /api/2.0/bundle/deployments/{id}/versions/*/complete", + "create_deployment": "POST /api/2.0/bundle/deployments", + "create_version": "POST /api/2.0/bundle/deployments/{id}/versions", + "delete_deployment": "DELETE /api/2.0/bundle/deployments/{id}", + # Keep failing lookups even if the CLI registers a replacement deployment. + "get_deployment": "GET /api/2.0/bundle/deployments/*", + "get_operation": "GET /api/2.0/bundle/deployments/{id}/versions/*/operations/*", + "get_resource": "GET /api/2.0/bundle/deployments/{id}/resources/*", + "get_version": "GET /api/2.0/bundle/deployments/{id}/versions/*", + "heartbeat": "POST /api/2.0/bundle/deployments/{id}/versions/*/heartbeat", + "list_deployments": "GET /api/2.0/bundle/deployments", + "list_operations": "GET /api/2.0/bundle/deployments/{id}/versions/*/operations", + "list_resources": "GET /api/2.0/bundle/deployments/{id}/resources", + "list_versions": "GET /api/2.0/bundle/deployments/{id}/versions", + "update_deployment": "PATCH /api/2.0/bundle/deployments/{id}", + "update_operation": "PATCH /api/2.0/bundle/deployments/{id}/versions/*/operations/*", + } + KNOWN_IDS = set() + + # Run the CLI and check its exit code. + # Log all commands; show bundle commands in the snapshot. + def run(cwd, *args, expected=0): + visible = args[0] == "bundle" + result = subprocess.run( + [CLI, *args], + cwd=cwd, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT if visible else subprocess.PIPE, ) - deployment = str(node["object_id"]) - pattern = PATTERNS[API].format(id=deployment) - fault(pattern, True) - print(f"\n=== {cwd.name}: {API} fault enabled", flush=True) - return pattern - - -# Verify resource names and IDs, plus the job's updated description. -def assert_alive(cwd, current, history=True): - job = json.loads(run(cwd, "jobs", "get", current["resources.jobs.foo"], "-o", "json").stdout) - pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) - assert str(job["job_id"]) == current["resources.jobs.foo"] - assert pipeline["pipeline_id"] == current["resources.pipelines.bar"] - assert job["settings"]["name"].startswith("updated-dms-fault-") - assert job["settings"]["description"] == f"history-{str(history).lower()}" - assert pipeline["spec"]["name"].startswith("updated-dms-fault-") - - -# Export a resource, optionally adding it to the bundle and binding its original ID. -def generate(cwd, kind, key, identifier, bind=False): - args = ["bundle", "generate", kind, f"--existing-{kind}-id", identifier, "--key", key] - args += [ - "--config-dir", - "resources" if bind else "exported", - "--source-dir", - "src" if bind else "exported-src", - "--force", - ] - if bind: - args.append("--bind") - run(cwd, *args) - - -# Toggle YAML history and change the job description to force a real update. -def set_history(cwd, enabled): - value = str(enabled).lower() - previous = str(not enabled).lower() - print(f"\n=== deployment_history: {value}", flush=True) - for filename, prefix in [ - ("databricks.yml", "deployment_history: "), - ("resources/foo.job.yml", "description: history-"), - ]: + output = result.stdout + (result.stderr or "") + with LOG.open("a") as out: + out.write(f"\n{cwd.name}: {args}\nexit={result.returncode}\n{output}") + if visible: + print("\n>>> " + shlex.join(args), flush=True) + for line in output.splitlines(): + print(" " + line if line else "", flush=True) + assert result.returncode == expected, output + return result + + # Enable or clear an HTTP 500 fault for this endpoint. + def fault(pattern, enabled): subprocess.run( - [sys.executable, shutil.which("update_file.py"), str(cwd / filename), prefix + previous, prefix + value], - check=True, + [sys.executable, shutil.which("fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True ) + # Count recorded method/path matches to report whether this API was called. + # Here * stays within one path segment; ** can span /. + def hits(pattern): + if not REQUESTS.exists(): + return 0 + regex = re.escape(pattern).replace(r"\*\*", ".*").replace(r"\*", "[^/]*") + return sum( + bool(re.fullmatch(regex, f"{r['method']} {r['path']}")) for r in read_json_many(REQUESTS.read_text()) + ) -# Verify the job, pipeline, and remote state were deleted. -def assert_destroyed(cwd, root, current): - job = run(cwd, "jobs", "get", current["resources.jobs.foo"], expected=1) - assert "does not exist" in job.stderr.lower(), job.stderr - pipeline = run(cwd, "pipelines", "get", current["resources.pipelines.bar"], expected=1) - assert "not found" in pipeline.stderr.lower(), pipeline.stderr - file = run(cwd, "workspace", "get-status", root + "/state/resources.json", expected=1) - assert "doesn't exist" in file.stderr.lower() or "does not exist" in file.stderr.lower(), file.stderr - - -cwd, root = setup("commands") -pattern = activate(cwd, root) -try: - # Pinning the root lets a bundle-name change exercise UpdateDeployment in place. - config = cwd / "databricks.yml" - config.write_text(config.read_text().replace("name: dms-fault-", "name: updated-dms-fault-")) - for path in (cwd / "resources").glob("*.yml"): - path.write_text(path.read_text().replace("name: dms-fault-", "name: updated-dms-fault-")) - previous = hits(pattern) - run(cwd, "bundle", "deploy", "--auto-approve") - current = ids(cwd) - assert_alive(cwd, current) - summary = run(cwd, "bundle", "summary").stdout - assert current["resources.jobs.foo"] in summary - assert current["resources.pipelines.bar"] in summary - for kind, key in [("job", "foo"), ("pipeline", "bar")]: - group = "jobs" if kind == "job" else "pipelines" - resource = f"resources.{group}.{key}" - generate(cwd, kind, key, current[resource]) - assert (cwd / "exported" / f"{key}.{kind}.yml").is_file() - if kind == "pipeline": - assert (cwd / "exported-src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() - run(cwd, "bundle", "deployment", "unbind", key) - assert resource not in state(cwd)["state"] - generate(cwd, kind, key, current[resource], bind=True) - assert ids(cwd)[resource] == current[resource] - if kind == "pipeline": - assert (cwd / "src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() - run(cwd, "bundle", "validate") - run(cwd, "bundle", "deploy", "--auto-approve") - assert ids(cwd) == current - pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) - assert pipeline["spec"]["libraries"][0]["file"]["path"] == root + "/files/src/pipeline.sql" - - # Toggle existing resources without replacing them. Disabled history must make no DMS calls. - all_dms = "* /api/2.0/bundle/**" - for enabled in [False, True]: - set_history(cwd, enabled) + # Read the bundle's local deployment state. + def state(cwd): + return json.loads((cwd / ".databricks/bundle/default/resources.json").read_text()) + + # Check the history marker and file-backed state, then collect and label resource IDs. + def ids(cwd, history=True): + data = state(cwd) + features = data.get("features", {}) + assert ("deployment_history_shadow" in features) == history, data + assert "deployment_history" not in features, data + current = {key: value["__id__"] for key, value in data["state"].items()} + for key, value in current.items(): + if value not in KNOWN_IDS: + add_repl(value, key.rsplit(".", 1)[1].upper() + "_ID") + KNOWN_IDS.add(value) + return current + + # Write the test bundle files with unique resource names and a workspace path. + def setup(phase): + cwd = Path("work", phase).resolve() + (cwd / "resources").mkdir(parents=True) + name = f"dms-fault-{API}-{phase}-{os.environ['UNIQUE_NAME']}" + root = f"/Workspace/Users/{os.environ['CURRENT_USER_NAME']}/.bundle/{name}" + values = {"RESOURCE_NAME": name, "ROOT_PATH": root, "DATASET_NAME": name.replace("-", "_")} + for source, target in [ + ("databricks.yml.tmpl", "databricks.yml"), + ("job.yml.tmpl", "resources/foo.job.yml"), + ("pipeline.yml.tmpl", "resources/bar.pipeline.yml"), + ("pipeline.sql.tmpl", "pipeline.sql"), + ]: + (cwd / target).write_text(Template((FIXTURES / source).read_text()).substitute(values)) + return cwd, root + + # Prepare an existing deployment and enable its API fault. + # Skip the initial deploy for CreateDeployment so its first call fails. + def activate(cwd, root): + print(f"\n=== {cwd.name}: setup", flush=True) + deployment = None + if API != "create_deployment": + run(cwd, "bundle", "deploy", "--auto-approve") + node = json.loads( + run(cwd, "workspace", "get-status", root + "/state/resources.deployment.json", "-o", "json").stdout + ) + deployment = str(node["object_id"]) + pattern = PATTERNS[API].format(id=deployment) + fault(pattern, True) + print(f"\n=== {cwd.name}: {API} fault enabled", flush=True) + return pattern + + # Verify resource names and IDs, plus the job's updated description. + def assert_alive(cwd, current, history=True): + job = json.loads(run(cwd, "jobs", "get", current["resources.jobs.foo"], "-o", "json").stdout) + pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) + assert str(job["job_id"]) == current["resources.jobs.foo"] + assert pipeline["pipeline_id"] == current["resources.pipelines.bar"] + assert job["settings"]["name"].startswith("updated-dms-fault-") + assert job["settings"]["description"] == f"history-{str(history).lower()}" + assert pipeline["spec"]["name"].startswith("updated-dms-fault-") + + # Export a resource, optionally adding it to the bundle and binding its original ID. + def generate(cwd, kind, key, identifier, bind=False): + args = ["bundle", "generate", kind, f"--existing-{kind}-id", identifier, "--key", key] + args += [ + "--config-dir", + "resources" if bind else "exported", + "--source-dir", + "src" if bind else "exported-src", + "--force", + ] + if bind: + args.append("--bind") + run(cwd, *args) + + # Toggle YAML history and change the job description to force a real update. + def set_history(cwd, enabled): + value = str(enabled).lower() + previous = str(not enabled).lower() + print(f"\n=== deployment_history: {value}", flush=True) + for filename, prefix in [ + ("databricks.yml", "deployment_history: "), + ("resources/foo.job.yml", "description: history-"), + ]: + subprocess.run( + [ + sys.executable, + shutil.which("update_file.py"), + str(cwd / filename), + prefix + previous, + prefix + value, + ], + check=True, + ) + + # Verify the job, pipeline, and remote state were deleted. + def assert_destroyed(cwd, root, current): + job = run(cwd, "jobs", "get", current["resources.jobs.foo"], expected=1) + assert "does not exist" in job.stderr.lower(), job.stderr + pipeline = run(cwd, "pipelines", "get", current["resources.pipelines.bar"], expected=1) + assert "not found" in pipeline.stderr.lower(), pipeline.stderr + file = run(cwd, "workspace", "get-status", root + "/state/resources.json", expected=1) + assert "doesn't exist" in file.stderr.lower() or "does not exist" in file.stderr.lower(), file.stderr + + cwd, root = setup("commands") + pattern = activate(cwd, root) + try: + # Pinning the root lets a bundle-name change exercise UpdateDeployment in place. + config = cwd / "databricks.yml" + config.write_text(config.read_text().replace("name: dms-fault-", "name: updated-dms-fault-")) + for path in (cwd / "resources").glob("*.yml"): + path.write_text(path.read_text().replace("name: dms-fault-", "name: updated-dms-fault-")) + previous = hits(pattern) + run(cwd, "bundle", "deploy", "--auto-approve") + current = ids(cwd) + assert_alive(cwd, current) + summary = run(cwd, "bundle", "summary").stdout + assert current["resources.jobs.foo"] in summary + assert current["resources.pipelines.bar"] in summary + for kind, key in [("job", "foo"), ("pipeline", "bar")]: + group = "jobs" if kind == "job" else "pipelines" + resource = f"resources.{group}.{key}" + generate(cwd, kind, key, current[resource]) + assert (cwd / "exported" / f"{key}.{kind}.yml").is_file() + if kind == "pipeline": + assert (cwd / "exported-src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() + run(cwd, "bundle", "deployment", "unbind", key) + assert resource not in state(cwd)["state"] + generate(cwd, kind, key, current[resource], bind=True) + assert ids(cwd)[resource] == current[resource] + if kind == "pipeline": + assert (cwd / "src/pipeline.sql").read_text() == (cwd / "pipeline.sql").read_text() + run(cwd, "bundle", "validate") + run(cwd, "bundle", "deploy", "--auto-approve") + assert ids(cwd) == current + pipeline = json.loads(run(cwd, "pipelines", "get", current["resources.pipelines.bar"], "-o", "json").stdout) + assert pipeline["spec"]["libraries"][0]["file"]["path"] == root + "/files/src/pipeline.sql" + + # Toggle existing resources without replacing them. Disabled history must make no DMS calls. + all_dms = "* /api/2.0/bundle/**" + for enabled in [False, True]: + set_history(cwd, enabled) + before = hits(all_dms) + run(cwd, "bundle", "deploy", "--auto-approve") + assert ids(cwd, history=enabled) == current + assert_alive(cwd, current, history=enabled) + if not enabled: + assert hits(all_dms) == before, "History-disabled deploy called DMS" + + run(cwd, "bundle", "destroy", "--auto-approve") + assert_destroyed(cwd, root, current) + + # A fresh deployment and its destroy must also work with history disabled. + set_history(cwd, False) before = hits(all_dms) run(cwd, "bundle", "deploy", "--auto-approve") - assert ids(cwd, history=enabled) == current - assert_alive(cwd, current, history=enabled) - if not enabled: - assert hits(all_dms) == before, "History-disabled deploy called DMS" - - run(cwd, "bundle", "destroy", "--auto-approve") - assert_destroyed(cwd, root, current) - - # A fresh deployment and its destroy must also work with history disabled. - set_history(cwd, False) - before = hits(all_dms) - run(cwd, "bundle", "deploy", "--auto-approve") - current = ids(cwd, history=False) - assert_alive(cwd, current, history=False) - run(cwd, "bundle", "destroy", "--auto-approve") - assert_destroyed(cwd, root, current) - assert hits(all_dms) == before, "History-disabled deploy/destroy called DMS" - print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) -finally: - fault(pattern, False) + current = ids(cwd, history=False) + assert_alive(cwd, current, history=False) + run(cwd, "bundle", "destroy", "--auto-approve") + assert_destroyed(cwd, root, current) + assert hits(all_dms) == before, "History-disabled deploy/destroy called DMS" + print("\nDMS API called: " + ("yes" if hits(pattern) > previous else "no"), flush=True) + finally: + fault(pattern, False) + + +if __name__ == "__main__": + main() From 0bb4e7486120cc10f594b1e0d8d2268097e63a76 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Thu, 29 Oct 2026 12:54:50 +0000 Subject: [PATCH 10/10] Resolve DMS test helper scripts by path on Windows --- acceptance/bundle/dms_fault/run.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/acceptance/bundle/dms_fault/run.py b/acceptance/bundle/dms_fault/run.py index b8710841839..11e22795ccc 100644 --- a/acceptance/bundle/dms_fault/run.py +++ b/acceptance/bundle/dms_fault/run.py @@ -5,7 +5,6 @@ import os import re import shlex -import shutil import subprocess import sys from pathlib import Path @@ -14,7 +13,9 @@ # Keep acceptance-only setup out of imports used by doctest. def main(): - sys.path.insert(0, str(Path(shutil.which("print_requests.py")).parent)) + # Use file paths: Windows does not reliably find Python scripts on PATH. + HELPERS = Path(__file__).resolve().parents[2] / "bin" + sys.path.insert(0, str(HELPERS)) from add_repl import add_repl from print_requests import read_json_many @@ -67,7 +68,7 @@ def run(cwd, *args, expected=0): # Enable or clear an HTTP 500 fault for this endpoint. def fault(pattern, enabled): subprocess.run( - [sys.executable, shutil.which("fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True + [sys.executable, str(HELPERS / "fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True ) # Count recorded method/path matches to report whether this API was called. @@ -165,7 +166,7 @@ def set_history(cwd, enabled): subprocess.run( [ sys.executable, - shutil.which("update_file.py"), + str(HELPERS / "update_file.py"), str(cwd / filename), prefix + previous, prefix + value,