Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions acceptance/bundle/deployment/bind/experiment/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Updating deployment state...
Deployment complete!

>>> [CLI] experiments get-experiment [NUMID]
{
"name": "/Users/[USERNAME]/test-experiment[UNIQUE_NAME]",
"lifecycle_stage": "active"
}

>>> [CLI] bundle deployment unbind experiment1
Updating deployment state...
Expand All @@ -22,6 +26,10 @@ Deleting files...
Destroy complete!

>>> [CLI] experiments get-experiment [NUMID]
{
"name": "/Users/[USERNAME]/test-experiment[UNIQUE_NAME]",
"lifecycle_stage": "active"
}

=== Test cleanup:
=== Delete the pre-defined experiment: 0
6 changes: 2 additions & 4 deletions acceptance/bundle/deployment/bind/experiment/script
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ trace $CLI bundle deployment bind experiment1 ${EXPERIMENT_ID} --auto-approve

trace $CLI bundle deploy --force-lock --auto-approve

trace $CLI experiments get-experiment ${EXPERIMENT_ID} | jq '{name: .experiment.name, lifecycle_stage: .experiment.lifecycle_stage}' > out.get.$DATABRICKS_BUNDLE_ENGINE.json
trace $CLI experiments get-experiment ${EXPERIMENT_ID} | jq '{name: .experiment.name, lifecycle_stage: .experiment.lifecycle_stage}'

trace $CLI bundle deployment unbind experiment1

trace $CLI bundle destroy --auto-approve

trace $CLI experiments get-experiment ${EXPERIMENT_ID} | jq '{name: .experiment.name, lifecycle_stage: .experiment.lifecycle_stage}' > out.get2.$DATABRICKS_BUNDLE_ENGINE.json
diff out.get.$DATABRICKS_BUNDLE_ENGINE.json out.get2.$DATABRICKS_BUNDLE_ENGINE.json
rm out.get2.$DATABRICKS_BUNDLE_ENGINE.json
trace $CLI experiments get-experiment ${EXPERIMENT_ID} | jq '{name: .experiment.name, lifecycle_stage: .experiment.lifecycle_stage}'
10 changes: 1 addition & 9 deletions acceptance/bundle/deployment/bind/experiment/test.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
Badness = "Difference in GET request between direct and terraform; In direct, the prefix is /Workspace/Users, in TF it is /Users"
Local = true

# Fails on Cloud with:
#=== CONT TestAccept/bundle/deployment/bind/experiment/DATABRICKS_BUNDLE_ENGINE=direct
# - "name": "/Workspace/Users/[USERNAME]/test-experiment[UNIQUE_NAME]",
# + "name": "/Users/[USERNAME]/test-experiment[UNIQUE_NAME]",
# https://github.com/databricks/cli/issues/4285

Cloud = false
Cloud = true
3 changes: 3 additions & 0 deletions bundle/config/mutator/resourcemutator/apply_presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos
if e == nil {
continue
}
// Strip /Workspace prefix from experiment names to ensure consistent
// behavior between the direct and terraform deployment engines.
e.Name = strings.TrimPrefix(e.Name, "/Workspace")
filepath := e.Name
dir := path.Dir(filepath)
base := path.Base(filepath)
Expand Down
3 changes: 2 additions & 1 deletion libs/testserver/experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ func (s *FakeWorkspace) ExperimentUpdate(req Request) Response {

// Update the experiment
if updateReq.NewName != "" {
experiment.Experiment.Name = updateReq.NewName
// Strip /Workspace prefix from experiment name to match cloud behavior
experiment.Experiment.Name = strings.TrimPrefix(updateReq.NewName, "/Workspace")

// The server modifies the value of the tag as well. Mimic that behaviour
// in the test server as well.
Expand Down