github.com/databricks/cli@v0.203.0/bundle/config/mutator/default_workspace_paths_test.go (about) 1 package mutator_test 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/databricks/cli/bundle" 8 "github.com/databricks/cli/bundle/config" 9 "github.com/databricks/cli/bundle/config/mutator" 10 "github.com/stretchr/testify/assert" 11 "github.com/stretchr/testify/require" 12 ) 13 14 func TestDefineDefaultWorkspacePaths(t *testing.T) { 15 bundle := &bundle.Bundle{ 16 Config: config.Root{ 17 Workspace: config.Workspace{ 18 RootPath: "/", 19 }, 20 }, 21 } 22 err := mutator.DefineDefaultWorkspacePaths().Apply(context.Background(), bundle) 23 require.NoError(t, err) 24 assert.Equal(t, "/files", bundle.Config.Workspace.FilesPath) 25 assert.Equal(t, "/artifacts", bundle.Config.Workspace.ArtifactsPath) 26 assert.Equal(t, "/state", bundle.Config.Workspace.StatePath) 27 } 28 29 func TestDefineDefaultWorkspacePathsAlreadySet(t *testing.T) { 30 bundle := &bundle.Bundle{ 31 Config: config.Root{ 32 Workspace: config.Workspace{ 33 RootPath: "/", 34 FilesPath: "/foo/bar", 35 ArtifactsPath: "/foo/bar", 36 StatePath: "/foo/bar", 37 }, 38 }, 39 } 40 err := mutator.DefineDefaultWorkspacePaths().Apply(context.Background(), bundle) 41 require.NoError(t, err) 42 assert.Equal(t, "/foo/bar", bundle.Config.Workspace.FilesPath) 43 assert.Equal(t, "/foo/bar", bundle.Config.Workspace.ArtifactsPath) 44 assert.Equal(t, "/foo/bar", bundle.Config.Workspace.StatePath) 45 }