| 1 |
package containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ |
| 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 |
"timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 8 |
|
| 9 |
"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`/" |
| 10 |
"github.com/tombuildsstuff/giovanni/storage/internal/authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/auth`/" |
| 11 |
"github.com/tombuildsstuff/giovanni/testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/" |
| 12 |
) |
| 13 |
|
| 14 |
func TestContainerLifecyclescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/TestContainerLifecycle().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 15 |
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) |
| 16 |
if err != nil { |
| 17 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err) |
| 18 |
} |
| 19 |
ctx := contextscip-go gomod github.com/golang/go/src go1.13 context/.TODOscip-go gomod github.com/golang/go/src go1.13 context/TODO().() |
| 20 |
|
| 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 |
containerName := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("cont-%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`/.BlobStoragescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/BlobStorage.) |
| 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 |
containersClient := NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/NewWithEnvironment().(client.Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment.) |
| 33 |
containersClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#Client. = client.PrepareWithAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithAuthorizer().(containersClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#Client., storageAuth) |
| 34 |
|
| 35 |
// first let's test an empty container |
| 36 |
input := CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/CreateInput#{} |
| 37 |
_, err = containersClient.Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#Create().(ctx, accountName, containerName, input) |
| 38 |
if err != nil { |
| 39 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error creating: %s", err)) |
| 40 |
} |
| 41 |
|
| 42 |
container, err := containersClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#GetProperties().(ctx, accountName, containerName) |
| 43 |
if err != nil { |
| 44 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error retrieving: %s", err)) |
| 45 |
} |
| 46 |
|
| 47 |
if container.AccessLevelscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#AccessLevel. != Privatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Private. { |
| 48 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Access Level to be Private but got %q", container.AccessLevelscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#AccessLevel.) |
| 49 |
} |
| 50 |
if len(container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.) != 0 { |
| 51 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected MetaData to be empty but got: %s", container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.) |
| 52 |
} |
| 53 |
if container.LeaseStatusscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#LeaseStatus. != Unlockedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Unlocked. { |
| 54 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Container Lease to be Unlocked but was: %s", container.LeaseStatusscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#LeaseStatus.) |
| 55 |
} |
| 56 |
|
| 57 |
// then update the metadata |
| 58 |
metaData := map[string]string{ |
| 59 |
"dont": "kill-my-vibe", |
| 60 |
} |
| 61 |
_, err = containersClient.SetMetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#SetMetaData().(ctx, accountName, containerName, metaData) |
| 62 |
if err != nil { |
| 63 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error updating metadata: %s", err)) |
| 64 |
} |
| 65 |
|
| 66 |
// give azure time to replicate |
| 67 |
timescip-go gomod github.com/golang/go/src go1.13 time/.Sleepscip-go gomod github.com/golang/go/src go1.13 time/Sleep().(2 * timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 68 |
|
| 69 |
// then assert that |
| 70 |
container, err = containersClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#GetProperties().(ctx, accountName, containerName) |
| 71 |
if err != nil { |
| 72 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error re-retrieving: %s", err)) |
| 73 |
} |
| 74 |
if len(container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.) != 1 { |
| 75 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected 1 item in the metadata but got: %s", container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.) |
| 76 |
} |
| 77 |
if container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.["dont"] != "kill-my-vibe" { |
| 78 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected `kill-my-vibe` but got %q", container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.["dont"]) |
| 79 |
} |
| 80 |
if container.AccessLevelscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#AccessLevel. != Privatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Private. { |
| 81 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Access Level to be Private but got %q", container.AccessLevelscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#AccessLevel.) |
| 82 |
} |
| 83 |
if container.LeaseStatusscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#LeaseStatus. != Unlockedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Unlocked. { |
| 84 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Container Lease to be Unlocked but was: %s", container.LeaseStatusscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#LeaseStatus.) |
| 85 |
} |
| 86 |
|
| 87 |
// then update the ACL |
| 88 |
_, err = containersClient.SetAccessControlscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#SetAccessControl().(ctx, accountName, containerName, Blobscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Blob.) |
| 89 |
if err != nil { |
| 90 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error updating ACL's: %s", err)) |
| 91 |
} |
| 92 |
|
| 93 |
// give azure some time to replicate |
| 94 |
timescip-go gomod github.com/golang/go/src go1.13 time/.Sleepscip-go gomod github.com/golang/go/src go1.13 time/Sleep().(2 * timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 95 |
|
| 96 |
// then assert that |
| 97 |
container, err = containersClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#GetProperties().(ctx, accountName, containerName) |
| 98 |
if err != nil { |
| 99 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error re-retrieving: %s", err)) |
| 100 |
} |
| 101 |
if container.AccessLevelscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#AccessLevel. != Blobscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Blob. { |
| 102 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Access Level to be Blob but got %q", container.AccessLevelscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#AccessLevel.) |
| 103 |
} |
| 104 |
if len(container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.) != 1 { |
| 105 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected 1 item in the metadata but got: %s", container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#MetaData.) |
| 106 |
} |
| 107 |
if container.LeaseStatusscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#LeaseStatus. != Unlockedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Unlocked. { |
| 108 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected Container Lease to be Unlocked but was: %s", container.LeaseStatusscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ContainerProperties#LeaseStatus.) |
| 109 |
} |
| 110 |
|
| 111 |
// acquire a lease for 30s |
| 112 |
acquireLeaseInput := AcquireLeaseInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/AcquireLeaseInput#{ |
| 113 |
LeaseDurationscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/AcquireLeaseInput#LeaseDuration.: 30, |
| 114 |
} |
| 115 |
acquireLeaseResp, err := containersClient.AcquireLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#AcquireLease().(ctx, accountName, containerName, acquireLeaseInput) |
| 116 |
if err != nil { |
| 117 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error acquiring lease: %s", err) |
| 118 |
} |
| 119 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Lease ID: %s", acquireLeaseResp.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/AcquireLeaseResponse#LeaseID.) |
| 120 |
|
| 121 |
// we should then be able to update the ID |
| 122 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Changing lease..") |
| 123 |
updateLeaseInput := ChangeLeaseInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ChangeLeaseInput#{ |
| 124 |
ExistingLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ChangeLeaseInput#ExistingLeaseID.: acquireLeaseResp.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/AcquireLeaseResponse#LeaseID., |
| 125 |
ProposedLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ChangeLeaseInput#ProposedLeaseID.: "aaaabbbb-aaaa-bbbb-cccc-aaaabbbbcccc", |
| 126 |
} |
| 127 |
updateLeaseResp, err := containersClient.ChangeLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#ChangeLease().(ctx, accountName, containerName, updateLeaseInput) |
| 128 |
if err != nil { |
| 129 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error changing lease: %s", err) |
| 130 |
} |
| 131 |
|
| 132 |
// then renew it |
| 133 |
_, err = containersClient.RenewLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#RenewLease().(ctx, accountName, containerName, updateLeaseResp.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ChangeLeaseResponse#LeaseID.) |
| 134 |
if err != nil { |
| 135 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error renewing lease: %s", err) |
| 136 |
} |
| 137 |
|
| 138 |
// and then give it a timeout |
| 139 |
breakPeriod := 20 |
| 140 |
breakLeaseInput := BreakLeaseInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/BreakLeaseInput#{ |
| 141 |
LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/BreakLeaseInput#LeaseID.: updateLeaseResp.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ChangeLeaseResponse#LeaseID., |
| 142 |
BreakPeriodscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/BreakLeaseInput#BreakPeriod.: &breakPeriod, |
| 143 |
} |
| 144 |
breakLeaseResp, err := containersClient.BreakLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#BreakLease().(ctx, accountName, containerName, breakLeaseInput) |
| 145 |
if err != nil { |
| 146 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error breaking lease: %s", err) |
| 147 |
} |
| 148 |
if breakLeaseResp.LeaseTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/BreakLeaseResponse#LeaseTime. == 0 { |
| 149 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Lease broke immediately when should have waited: %d", breakLeaseResp.LeaseTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/BreakLeaseResponse#LeaseTime.) |
| 150 |
} |
| 151 |
|
| 152 |
// and finally ditch it |
| 153 |
_, err = containersClient.ReleaseLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#ReleaseLease().(ctx, accountName, containerName, updateLeaseResp.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ChangeLeaseResponse#LeaseID.) |
| 154 |
if err != nil { |
| 155 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error releasing lease: %s", err) |
| 156 |
} |
| 157 |
|
| 158 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Listing blobs in the container..") |
| 159 |
listInput := ListBlobsInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ListBlobsInput#{} |
| 160 |
listResult, err := containersClient.ListBlobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#ListBlobs().(ctx, accountName, containerName, listInput) |
| 161 |
if err != nil { |
| 162 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error listing blobs: %s", err) |
| 163 |
} |
| 164 |
|
| 165 |
if len(listResult.Blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ListBlobsResult#Blobs..Blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Blobs#Blobs.) != 0 { |
| 166 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected there to be no blobs in the container but got %d", len(listResult.Blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/ListBlobsResult#Blobs..Blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Blobs#Blobs.)) |
| 167 |
} |
| 168 |
|
| 169 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Deleting..") |
| 170 |
_, err = containersClient.Deletescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#Delete().(ctx, accountName, containerName) |
| 171 |
if err != nil { |
| 172 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error deleting: %s", err)) |
| 173 |
} |
| 174 |
} |