Debian Codegraph @

storage/2020-08-04/datalakestore/paths/create_test.go

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 package paths
2
3 import (
4 "context"
5 "fmt"
6 "testing"
7
8 "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage"
9 "github.com/tombuildsstuff/giovanni/storage/2020-08-04/datalakestore/filesystems"
10 "github.com/tombuildsstuff/giovanni/testhelpers"
11 )
12
13 func TestCreateDirectory(t *testing.T) {
14 client, err := testhelpers.Build(t)
15 if err != nil {
16 t.Fatal(err)
17 }
18 ctx := context.TODO()
19
20 resourceGroup := fmt.Sprintf("acctestrg-%d", testhelpers.RandomInt())
21 accountName := fmt.Sprintf("acctestsa%s", testhelpers.RandomString())
22 fileSystemName := fmt.Sprintf("acctestfs-%s", testhelpers.RandomString())
23 path := "test"
24
•25 if _, err = client.BuildTestResourcesWithHns(ctx, resourceGroup, accountName, storage.BlobStorage); err != nil {
26 t.Fatal(err)
27 }
28 defer client.DestroyTestResources(ctx, resourceGroup, accountName)
29
30 fileSystemsClient := filesystems.NewWithEnvironment(client.Environment)
31 fileSystemsClient.Client = client.PrepareWithStorageResourceManagerAuth(fileSystemsClient.Client)
32
33 t.Logf("[DEBUG] Creating an empty File System..")
34 fileSystemInput := filesystems.CreateInput{
35 Properties: map[string]string{},
36 }
37 if _, err = fileSystemsClient.Create(ctx, accountName, fileSystemName, fileSystemInput); err != nil {
38 t.Fatal(fmt.Errorf("Error creating: %s", err))
39 }
40
41 t.Logf("[DEBUG] Creating path..")
42 pathsClient := NewWithEnvironment(client.Environment)
43 pathsClient.Client = client.PrepareWithStorageResourceManagerAuth(pathsClient.Client)
44
45 input := CreateInput{
46 Resource: PathResourceDirectory,
47 }
48
49 if _, err = pathsClient.Create(ctx, accountName, fileSystemName, path, input); err != nil {
50 t.Fatal(fmt.Errorf("Error creating path: %s", err))
51 }
52
53 t.Logf("[DEBUG] Deleting File System..")
54 if _, err := fileSystemsClient.Delete(ctx, accountName, fileSystemName); err != nil {
55 t.Fatalf("Error deleting: %s", err)
56 }
57 }