2023-09-13 22:50:37 +00:00
|
|
|
package bundle
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
2024-02-07 11:18:56 +00:00
|
|
|
"github.com/databricks/cli/internal/acc"
|
2023-09-13 22:50:37 +00:00
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAccEmptyBundleDeploy(t *testing.T) {
|
2024-02-07 11:18:56 +00:00
|
|
|
ctx, _ := acc.WorkspaceTest(t)
|
2023-09-13 22:50:37 +00:00
|
|
|
|
|
|
|
// create empty bundle
|
|
|
|
tmpDir := t.TempDir()
|
|
|
|
f, err := os.Create(filepath.Join(tmpDir, "databricks.yml"))
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
bundleRoot := fmt.Sprintf(`bundle:
|
|
|
|
name: %s`, uuid.New().String())
|
|
|
|
_, err = f.WriteString(bundleRoot)
|
|
|
|
require.NoError(t, err)
|
|
|
|
f.Close()
|
|
|
|
|
|
|
|
// deploy empty bundle
|
2024-02-07 11:18:56 +00:00
|
|
|
err = deployBundle(t, ctx, tmpDir)
|
2023-09-13 22:50:37 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
t.Cleanup(func() {
|
2024-02-07 11:18:56 +00:00
|
|
|
err = destroyBundle(t, ctx, tmpDir)
|
2023-09-13 22:50:37 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
})
|
|
|
|
}
|