| 1 |
package blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/ |
| 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 |
"net/httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/" |
| 7 |
"testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 8 |
"timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 9 |
|
| 10 |
"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`/" |
| 11 |
"github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/" |
| 12 |
"github.com/tombuildsstuff/giovanni/storage/internal/authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/auth`/" |
| 13 |
"github.com/tombuildsstuff/giovanni/testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/" |
| 14 |
) |
| 15 |
|
| 16 |
func TestSnapshotLifecyclescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/TestSnapshotLifecycle().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 17 |
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) |
| 18 |
if err != nil { |
| 19 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err) |
| 20 |
} |
| 21 |
ctx := contextscip-go gomod github.com/golang/go/src go1.13 context/.TODOscip-go gomod github.com/golang/go/src go1.13 context/TODO().() |
| 22 |
|
| 23 |
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().()) |
| 24 |
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().()) |
| 25 |
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().()) |
| 26 |
fileName := "example.txt" |
| 27 |
|
| •28 |
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.) |
| 29 |
if err != nil { |
| 30 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err) |
| 31 |
} |
| 32 |
defer client.DestroyTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#DestroyTestResources().(ctx, resourceGroup, accountName) |
| 33 |
|
| 34 |
containersClient := containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/.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.) |
| 35 |
containersClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#Client. = client.PrepareWithStorageResourceManagerAuthscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithStorageResourceManagerAuth().(containersClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#Client.) |
| 36 |
|
| 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, containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/.CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/CreateInput#{}) |
| 38 |
if err != nil { |
| 39 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error creating: %s", err) |
| 40 |
} |
| 41 |
defer containersClient.Deletescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/containers`/Client#Delete().(ctx, accountName, containerName) |
| 42 |
|
| 43 |
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.) |
| 44 |
blobClient := NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/NewWithEnvironment().(client.Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment.) |
| 45 |
blobClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Client. = client.PrepareWithAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithAuthorizer().(blobClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Client., storageAuth) |
| 46 |
|
| 47 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Copying file to Blob Storage..") |
| 48 |
copyInput := CopyInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/CopyInput#{ |
| 49 |
CopySourcescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/CopyInput#CopySource.: "http://releases.ubuntu.com/14.04/ubuntu-14.04.6-desktop-amd64.iso", |
| 50 |
} |
| 51 |
|
| 52 |
refreshInterval := 5 * timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second. |
| 53 |
if err := blobClient.CopyAndWaitscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#CopyAndWait().(ctx, accountName, containerName, fileName, copyInput, refreshInterval); err != nil { |
| 54 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error copying: %s", err) |
| 55 |
} |
| 56 |
|
| 57 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] First Snapshot..") |
| 58 |
firstSnapshot, err := blobClient.Snapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Snapshot().(ctx, accountName, containerName, fileName, SnapshotInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#{}) |
| 59 |
if err != nil { |
| 60 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error taking first snapshot: %s", err) |
| 61 |
} |
| 62 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] First Snapshot ID: %q", firstSnapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotResult#SnapshotDateTime.) |
| 63 |
|
| 64 |
t.Logscip-go gomod github.com/golang/go/src go1.13 testing/common#Log().("[DEBUG] Waiting 2 seconds..") |
| 65 |
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.) |
| 66 |
|
| 67 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Second Snapshot..") |
| 68 |
secondSnapshot, err := blobClient.Snapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Snapshot().(ctx, accountName, containerName, fileName, SnapshotInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#{ |
| 69 |
MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#MetaData.: map[string]string{ |
| 70 |
"hello": "world", |
| 71 |
}, |
| 72 |
}) |
| 73 |
if err != nil { |
| 74 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error taking Second snapshot: %s", err) |
| 75 |
} |
| 76 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Second Snapshot ID: %q", secondSnapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotResult#SnapshotDateTime.) |
| 77 |
|
| 78 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Leasing the Blob..") |
| 79 |
leaseDetails, err := blobClient.AcquireLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#AcquireLease().(ctx, accountName, containerName, fileName, AcquireLeaseInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/AcquireLeaseInput#{ |
| 80 |
// infinite |
| 81 |
LeaseDurationscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/AcquireLeaseInput#LeaseDuration.: -1, |
| 82 |
}) |
| 83 |
if err != nil { |
| 84 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error leasing Blob: %s", err) |
| 85 |
} |
| 86 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Lease ID: %q", leaseDetails.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/AcquireLeaseResult#LeaseID.) |
| 87 |
|
| 88 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Third Snapshot..") |
| 89 |
thirdSnapshot, err := blobClient.Snapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Snapshot().(ctx, accountName, containerName, fileName, SnapshotInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#{ |
| 90 |
LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#LeaseID.: &leaseDetails.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/AcquireLeaseResult#LeaseID., |
| 91 |
}) |
| 92 |
if err != nil { |
| 93 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error taking Third snapshot: %s", err) |
| 94 |
} |
| 95 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Third Snapshot ID: %q", thirdSnapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotResult#SnapshotDateTime.) |
| 96 |
|
| 97 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Releasing Lease..") |
| 98 |
if _, err := blobClient.ReleaseLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#ReleaseLease().(ctx, accountName, containerName, fileName, leaseDetails.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/AcquireLeaseResult#LeaseID.); err != nil { |
| 99 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error releasing Lease: %s", err) |
| 100 |
} |
| 101 |
|
| 102 |
// get the properties from the blob, which should include the LastModifiedDate |
| 103 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Retrieving Properties for Blob") |
| 104 |
props, err := blobClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#GetProperties().(ctx, accountName, containerName, fileName, GetPropertiesInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/GetPropertiesInput#{}) |
| 105 |
if err != nil { |
| 106 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error getting properties: %s", err) |
| 107 |
} |
| 108 |
|
| 109 |
// confirm that the If-Modified-None returns an error |
| 110 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Third Snapshot..") |
| 111 |
fourthSnapshot, err := blobClient.Snapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Snapshot().(ctx, accountName, containerName, fileName, SnapshotInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#{ |
| 112 |
LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#LeaseID.: &leaseDetails.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/AcquireLeaseResult#LeaseID., |
| 113 |
IfModifiedSincescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotInput#IfModifiedSince.: &props.LastModifiedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/GetPropertiesResult#LastModified., |
| 114 |
}) |
| 115 |
if err == nil { |
| 116 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected an error but didn't get one") |
| 117 |
} |
| 118 |
if fourthSnapshot.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotResult#Response..StatusCodescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#StatusCode. != httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.StatusPreconditionFailedscip-go gomod github.com/golang/go/src go1.13 `net/http`/StatusPreconditionFailed. { |
| 119 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected the status code to be Precondition Failed but got: %d", fourthSnapshot.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotResult#Response..StatusCodescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#StatusCode.) |
| 120 |
} |
| 121 |
|
| 122 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Retrieving the Second Snapshot Properties..") |
| 123 |
getSecondSnapshotInput := GetSnapshotPropertiesInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/GetSnapshotPropertiesInput#{ |
| 124 |
SnapshotIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/GetSnapshotPropertiesInput#SnapshotID.: secondSnapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotResult#SnapshotDateTime., |
| 125 |
} |
| 126 |
if _, err := blobClient.GetSnapshotPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#GetSnapshotProperties().(ctx, accountName, containerName, fileName, getSecondSnapshotInput); err != nil { |
| 127 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error retrieving properties for the second snapshot: %s", err) |
| 128 |
} |
| 129 |
|
| 130 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Deleting the Second Snapshot..") |
| 131 |
deleteSnapshotInput := DeleteSnapshotInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/DeleteSnapshotInput#{ |
| 132 |
SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/DeleteSnapshotInput#SnapshotDateTime.: secondSnapshot.SnapshotDateTimescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/SnapshotResult#SnapshotDateTime., |
| 133 |
} |
| 134 |
if _, err := blobClient.DeleteSnapshotscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#DeleteSnapshot().(ctx, accountName, containerName, fileName, deleteSnapshotInput); err != nil { |
| 135 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting snapshot: %s", err) |
| 136 |
} |
| 137 |
|
| 138 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Re-Retrieving the Second Snapshot Properties..") |
| 139 |
secondSnapshotProps, err := blobClient.GetSnapshotPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#GetSnapshotProperties().(ctx, accountName, containerName, fileName, getSecondSnapshotInput) |
| 140 |
if err == nil { |
| 141 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected an error retrieving the snapshot but got none") |
| 142 |
} |
| 143 |
if secondSnapshotProps.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/GetPropertiesResult#Response..StatusCodescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#StatusCode. != httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.13 `net/http`/StatusNotFound. { |
| 144 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected the status code to be %d but got %q", httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src go1.13 `net/http`/StatusNoContent., secondSnapshotProps.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/GetPropertiesResult#Response..StatusCodescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#StatusCode.) |
| 145 |
} |
| 146 |
|
| 147 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Deleting all the snapshots..") |
| 148 |
if _, err := blobClient.DeleteSnapshotsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#DeleteSnapshots().(ctx, accountName, containerName, fileName, DeleteSnapshotsInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/DeleteSnapshotsInput#{}); err != nil { |
| 149 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting snapshots: %s", err) |
| 150 |
} |
| 151 |
|
| 152 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Deleting the Blob..") |
| 153 |
deleteInput := DeleteInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/DeleteInput#{ |
| 154 |
DeleteSnapshotsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/DeleteInput#DeleteSnapshots.: false, |
| 155 |
} |
| 156 |
if _, err := blobClient.Deletescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Delete().(ctx, accountName, containerName, fileName, deleteInput); err != nil { |
| 157 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting Blob: %s", err) |
| 158 |
} |
| 159 |
} |