databricks-cli/bundle/internal/bundletest/mutate.go

21 lines
516 B
Go
Raw Normal View History

package bundletest
import (
"context"
"testing"
"github.com/databricks/cli/bundle"
"github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/libs/dyn"
"github.com/stretchr/testify/require"
)
func Mutate(t *testing.T, b *bundle.Bundle, f func(v dyn.Value) (dyn.Value, error)) {
2024-10-01 18:22:53 +00:00
diags := bundle.ApplyFunc(context.Background(), b, func(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
err := b.Config.Mutate(f)
require.NoError(t, err)
return nil
})
2024-10-01 18:22:53 +00:00
require.NoError(t, diags.Error())
}