diff --git a/acceptance/bundle/telemetry/config-remote-sync-error/databricks.yml b/acceptance/bundle/telemetry/config-remote-sync-error/databricks.yml new file mode 100644 index 00000000000..c0c9f880163 --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync-error/databricks.yml @@ -0,0 +1,11 @@ +bundle: + name: config-remote-sync-telemetry-error + +resources: + jobs: + foo: + name: test job + tasks: + - task_key: main + notebook_task: + notebook_path: /Workspace/Users/tester@databricks.com/notebook diff --git a/acceptance/bundle/telemetry/config-remote-sync-error/out.test.toml b/acceptance/bundle/telemetry/config-remote-sync-error/out.test.toml new file mode 100644 index 00000000000..65156e0457c --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync-error/out.test.toml @@ -0,0 +1,3 @@ +Local = true +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform"] diff --git a/acceptance/bundle/telemetry/config-remote-sync-error/output.txt b/acceptance/bundle/telemetry/config-remote-sync-error/output.txt new file mode 100644 index 00000000000..03e421aaa45 --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync-error/output.txt @@ -0,0 +1,11 @@ + +>>> errcode [CLI] bundle config-remote-sync +Error: failed to detect changes: state snapshot not available: resources state snapshot not found remotely at resources-config-sync-snapshot.json: state snapshot not found + +Exit code: 1 + +>>> cat out.requests.txt +{ + "engine": "terraform", + "error_category": "STATE_NOT_FOUND" +} diff --git a/acceptance/bundle/telemetry/config-remote-sync-error/script b/acceptance/bundle/telemetry/config-remote-sync-error/script new file mode 100644 index 00000000000..e48fb6ff123 --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync-error/script @@ -0,0 +1,7 @@ +# Running config-remote-sync without a prior deploy: the state snapshot does +# not exist, so the command fails and telemetry reports STATE_NOT_FOUND. +trace errcode $CLI bundle config-remote-sync + +trace cat out.requests.txt | jq 'select(has("path") and .path == "/telemetry-ext") | .body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_config_remote_sync_event | select(. != null)' + +rm out.requests.txt diff --git a/acceptance/bundle/telemetry/config-remote-sync-error/test.toml b/acceptance/bundle/telemetry/config-remote-sync-error/test.toml new file mode 100644 index 00000000000..a7617afecd5 --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync-error/test.toml @@ -0,0 +1,4 @@ +# Running without a prior deploy only fails with STATE_NOT_FOUND on the +# terraform engine (the snapshot pull path); pin the matrix accordingly. +[EnvMatrix] + DATABRICKS_BUNDLE_ENGINE = ["terraform"] diff --git a/acceptance/bundle/telemetry/config-remote-sync/databricks.yml b/acceptance/bundle/telemetry/config-remote-sync/databricks.yml new file mode 100644 index 00000000000..543dc4129bd --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync/databricks.yml @@ -0,0 +1,11 @@ +bundle: + name: config-remote-sync-telemetry + +resources: + jobs: + foo: + name: test job + tasks: + - task_key: main + notebook_task: + notebook_path: /Workspace/Users/tester@databricks.com/notebook diff --git a/acceptance/bundle/telemetry/config-remote-sync/out.test.toml b/acceptance/bundle/telemetry/config-remote-sync/out.test.toml new file mode 100644 index 00000000000..e90b6d5d1ba --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync/out.test.toml @@ -0,0 +1,3 @@ +Local = true +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/telemetry/config-remote-sync/output.txt b/acceptance/bundle/telemetry/config-remote-sync/output.txt new file mode 100644 index 00000000000..8886bae291a --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync/output.txt @@ -0,0 +1,29 @@ + +>>> [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/config-remote-sync-telemetry/default/files... +Deploying resources... +Updating deployment state... +Deployment complete! + +>>> [CLI] bundle config-remote-sync +Detected changes in 1 resource(s): + +Resource: resources.jobs.foo + name: replace + + + +>>> cat out.requests.txt +{ + "engine": "direct", + "changes_total": 1, + "replace_count": 1, + "resource_changes": [ + { + "resource_type": "jobs", + "changes_count": 1, + "replace_count": 1 + } + ], + "files_changed_count": 1 +} diff --git a/acceptance/bundle/telemetry/config-remote-sync/script b/acceptance/bundle/telemetry/config-remote-sync/script new file mode 100644 index 00000000000..18247c96ce6 --- /dev/null +++ b/acceptance/bundle/telemetry/config-remote-sync/script @@ -0,0 +1,12 @@ +trace $CLI bundle deploy + +job_id="$(read_id.py foo)" +edit_resource.py jobs $job_id <