Skip to content

Commit

Permalink
v0.14.0 Release (#281)
Browse files Browse the repository at this point in the history
* Removed requestId, Timeout, versionId, snapshot from the function signature of GetTags() and SetTags() (#252)

* Changed the function signature of getTags and setTags

* Minor Adjustment

* Review - 1

* Adding Support for PutBlobFromUrl (#251)

* Regenerate SDK

* Regenerate SDK with proper version

* Adding support for PutBlobFromURL

* Correcting regen code and handling other errors

* Resolving comments on PR

* Correcting SetTags method

* Updating tests with GetTags and SetTags

* Remove swagger/Go_BlobStorage/code-model-v1

* Checks value of metadata & reorganized tests

Co-authored-by: Adele Reed <[email protected]>

* Keep compatibility with Go 1.13.14. (#264)

* - Keep compliance with Golang 1.13.14. http.Header has no method Values
  on older go versions.

* Do not return error when client request id is missing

* Adding MSI Login Example (#241)

* Added MSI login example

* Minor edits

Co-authored-by: zezha-msft <[email protected]>

* Offer Knob to Disable Syslog | Default logging to syslog enabled (#268)

* Provide Knob For Syslog

* Reverting changes to GetTags/SetTags & BlobPropertiesInternal (#269)

* Adding MSI Login Example (#241)

* Added MSI login example

* Minor edits

Co-authored-by: zezha-msft <[email protected]>

* Reverting changes to GetTags/SetTags & BlobPropertiesInternal

Co-authored-by: Mohit Sharma <[email protected]>
Co-authored-by: zezha-msft <[email protected]>

Co-authored-by: siminsavani-msft <[email protected]>
Co-authored-by: zezha-msft <[email protected]>

* Update go dependencies

* Resolving Concurrency Issues  (#275)

* Resolving concurrency issues

* Fixing concurrency test

* Minor changes

* Incremented version and added to changelog

* Updated version to 0.14

Co-authored-by: Mohit Sharma <[email protected]>
Co-authored-by: Adele Reed <[email protected]>
Co-authored-by: Sreejith Kesavan <[email protected]>
Co-authored-by: zezha-msft <[email protected]>
Co-authored-by: Yang Peng <[email protected]>
  • Loading branch information
6 people authored Jul 2, 2021
1 parent d80c8c7 commit e8074e1
Show file tree
Hide file tree
Showing 27 changed files with 1,947 additions and 400 deletions.
8 changes: 8 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

> See [BreakingChanges](BreakingChanges.md) for a detailed list of API breaks.
## Version 0.14.0:
- Updated [Get Blob Tags](https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags) and [Set Blob Tags](https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags) function signatures
- Added [Put Blob From URL](https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob-from-url)
- Offer knob to disable application logging (Syslog)
- Added examples for MSI Login
- Updated go.mod to address dependency issues
- Fixed issues [#260](https://github.com/Azure/azure-storage-blob-go/issues/260) and [#257](https://github.com/Azure/azure-storage-blob-go/issues/257)

## Version 0.13.0:
- Validate echoed client request ID from the service
- Added new TransferManager option for UploadStreamToBlockBlob to fine-tune the concurrency and memory usage
Expand Down
1 change: 1 addition & 0 deletions azblob/chunkwriting.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func copyFromReader(ctx context.Context, from io.Reader, to blockWriter, o Uploa
}
// If the error is not EOF, then we have a problem.
if err != nil && !errors.Is(err, io.EOF) {
cp.wg.Wait()
return nil, err
}

Expand Down
13 changes: 7 additions & 6 deletions azblob/url_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,22 @@ func (b BlobURL) Delete(ctx context.Context, deleteOptions DeleteSnapshotsOption
return b.blobClient.Delete(ctx, nil, nil, nil, ac.LeaseAccessConditions.pointers(), deleteOptions,
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag,
nil, // Blob ifTags
nil)
nil, BlobDeleteNone)
}

// SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot.
// Each call to this operation replaces all existing tags attached to the blob.
// To remove all tags from the blob, call this operation with no tags set.
// https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags
func (b BlobURL) SetTags(ctx context.Context, timeout *int32, versionID *string, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, requestID *string, ifTags *string, blobTagsMap BlobTagsMap) (*BlobSetTagsResponse, error) {
func (b BlobURL) SetTags(ctx context.Context, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, ifTags *string, blobTagsMap BlobTagsMap) (*BlobSetTagsResponse, error) {
tags := SerializeBlobTags(blobTagsMap)
return b.blobClient.SetTags(ctx, timeout, versionID, transactionalContentMD5, transactionalContentCrc64, requestID, ifTags, &tags)
return b.blobClient.SetTags(ctx, nil, nil, transactionalContentMD5, transactionalContentCrc64, nil, ifTags, nil, &tags)
}

// GetTags operation enables users to get tags on a blob or specific blob version, or snapshot.
// https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags
func (b BlobURL) GetTags(ctx context.Context, timeout *int32, requestID *string, snapshot *string, versionID *string, ifTags *string) (*BlobTags, error) {
return b.blobClient.GetTags(ctx, timeout, requestID, snapshot, versionID, ifTags)
func (b BlobURL) GetTags(ctx context.Context, ifTags *string) (*BlobTags, error) {
return b.blobClient.GetTags(ctx, nil, nil, nil, nil, ifTags, nil)
}

// Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots.
Expand All @@ -173,7 +173,8 @@ func (b BlobURL) Undelete(ctx context.Context) (*BlobUndeleteResponse, error) {
func (b BlobURL) SetTier(ctx context.Context, tier AccessTierType, lac LeaseAccessConditions) (*BlobSetTierResponse, error) {
return b.blobClient.SetTier(ctx, tier, nil,
nil, // Blob versioning
nil, RehydratePriorityNone, nil, lac.pointers())
nil, RehydratePriorityNone, nil, lac.pointers(),
nil) // Blob ifTags
}

// GetProperties returns the blob's properties.
Expand Down
18 changes: 17 additions & 1 deletion azblob/url_block_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@ func (bb BlockBlobURL) CopyFromURL(ctx context.Context, source url.URL, metadata
nil, // Blob ifTags
dstLeaseID, nil, srcContentMD5,
blobTagsString, // Blob tags
nil, // seal Blob
)
}

// PutBlobFromURL synchronously creates a new Block Blob with data from the source URL up to a max length of 256MB.
// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob-from-url.
func (bb BlockBlobURL) PutBlobFromURL(ctx context.Context, h BlobHTTPHeaders, source url.URL, metadata Metadata, srcac ModifiedAccessConditions, dstac BlobAccessConditions, srcContentMD5 []byte, dstContentMD5 []byte, tier AccessTierType, blobTagsMap BlobTagsMap, cpk ClientProvidedKeyOptions) (*BlockBlobPutBlobFromURLResponse, error) {

srcIfModifiedSince, srcIfUnmodifiedSince, srcIfMatchETag, srcIfNoneMatchETag := srcac.pointers()
dstIfModifiedSince, dstIfUnmodifiedSince, dstIfMatchETag, dstIfNoneMatchETag := dstac.ModifiedAccessConditions.pointers()
dstLeaseID := dstac.LeaseAccessConditions.pointers()
blobTagsString := SerializeBlobTagsHeader(blobTagsMap)

return bb.bbClient.PutBlobFromURL(ctx, 0, source.String(), nil, nil,
&h.ContentType, &h.ContentEncoding, &h.ContentLanguage, dstContentMD5, &h.CacheControl,
metadata, dstLeaseID, &h.ContentDisposition, cpk.EncryptionKey, cpk.EncryptionKeySha256,
cpk.EncryptionAlgorithm, cpk.EncryptionScope, tier, dstIfModifiedSince, dstIfUnmodifiedSince,
dstIfMatchETag, dstIfNoneMatchETag, nil, srcIfModifiedSince, srcIfUnmodifiedSince,
srcIfMatchETag, srcIfNoneMatchETag, nil, nil, srcContentMD5, blobTagsString, nil)
}
8 changes: 4 additions & 4 deletions azblob/url_page_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (pb PageBlobURL) ClearPages(ctx context.Context, offset int64, count int64,
cpk.EncryptionKey, cpk.EncryptionKeySha256, cpk.EncryptionAlgorithm, // CPK
cpk.EncryptionScope, // CPK-N
ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan,
ifSequenceNumberEqual, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
ifSequenceNumberEqual, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, nil)
}

// GetPageRanges returns the list of valid page ranges for a page blob or snapshot of a page blob.
Expand Down Expand Up @@ -175,7 +175,7 @@ func (pb PageBlobURL) Resize(ctx context.Context, size int64, ac BlobAccessCondi
return pb.pbClient.Resize(ctx, size, nil, ac.LeaseAccessConditions.pointers(),
cpk.EncryptionKey, cpk.EncryptionKeySha256, cpk.EncryptionAlgorithm, // CPK
cpk.EncryptionScope, // CPK-N
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, nil)
}

// UpdateSequenceNumber sets the page blob's sequence number.
Expand All @@ -188,7 +188,7 @@ func (pb PageBlobURL) UpdateSequenceNumber(ctx context.Context, action SequenceN
ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch := ac.ModifiedAccessConditions.pointers()
return pb.pbClient.UpdateSequenceNumber(ctx, action, nil,
ac.LeaseAccessConditions.pointers(), ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch,
sn, nil)
nil, sn, nil)
}

// StartCopyIncremental begins an operation to start an incremental copy from one page blob's snapshot to this page blob.
Expand All @@ -202,7 +202,7 @@ func (pb PageBlobURL) StartCopyIncremental(ctx context.Context, source url.URL,
qp.Set("snapshot", snapshot)
source.RawQuery = qp.Encode()
return pb.pbClient.CopyIncremental(ctx, source.String(), nil,
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, nil)
}

func (pr PageRange) pointers() *string {
Expand Down
2 changes: 1 addition & 1 deletion azblob/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package azblob

const serviceLibVersion = "0.13"
const serviceLibVersion = "0.14"
12 changes: 9 additions & 3 deletions azblob/zc_policy_request_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ type RequestLogOptions struct {
// LogWarningIfTryOverThreshold logs a warning if a tried operation takes longer than the specified
// duration (-1=no logging; 0=default threshold).
LogWarningIfTryOverThreshold time.Duration

// SyslogDisabled is a flag to check if logging to Syslog/Windows-Event-Logger is enabled or not
// We by default print to Syslog/Windows-Event-Logger.
// If SyslogDisabled is not provided explicitly, the default value will be false.
SyslogDisabled bool
}

func (o RequestLogOptions) defaults() RequestLogOptions {
Expand Down Expand Up @@ -59,7 +64,7 @@ func NewRequestLogPolicyFactory(o RequestLogOptions) pipeline.Factory {
// If the response took too long, we'll upgrade to warning.
if o.LogWarningIfTryOverThreshold > 0 && tryDuration > o.LogWarningIfTryOverThreshold {
// Log a warning if the try duration exceeded the specified threshold
logLevel, forceLog = pipeline.LogWarning, true
logLevel, forceLog = pipeline.LogWarning, !o.SyslogDisabled
}

var sc int
Expand All @@ -73,8 +78,9 @@ func NewRequestLogPolicyFactory(o RequestLogOptions) pipeline.Factory {
}
}

if sc == 0 || ((sc >= 400 && sc <= 499) && sc != http.StatusNotFound && sc != http.StatusConflict && sc != http.StatusPreconditionFailed && sc != http.StatusRequestedRangeNotSatisfiable) || (sc >= 500 && sc <= 599) {
logLevel, forceLog = pipeline.LogError, true // Promote to Error any 4xx (except those listed is an error) or any 5xx
if sc == 0 || ((sc >= 400 && sc <= 499) && sc != http.StatusNotFound && sc != http.StatusConflict &&
sc != http.StatusPreconditionFailed && sc != http.StatusRequestedRangeNotSatisfiable) || (sc >= 500 && sc <= 599) {
logLevel, forceLog = pipeline.LogError, !o.SyslogDisabled // Promote to Error any 4xx (except those listed is an error) or any 5xx
} else {
// For other status codes, we leave the level as is.
}
Expand Down
9 changes: 4 additions & 5 deletions azblob/zc_policy_unique_request_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package azblob
import (
"context"
"errors"

"github.com/Azure/azure-pipeline-go/pipeline"
)

Expand All @@ -21,11 +22,9 @@ func NewUniqueRequestIDPolicyFactory() pipeline.Factory {
resp, err := next.Do(ctx, request)

if err == nil && resp != nil {
val := resp.Response().Header.Values(xMsClientRequestID)
if len(val) > 0 {
if val[0] != id {
err = errors.New("client Request ID from request and response does not match")
}
crId := resp.Response().Header.Get(xMsClientRequestID)
if crId != "" && crId != id {
err = errors.New("client Request ID from request and response does not match")
}
}

Expand Down
56 changes: 35 additions & 21 deletions azblob/zt_blob_tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func (s *aztestsSuite) TestSetBlobTags(c *chk.C) {
blockBlobUploadResp, err := blobURL.Upload(ctx, bytes.NewReader([]byte("data")), BlobHTTPHeaders{}, basicMetadata, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(blockBlobUploadResp.StatusCode(), chk.Equals, 201)
blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)

blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
Expand Down Expand Up @@ -60,19 +60,21 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID(c *chk.C) {
c.Assert(blockBlobUploadResp.StatusCode(), chk.Equals, 201)
versionId2 := blockBlobUploadResp.VersionID()

blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, &versionId1, nil, nil, nil, nil, blobTagsMap)
blobURL1 := blobURL.WithVersionID(versionId1)
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)

blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, &versionId1, nil)
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
for _, blobTag := range blobGetTagsResponse.BlobTagSet {
c.Assert(blobTagsMap[blobTag.Key], chk.Equals, blobTag.Value)
}

blobGetTagsResponse, err = blobURL.GetTags(ctx, nil, nil, nil, &versionId2, nil)
blobURL2 := blobURL.WithVersionID(versionId2)
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.IsNil)
Expand Down Expand Up @@ -100,11 +102,12 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID2(c *chk.C) {
"Javascript": "Android",
}

blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, &versionId1, nil, nil, nil, nil, blobTags1)
blobURL1 := blobURL.WithVersionID(versionId1)
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, blobTags1)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)

blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, &versionId1, nil)
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
Expand All @@ -116,11 +119,13 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID2(c *chk.C) {
"a123": "321a",
"b234": "432b",
}
blobSetTagsResponse, err = blobURL.SetTags(ctx, nil, &versionId2, nil, nil, nil, nil, blobTags2)

blobURL2 := blobURL.WithVersionID(versionId2)
blobSetTagsResponse, err = blobURL2.SetTags(ctx, nil, nil, nil, blobTags2)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)

blobGetTagsResponse, err = blobURL.GetTags(ctx, nil, nil, nil, &versionId2, nil)
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.NotNil)
Expand All @@ -143,7 +148,7 @@ func (s *aztestsSuite) TestUploadBlockBlobWithSpecialCharactersInTags(c *chk.C)
c.Assert(err, chk.IsNil)
c.Assert(blockBlobUploadResp.StatusCode(), chk.Equals, 201)

blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
Expand Down Expand Up @@ -192,15 +197,16 @@ func (s *aztestsSuite) TestStageBlockWithTags(c *chk.C) {
contentData, err := ioutil.ReadAll(contentResp.Body(RetryReaderOptions{}))
c.Assert(contentData, chk.DeepEquals, []uint8(strings.Join(data, "")))

blobGetTagsResp, err := blobURL.GetTags(ctx, nil, nil, nil, &versionId, nil)
blobURL1 := blobURL.WithVersionID(versionId)
blobGetTagsResp, err := blobURL1.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp, chk.NotNil)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
for _, blobTag := range blobGetTagsResp.BlobTagSet {
c.Assert(blobTagsMap[blobTag.Key], chk.Equals, blobTag.Value)
}

blobGetTagsResp, err = blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
blobGetTagsResp, err = blobURL.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp, chk.NotNil)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
Expand Down Expand Up @@ -284,7 +290,7 @@ func (s *aztestsSuite) TestStageBlockFromURLWithTags(c *chk.C) {
c.Assert(err, chk.IsNil)
c.Assert(destData, chk.DeepEquals, sourceData)

blobGetTagsResp, err := destBlob.GetTags(ctx, nil, nil, nil, nil, nil)
blobGetTagsResp, err := destBlob.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
for _, blobTag := range blobGetTagsResp.BlobTagSet {
Expand Down Expand Up @@ -396,7 +402,7 @@ func (s *aztestsSuite) TestSetBlobTagForSnapshot(c *chk.C) {
"Storage+SDK": "SDK/GO",
"GO ": ".Net",
}
_, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
_, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)

resp, err := blobURL.CreateSnapshot(ctx, nil, BlobAccessConditions{}, ClientProvidedKeyOptions{})
Expand Down Expand Up @@ -427,7 +433,7 @@ func (s *aztestsSuite) TestCreatePageBlobWithTags(c *chk.C) {
c.Assert(putResp.Version(), chk.Not(chk.Equals), "")
c.Assert(putResp.rawResponse.Header.Get("x-ms-version-id"), chk.NotNil)

setTagResp, err := blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)

Expand All @@ -441,7 +447,7 @@ func (s *aztestsSuite) TestCreatePageBlobWithTags(c *chk.C) {
"b0l1o2b3": "s0d1k2",
}

setTagResp, err = blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, modifiedBlobTags)
setTagResp, err = blob.SetTags(ctx, nil, nil, nil, modifiedBlobTags)
c.Assert(err, chk.IsNil)
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)

Expand Down Expand Up @@ -476,7 +482,7 @@ func (s *aztestsSuite) TestSetTagOnPageBlob(c *chk.C) {
"b0l1o2b3": "s0d1k2",
}

setTagResp, err := blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, modifiedBlobTags)
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, modifiedBlobTags)
c.Assert(err, chk.IsNil)
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)

