2022-11-28 09:59:43 +00:00
|
|
|
package config_tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2023-05-16 16:35:39 +00:00
|
|
|
"github.com/databricks/cli/bundle"
|
|
|
|
"github.com/databricks/cli/bundle/config/mutator"
|
2022-11-28 09:59:43 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func load(t *testing.T, path string) *bundle.Bundle {
|
|
|
|
b, err := bundle.Load(path)
|
|
|
|
require.NoError(t, err)
|
|
|
|
err = bundle.Apply(context.Background(), b, mutator.DefaultMutators())
|
|
|
|
require.NoError(t, err)
|
|
|
|
return b
|
|
|
|
}
|
|
|
|
|
|
|
|
func loadEnvironment(t *testing.T, path, env string) *bundle.Bundle {
|
|
|
|
b := load(t, path)
|
|
|
|
err := bundle.Apply(context.Background(), b, []bundle.Mutator{mutator.SelectEnvironment(env)})
|
|
|
|
require.NoError(t, err)
|
|
|
|
return b
|
|
|
|
}
|