github.com/databricks/cli@v0.203.0/bundle/tests/loader.go (about)

     1  package config_tests
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/databricks/cli/bundle"
     8  	"github.com/databricks/cli/bundle/config/mutator"
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func load(t *testing.T, path string) *bundle.Bundle {
    13  	b, err := bundle.Load(path)
    14  	require.NoError(t, err)
    15  	err = bundle.Apply(context.Background(), b, bundle.Seq(mutator.DefaultMutators()...))
    16  	require.NoError(t, err)
    17  	return b
    18  }
    19  
    20  func loadEnvironment(t *testing.T, path, env string) *bundle.Bundle {
    21  	b := load(t, path)
    22  	err := bundle.Apply(context.Background(), b, mutator.SelectEnvironment(env))
    23  	require.NoError(t, err)
    24  	return b
    25  }