Debian Codegraph @

storage/2019-12-12/file/shares/lifecycle_test.go

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 package sharesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/
2
3 import (
4 "contextscip-go gomod github.com/golang/go/src go1.13 context/"
5 "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/"
6 "testingscip-go gomod github.com/golang/go/src go1.13 testing/"
7
8 "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/"
9 "github.com/tombuildsstuff/giovanni/storage/internal/authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/auth`/"
10 "github.com/tombuildsstuff/giovanni/testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/"
11 )
12
13 var _ StorageSharescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/StorageShare# = Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#{}
14
15 func TestSharesLifecyclescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/TestSharesLifecycle().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
16 client, err := testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.Buildscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Build().(t)
17 if err != nil {
18 t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err)
19 }
20 ctx := contextscip-go gomod github.com/golang/go/src go1.13 context/.TODOscip-go gomod github.com/golang/go/src go1.13 context/TODO().()
21 resourceGroup := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("acctestrg-%d", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomIntscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomInt().())
22 accountName := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("acctestsa%s", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomStringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomString().())
23 shareName := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("share-%d", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomIntscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomInt().())
24
•25 testData, err := client.BuildTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#BuildTestResources().(ctx, resourceGroup, accountName, storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.Storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/Storage.)
26 if err != nil {
27 t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err)
28 }
29 defer client.DestroyTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#DestroyTestResources().(ctx, resourceGroup, accountName)
30
31 storageAuth := authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/auth`/.NewSharedKeyLiteAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/auth`/NewSharedKeyLiteAuthorizer().(accountName, testData.StorageAccountKeyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#StorageAccountKey.)
32 sharesClient := NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/NewWithEnvironment().(client.Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment.)
33 sharesClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Client. = client.PrepareWithAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithAuthorizer().(sharesClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Client., storageAuth)
34
35 input := CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateInput#{
36 QuotaInGBscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateInput#QuotaInGB.: 1,
37 }
38 _, err = sharesClient.Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Create().(ctx, accountName, shareName, input)
39 if err != nil {
40 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error creating fileshare: %s", err)
41 }
42
43 snapshot, err := sharesClient.CreateSnapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#CreateSnapshot().(ctx, accountName, shareName, CreateSnapshotInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotInput#{})
44 if err != nil {
45 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error taking snapshot: %s", err)
46 }
47 t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("Snapshot Date Time: %s", snapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotResult#SnapshotDateTime.)
48
49 snapshotDetails, err := sharesClient.GetSnapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetSnapshot().(ctx, accountName, shareName, snapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotResult#SnapshotDateTime.)
50 if err != nil {
51 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving snapshot: %s", err)
52 }
53
54 t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("MetaData: %s", snapshotDetails.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetSnapshotPropertiesResult#MetaData.)
55
56 _, err = sharesClient.DeleteSnapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#DeleteSnapshot().(ctx, accountName, shareName, snapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotResult#SnapshotDateTime.)
57 if err != nil {
58 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting snapshot: %s", err)
59 }
60
61 stats, err := sharesClient.GetStatsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetStats().(ctx, accountName, shareName)
62 if err != nil {
63 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving stats: %s", err)
64 }
65
66 if stats.ShareUsageBytesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetStatsResult#ShareUsageBytes. != 0 {
67 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected `stats.ShareUsageBytes` to be 0 but got: %d", stats.ShareUsageBytesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetStatsResult#ShareUsageBytes.)
68 }
69
70 share, err := sharesClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetProperties().(ctx, accountName, shareName)
71 if err != nil {
72 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving share: %s", err)
73 }
74 if share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota. != 1 {
75 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Quota to be 1 but got: %d", share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota.)
76 }
77
78 _, err = sharesClient.SetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#SetProperties().(ctx, accountName, shareName, 5)
79 if err != nil {
80 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error updating quota: %s", err)
81 }
82
83 share, err = sharesClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetProperties().(ctx, accountName, shareName)
84 if err != nil {
85 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving share: %s", err)
86 }
87 if share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota. != 5 {
88 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Quota to be 5 but got: %d", share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota.)
89 }
90
91 updatedMetaData := map[string]string{
92 "hello": "world",
93 }
94 _, err = sharesClient.SetMetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#SetMetaData().(ctx, accountName, shareName, updatedMetaData)
95 if err != nil {
96 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Erorr setting metadata: %s", err)
97 }
98
99 result, err := sharesClient.GetMetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetMetaData().(ctx, accountName, shareName)
100 if err != nil {
101 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving metadata: %s", err)
102 }
103
104 if result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.["hello"] != "world" {
105 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected metadata `hello` to be `world` but got: %q", result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.["hello"])
106 }
107 if len(result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.) != 1 {
108 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected metadata to be 1 item but got: %s", result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.)
109 }
110
111 acls, err := sharesClient.GetACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetACL().(ctx, accountName, shareName)
112 if err != nil {
113 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving ACL's: %s", err)
114 }
115 if len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.) != 0 {
116 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected 0 identifiers but got %d", len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.))
117 }
118
119 updatedAcls := []SignedIdentifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#{
120 {
121 Idscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#Id.: "abc123",
122 AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#AccessPolicy.: AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#{
123 Startscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Start.: "2020-07-01T08:49:37.0000000Z",
124 Expiryscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Expiry.: "2020-07-01T09:49:37.0000000Z",
125 Permissionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Permission.: "rwd",
126 },
127 },
128 {
129 Idscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#Id.: "bcd234",
130 AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#AccessPolicy.: AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#{
131 Startscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Start.: "2020-07-01T08:49:37.0000000Z",
132 Expiryscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Expiry.: "2020-07-01T09:49:37.0000000Z",
133 Permissionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Permission.: "rwd",
134 },
135 },
136 }
137 _, err = sharesClient.SetACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#SetACL().(ctx, accountName, shareName, updatedAcls)
138 if err != nil {
139 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error setting ACL's: %s", err)
140 }
141
142 acls, err = sharesClient.GetACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetACL().(ctx, accountName, shareName)
143 if err != nil {
144 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving ACL's: %s", err)
145 }
146 if len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.) != 2 {
147 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected 2 identifiers but got %d", len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.))
148 }
149
150 _, err = sharesClient.Deletescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Delete().(ctx, accountName, shareName, false)
151 if err != nil {
152 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting Share: %s", err)
153 }
154 }
155
156 func TestSharesLifecycleLargeQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/TestSharesLifecycleLargeQuota().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
157 client, err := testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.Buildscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Build().(t)
158 if err != nil {
159 t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err)
160 }
161 ctx := contextscip-go gomod github.com/golang/go/src go1.13 context/.TODOscip-go gomod github.com/golang/go/src go1.13 context/TODO().()
162 resourceGroup := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("acctestrg-%d", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomIntscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomInt().())
163 accountName := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("acctestsa%s", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomStringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomString().())
164 shareName := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("share-%d", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomIntscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomInt().())
165
•166 testData, err := client.BuildTestResourcesWithSkuscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#BuildTestResourcesWithSku().(ctx, resourceGroup, accountName, storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.FileStoragescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/FileStorage., storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.PremiumLRSscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/PremiumLRS.)
167 if err != nil {
168 t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err)
169 }
170 defer client.DestroyTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#DestroyTestResources().(ctx, resourceGroup, accountName)
171
172 storageAuth := authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/auth`/.NewSharedKeyLiteAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/auth`/NewSharedKeyLiteAuthorizer().(accountName, testData.StorageAccountKeyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#StorageAccountKey.)
173 sharesClient := NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/NewWithEnvironment().(client.Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment.)
174 sharesClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Client. = client.PrepareWithAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithAuthorizer().(sharesClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Client., storageAuth)
175
176 input := CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateInput#{
177 QuotaInGBscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateInput#QuotaInGB.: 1001,
178 }
179 _, err = sharesClient.Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Create().(ctx, accountName, shareName, input)
180 if err != nil {
181 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error creating fileshare: %s", err)
182 }
183
184 snapshot, err := sharesClient.CreateSnapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#CreateSnapshot().(ctx, accountName, shareName, CreateSnapshotInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotInput#{})
185 if err != nil {
186 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error taking snapshot: %s", err)
187 }
188 t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("Snapshot Date Time: %s", snapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotResult#SnapshotDateTime.)
189
190 snapshotDetails, err := sharesClient.GetSnapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetSnapshot().(ctx, accountName, shareName, snapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotResult#SnapshotDateTime.)
191 if err != nil {
192 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving snapshot: %s", err)
193 }
194
195 t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("MetaData: %s", snapshotDetails.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetSnapshotPropertiesResult#MetaData.)
196
197 _, err = sharesClient.DeleteSnapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#DeleteSnapshot().(ctx, accountName, shareName, snapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/CreateSnapshotResult#SnapshotDateTime.)
198 if err != nil {
199 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting snapshot: %s", err)
200 }
201
202 stats, err := sharesClient.GetStatsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetStats().(ctx, accountName, shareName)
203 if err != nil {
204 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving stats: %s", err)
205 }
206
207 if stats.ShareUsageBytesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetStatsResult#ShareUsageBytes. != 0 {
208 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected `stats.ShareUsageBytes` to be 0 but got: %d", stats.ShareUsageBytesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetStatsResult#ShareUsageBytes.)
209 }
210
211 share, err := sharesClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetProperties().(ctx, accountName, shareName)
212 if err != nil {
213 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving share: %s", err)
214 }
215 if share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota. != 1001 {
216 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Quota to be 1 but got: %d", share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota.)
217 }
218
219 _, err = sharesClient.SetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#SetProperties().(ctx, accountName, shareName, 6000)
220 if err != nil {
221 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error updating quota: %s", err)
222 }
223
224 share, err = sharesClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetProperties().(ctx, accountName, shareName)
225 if err != nil {
226 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving share: %s", err)
227 }
228 if share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota. != 6000 {
229 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Quota to be 5 but got: %d", share.ShareQuotascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetPropertiesResult#ShareQuota.)
230 }
231
232 updatedMetaData := map[string]string{
233 "hello": "world",
234 }
235 _, err = sharesClient.SetMetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#SetMetaData().(ctx, accountName, shareName, updatedMetaData)
236 if err != nil {
237 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Erorr setting metadata: %s", err)
238 }
239
240 result, err := sharesClient.GetMetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetMetaData().(ctx, accountName, shareName)
241 if err != nil {
242 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving metadata: %s", err)
243 }
244
245 if result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.["hello"] != "world" {
246 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected metadata `hello` to be `world` but got: %q", result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.["hello"])
247 }
248 if len(result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.) != 1 {
249 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected metadata to be 1 item but got: %s", result.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetMetaDataResult#MetaData.)
250 }
251
252 acls, err := sharesClient.GetACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetACL().(ctx, accountName, shareName)
253 if err != nil {
254 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving ACL's: %s", err)
255 }
256 if len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.) != 0 {
257 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected 0 identifiers but got %d", len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.))
258 }
259
260 updatedAcls := []SignedIdentifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#{
261 {
262 Idscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#Id.: "abc123",
263 AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#AccessPolicy.: AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#{
264 Startscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Start.: "2020-07-01T08:49:37.0000000Z",
265 Expiryscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Expiry.: "2020-07-01T09:49:37.0000000Z",
266 Permissionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Permission.: "rwd",
267 },
268 },
269 {
270 Idscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#Id.: "bcd234",
271 AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/SignedIdentifier#AccessPolicy.: AccessPolicyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#{
272 Startscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Start.: "2020-07-01T08:49:37.0000000Z",
273 Expiryscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Expiry.: "2020-07-01T09:49:37.0000000Z",
274 Permissionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/AccessPolicy#Permission.: "rwd",
275 },
276 },
277 }
278 _, err = sharesClient.SetACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#SetACL().(ctx, accountName, shareName, updatedAcls)
279 if err != nil {
280 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error setting ACL's: %s", err)
281 }
282
283 acls, err = sharesClient.GetACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#GetACL().(ctx, accountName, shareName)
284 if err != nil {
285 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving ACL's: %s", err)
286 }
287 if len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.) != 2 {
288 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected 2 identifiers but got %d", len(acls.SignedIdentifiersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/GetACLResult#SignedIdentifiers.))
289 }
290
291 _, err = sharesClient.Deletescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/shares`/Client#Delete().(ctx, accountName, shareName, false)
292 if err != nil {
293 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting Share: %s", err)
294 }
295 }