Debian Codegraph @

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