github.com/databricks/cli@v0.203.0/bundle/config/mutator/process_include_test.go (about) 1 package mutator_test 2 3 import ( 4 "context" 5 "fmt" 6 "os" 7 "path/filepath" 8 "testing" 9 10 "github.com/databricks/cli/bundle" 11 "github.com/databricks/cli/bundle/config" 12 "github.com/databricks/cli/bundle/config/mutator" 13 "github.com/stretchr/testify/assert" 14 "github.com/stretchr/testify/require" 15 ) 16 17 func TestProcessInclude(t *testing.T) { 18 bundle := &bundle.Bundle{ 19 Config: config.Root{ 20 Path: t.TempDir(), 21 Workspace: config.Workspace{ 22 Host: "foo", 23 }, 24 }, 25 } 26 27 relPath := "./file.yml" 28 fullPath := filepath.Join(bundle.Config.Path, relPath) 29 f, err := os.Create(fullPath) 30 require.NoError(t, err) 31 fmt.Fprint(f, "workspace:\n host: bar\n") 32 f.Close() 33 34 assert.Equal(t, "foo", bundle.Config.Workspace.Host) 35 err = mutator.ProcessInclude(fullPath, relPath).Apply(context.Background(), bundle) 36 require.NoError(t, err) 37 assert.Equal(t, "bar", bundle.Config.Workspace.Host) 38 }