Debian Codegraph @

storage/2018-03-28/datalakestore/filesystems/create_test.go

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 package filesystems
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/testhelpers"
10 )
11
12 func TestCreateHasNoTagsByDefault(t *testing.T) {
13 client, err := testhelpers.Build(t)
14 if err != nil {
15 t.Fatal(err)
16 }
17 ctx := context.TODO()
18
19 resourceGroup := fmt.Sprintf("acctestrg-%d", testhelpers.RandomInt())
20 accountName := fmt.Sprintf("acctestsa%s", testhelpers.RandomString())
21 fileSystemName := fmt.Sprintf("acctestfs-%s", testhelpers.RandomString())
22
•23 if _, err = client.BuildTestResources(ctx, resourceGroup, accountName, storage.BlobStorage); err != nil {
24 t.Fatal(err)
25 }
26 defer client.DestroyTestResources(ctx, resourceGroup, accountName)
27
28 fileSystemsClient := NewWithEnvironment(client.Environment)
29 fileSystemsClient.Client = client.PrepareWithStorageResourceManagerAuth(fileSystemsClient.Client)
30
31 t.Logf("[DEBUG] Creating an empty File System..")
32 input := CreateInput{
33 Properties: map[string]string{},
34 }
35 if _, err = fileSystemsClient.Create(ctx, accountName, fileSystemName, input); err != nil {
36 t.Fatal(fmt.Errorf("Error creating: %s", err))
37 }
38
39 t.Logf("[DEBUG] Retrieving the Properties..")
40 props, err := fileSystemsClient.GetProperties(ctx, accountName, fileSystemName)
41 if err != nil {
42 t.Fatal(fmt.Errorf("Error getting properties: %s", err))
43 }
44
45 if len(props.Properties) != 0 {
46 t.Fatalf("Expected 0 properties by default but got %d", len(props.Properties))
47 }
48
49 t.Logf("[DEBUG] Deleting File System..")
50 if _, err := fileSystemsClient.Delete(ctx, accountName, fileSystemName); err != nil {
51 t.Fatalf("Error deleting: %s", err)
52 }
53 }