11package bundle_test
22
33import (
4- "fmt"
54 "os"
65 "path"
76 "path/filepath"
@@ -13,14 +12,8 @@ import (
1312 "github.com/databricks/cli/bundle/config/resources"
1413 "github.com/databricks/cli/bundle/libraries"
1514 "github.com/databricks/cli/integration/internal/acc"
16- "github.com/databricks/cli/internal/testcli"
17- "github.com/databricks/cli/internal/testutil"
18- "github.com/databricks/cli/libs/env"
19- "github.com/databricks/databricks-sdk-go/service/catalog"
2015 "github.com/databricks/databricks-sdk-go/service/compute"
2116 "github.com/databricks/databricks-sdk-go/service/jobs"
22- "github.com/google/uuid"
23- "github.com/stretchr/testify/assert"
2417 "github.com/stretchr/testify/require"
2518)
2619
@@ -228,82 +221,3 @@ func TestUploadArtifactFileToCorrectRemotePathForVolumes(t *testing.T) {
228221 b .Config .Resources .Jobs ["test" ].JobSettings .Tasks [0 ].Libraries [0 ].Whl ,
229222 )
230223}
231-
232- func TestUploadArtifactFileToVolumeThatDoesNotExist (t * testing.T ) {
233- ctx , wt := acc .UcWorkspaceTest (t )
234- w := wt .W
235-
236- schemaName := testutil .RandomName ("schema-" )
237-
238- _ , err := w .Schemas .Create (ctx , catalog.CreateSchema {
239- CatalogName : "main" ,
240- Comment : "test schema" ,
241- Name : schemaName ,
242- })
243- require .NoError (t , err )
244-
245- t .Cleanup (func () {
246- err = w .Schemas .DeleteByFullName (ctx , "main." + schemaName )
247- require .NoError (t , err )
248- })
249-
250- bundleRoot := initTestTemplate (t , ctx , "artifact_path_with_volume" , map [string ]any {
251- "unique_id" : uuid .New ().String (),
252- "schema_name" : schemaName ,
253- "volume_name" : "doesnotexist" ,
254- })
255-
256- ctx = env .Set (ctx , "BUNDLE_ROOT" , bundleRoot )
257- stdout , stderr , err := testcli .RequireErrorRun (t , ctx , "bundle" , "deploy" )
258-
259- assert .Error (t , err )
260- assert .Equal (t , fmt .Sprintf (`Error: volume main.%s.doesnotexist does not exist
261- at workspace.artifact_path
262- in databricks.yml:6:18
263-
264- ` , schemaName ), stdout .String ())
265- assert .Equal (t , "" , stderr .String ())
266- }
267-
268- func TestUploadArtifactToVolumeNotYetDeployed (t * testing.T ) {
269- ctx , wt := acc .UcWorkspaceTest (t )
270- w := wt .W
271-
272- schemaName := testutil .RandomName ("schema-" )
273-
274- _ , err := w .Schemas .Create (ctx , catalog.CreateSchema {
275- CatalogName : "main" ,
276- Comment : "test schema" ,
277- Name : schemaName ,
278- })
279- require .NoError (t , err )
280-
281- t .Cleanup (func () {
282- err = w .Schemas .DeleteByFullName (ctx , "main." + schemaName )
283- require .NoError (t , err )
284- })
285-
286- bundleRoot := initTestTemplate (t , ctx , "artifact_path_with_volume" , map [string ]any {
287- "unique_id" : uuid .New ().String (),
288- "schema_name" : schemaName ,
289- "volume_name" : "my_volume" ,
290- })
291-
292- ctx = env .Set (ctx , "BUNDLE_ROOT" , bundleRoot )
293- stdout , stderr , err := testcli .RequireErrorRun (t , ctx , "bundle" , "deploy" )
294-
295- assert .Error (t , err )
296- assert .Equal (t , fmt .Sprintf (`Error: volume main.%s.my_volume does not exist
297- at workspace.artifact_path
298- resources.volumes.foo
299- in databricks.yml:6:18
300- databricks.yml:11:7
301-
302- You are using a volume in your artifact_path that is managed by
303- this bundle but which has not been deployed yet. Please first deploy
304- the volume using 'bundle deploy' and then switch over to using it in
305- the artifact_path.
306-
307- ` , schemaName ), stdout .String ())
308- assert .Equal (t , "" , stderr .String ())
309- }
0 commit comments