@@ -8,23 +8,38 @@ import (
88
99 "github.com/databricks/cli/internal/acc"
1010 "github.com/google/uuid"
11+ "github.com/stretchr/testify/assert"
1112 "github.com/stretchr/testify/require"
1213)
1314
1415func TestAccEmptyBundleDeploy (t * testing.T ) {
15- ctx , _ := acc .WorkspaceTest (t )
16+ ctx , w := acc .WorkspaceTest (t )
17+
18+ uniqueId := uuid .New ().String ()
19+ me , err := w .W .CurrentUser .Me (ctx )
20+ require .NoError (t , err )
21+ remoteRoot := fmt .Sprintf ("/Workspace/Users/%s/.bundle/%s" , me .UserName , uniqueId )
1622
1723 // create empty bundle
1824 tmpDir := t .TempDir ()
1925 f , err := os .Create (filepath .Join (tmpDir , "databricks.yml" ))
2026 require .NoError (t , err )
2127
2228 bundleRoot := fmt .Sprintf (`bundle:
23- name: %s` , uuid . New (). String () )
29+ name: %s` , uniqueId )
2430 _ , err = f .WriteString (bundleRoot )
2531 require .NoError (t , err )
2632 f .Close ()
2733
34+ _ , err = w .W .Workspace .GetStatusByPath (ctx , remoteRoot )
35+ assert .ErrorContains (t , err , "doesn't exist" )
36+
37+ mustValidateBundle (t , ctx , tmpDir )
38+
39+ // regression: "bundle validate" must not create a directory
40+ _ , err = w .W .Workspace .GetStatusByPath (ctx , remoteRoot )
41+ require .ErrorContains (t , err , "doesn't exist" )
42+
2843 // deploy empty bundle
2944 err = deployBundle (t , ctx , tmpDir )
3045 require .NoError (t , err )
@@ -33,4 +48,9 @@ func TestAccEmptyBundleDeploy(t *testing.T) {
3348 err = destroyBundle (t , ctx , tmpDir )
3449 require .NoError (t , err )
3550 })
51+
52+ // verify that remoteRoot was actually relevant location to test
53+ _ , err = w .W .Workspace .GetStatusByPath (ctx , remoteRoot )
54+ assert .NoError (t , err )
55+
3656}
0 commit comments