2023-11-22 12:25:16 +00:00
|
|
|
package template
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
2024-11-20 09:28:35 +00:00
|
|
|
"os"
|
2023-11-22 12:25:16 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/databricks/cli/cmd/root"
|
|
|
|
"github.com/databricks/databricks-sdk-go"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMaterializeForNonTemplateDirectory(t *testing.T) {
|
|
|
|
tmpDir := t.TempDir()
|
|
|
|
w, err := databricks.NewWorkspaceClient(&databricks.Config{})
|
|
|
|
require.NoError(t, err)
|
|
|
|
ctx := root.SetWorkspaceClient(context.Background(), w)
|
|
|
|
|
|
|
|
// Try to materialize a non-template directory.
|
2024-11-20 11:42:23 +00:00
|
|
|
err = Materialize(ctx, "", os.DirFS(tmpDir), nil)
|
2024-11-20 09:28:35 +00:00
|
|
|
assert.EqualError(t, err, fmt.Sprintf("not a bundle template: expected to find a template schema file at %s", schemaFileName))
|
2023-11-22 12:25:16 +00:00
|
|
|
}
|