Expand Down Expand Up @@ -513,7 +519,7 @@ func (s *aztestsSuite) TestListBlobReturnsTags(c *chk.C) {
"tag2": "+-./:=_",
"+-./:=_1": "+-./:=_",
}
resp, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
resp, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(resp.StatusCode(), chk.Equals, 204)

Expand Down Expand Up @@ -576,7 +582,15 @@ func (s *aztestsSuite) TestFindBlobsByTags(c *chk.C) {
c.Assert(err, chk.IsNil)

for _, blob := range lResp.Blobs {
c.Assert(blob.TagValue, chk.Equals, "firsttag")
containsTag := false

for _, tag := range blob.Tags.BlobTagSet {
if tag.Value == "firsttag" {
containsTag = true
}
}

c.Assert(containsTag, chk.Equals, true)
}
}

Expand Down Expand Up @@ -618,11 +632,11 @@ func (s *aztestsSuite) TestFilterBlobsUsingAccountSAS(c *chk.C) {
}

blobTagsMap := BlobTagsMap{"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"}
setBlobTagsResp, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
setBlobTagsResp, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(setBlobTagsResp.StatusCode(), chk.Equals, 204)

blobGetTagsResp, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
blobGetTagsResp, err := blobURL.GetTags(ctx, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
Expand Down
Loading

0 comments on commit e8074e1

Please sign in to comment.