Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev azblob 2 #18820

Merged
merged 15 commits into from
Aug 9, 2022
2 changes: 1 addition & 1 deletion sdk/storage/azblob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ handleError(err)
// Use the bytes.Buffer object to read the downloaded data.
// RetryReaderOptions has a lot of in-depth tuning abilities, but for the sake of simplicity, we'll omit those here.
reader := blobDownloadResponse.BodyReader(nil)
downloadData, err := ioutil.ReadAll(reader)
downloadData, err := io.ReadAll(reader)
handleError(err)

if string(downloadData) != uploadData {
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azblob/blob/lease_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (c *LeaseClient) generated() *generated.BlobClient {
}

// AcquireLease acquires a lease on the blob for write and delete operations.
//The lease Duration must be between 15 and 60 seconds, or infinite (-1).
// The lease Duration must be between 15 and 60 seconds, or infinite (-1).
// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.
func (c *LeaseClient) AcquireLease(ctx context.Context, o *AcquireLeaseOptions) (AcquireLeaseResponse, error) {
blobAcquireLeaseOptions, modifiedAccessConditions := o.format()
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azblob/blockblob/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package blockblob

//nolint
// nolint
const (
// CountToEnd specifies the end of the file
CountToEnd = 0
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azblob/container/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ type ListBlobsFlatOptions struct {

// ---------------------------------------------------------------------------------------------------------------------

//ListBlobsHierarchyOptions provides set of configurations for Client.NewListBlobsHierarchyPager
// ListBlobsHierarchyOptions provides set of configurations for Client.NewListBlobsHierarchyPager
type ListBlobsHierarchyOptions struct {
// Include this parameter to specify one or more datasets to include in the response.
Include []ListBlobsIncludeItem
Expand Down
3 changes: 2 additions & 1 deletion sdk/storage/azblob/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ Examples
// Use the bytes.Buffer object to read the downloaded data.
// RetryReaderOptions has a lot of in-depth tuning abilities, but for the sake of simplicity, we'll omit those here.
reader := blobDownloadResponse.Body(nil)
downloadData, err := ioutil.ReadAll(reader)
downloadData, err := io.ReadAll(reader)

handle(err)
if string(downloadData) != uploadData {
handle(errors.New("Uploaded data should be same as downloaded data"))
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azblob/service/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func NewClientWithSharedKey(serviceURL string, cred *SharedKeyCredential, option
}

// NewClientFromConnectionString creates a service client from the given connection string.
//nolint
// nolint
func NewClientFromConnectionString(connectionString string, options *ClientOptions) (*Client, error) {
parsed, err := shared.ParseConnectionString(connectionString)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions sdk/storage/azblob/zt_access_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"time"
)

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestSetEmptyAccessPolicy() {
_require := require.New(s.T())
testName := s.T().Name()
Expand All @@ -33,7 +33,7 @@ func (s *azblobUnrecordedTestSuite) TestSetEmptyAccessPolicy() {
_require.Nil(err)
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestSetAccessPolicy() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -66,7 +66,7 @@ func (s *azblobUnrecordedTestSuite) TestSetAccessPolicy() {
_require.Nil(err)
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestSetMultipleAccessPolicies() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -119,7 +119,7 @@ func (s *azblobUnrecordedTestSuite) TestSetMultipleAccessPolicies() {
_require.Len(resp.SignedIdentifiers, 3)
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestSetNullAccessPolicy() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down
8 changes: 4 additions & 4 deletions sdk/storage/azblob/zt_append_blob_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"strings"
)

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestAppendBlock() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -57,7 +57,7 @@ func (s *azblobUnrecordedTestSuite) TestAppendBlock() {
_require.Equal(*appendResp.BlobCommittedBlockCount, int32(2))
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestAppendBlockWithMD5() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -201,7 +201,7 @@ func (s *azblobUnrecordedTestSuite) TestAppendBlockWithMD5() {
// downloadResp, err := destBlob.Download(ctx, nil)
// _require.Nil(err)
//
// destData, err := ioutil.ReadAll(downloadresp.BodyReader(nil))
// destData, err := io.ReadAll(downloadresp.BodyReader(nil))
// _require.Nil(err)
// _require.Equal(destData, sourceData)
// _ = downloadresp.BodyReader(nil).Close()
Expand Down Expand Up @@ -296,7 +296,7 @@ func (s *azblobUnrecordedTestSuite) TestAppendBlockWithMD5() {
// // Check data integrity through downloading.
// downloadResp, err := destBlob.Download(ctx, nil)
// _require.Nil(err)
// destData, err := ioutil.ReadAll(downloadResp.BodyReader(nil))
// destData, err := io.ReadAll(downloadResp.BodyReader(nil))
// _require.Nil(err)
// _require.EqualValues(destData, sourceData)
//
Expand Down
30 changes: 15 additions & 15 deletions sdk/storage/azblob/zt_blob_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"
"github.com/stretchr/testify/require"
"io/ioutil"
"io"
"net/url"
"strconv"
"strings"
"time"
)

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestCreateBlobClient() {
_require := require.New(s.T())
testName := s.T().Name()
Expand All @@ -50,7 +50,7 @@ func (s *azblobUnrecordedTestSuite) TestCreateBlobClient() {
_require.Equal(bbClient.URL(), correctURL)
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestCreateBlobClientWithSnapshotAndSAS() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -93,7 +93,7 @@ func (s *azblobUnrecordedTestSuite) TestCreateBlobClientWithSnapshotAndSAS() {
_require.Equal(blobURLParts, correctURL)
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestCreateBlobClientWithSnapshotAndSASUsingConnectionString() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -179,7 +179,7 @@ func (s *azblobTestSuite) TestBlobStartCopyDestEmpty() {
_require.Nil(err)

// Read the blob data to verify the copy
data, err := ioutil.ReadAll(resp.BodyReader(nil))
data, err := io.ReadAll(resp.BodyReader(nil))
_require.Nil(err)
_require.Equal(*resp.ContentLength, int64(len(blockBlobDefaultData)))
_require.Equal(string(data), blockBlobDefaultData)
Expand Down Expand Up @@ -448,14 +448,14 @@ func (s *azblobTestSuite) TestBlobStartCopySourcePrivate() {
// resp2, err := copyBlobClient.Download(ctx, &downloadBlobOptions)
// _require.Nil(err)
//
// data, err := ioutil.ReadAll(resp2.Body(nil))
// data, err := io.ReadAll(resp2.Body(nil))
// _require.Nil(err)
// _require.Equal(*resp2.ContentLength, int64(len(blockBlobDefaultData)))
// _require.Equal(string(data), blockBlobDefaultData)
// _ = resp2.Body(nil).Close()
//}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestBlobStartCopyUsingSASDest() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -1031,7 +1031,7 @@ func (s *azblobTestSuite) TestBlobStartCopyDestIfNoneMatchFalse() {
validateBlobErrorCode(_require, err, bloberror.TargetConditionNotMet)
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestBlobAbortCopyInProgress() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -1626,7 +1626,7 @@ func (s *azblobTestSuite) TestBlobDownloadDataCountZero() {
_require.Nil(err)

// Specifying a count of 0 results in the value being ignored
data, err := ioutil.ReadAll(resp.BodyReader(nil))
data, err := io.ReadAll(resp.BodyReader(nil))
_require.Nil(err)
_require.Equal(string(data), blockBlobDefaultData)
}
Expand Down Expand Up @@ -1654,7 +1654,7 @@ func (s *azblobTestSuite) TestBlobDownloadDataCountExact() {
resp, err := bbClient.Download(ctx, &options)
_require.Nil(err)

data, err := ioutil.ReadAll(resp.BodyReader(nil))
data, err := io.ReadAll(resp.BodyReader(nil))
_require.Nil(err)
_require.Equal(string(data), blockBlobDefaultData)
}
Expand All @@ -1681,7 +1681,7 @@ func (s *azblobTestSuite) TestBlobDownloadDataCountOutOfRange() {
resp, err := bbClient.Download(ctx, &options)
_require.Nil(err)

data, err := ioutil.ReadAll(resp.BodyReader(nil))
data, err := io.ReadAll(resp.BodyReader(nil))
_require.Nil(err)
_require.Equal(string(data), blockBlobDefaultData)
}
Expand Down Expand Up @@ -1709,7 +1709,7 @@ func (s *azblobTestSuite) TestBlobDownloadDataEmptyRangeStruct() {
resp, err := bbClient.Download(ctx, &options)
_require.Nil(err)

data, err := ioutil.ReadAll(resp.BodyReader(nil))
data, err := io.ReadAll(resp.BodyReader(nil))
_require.Nil(err)
_require.Equal(string(data), blockBlobDefaultData)
}
Expand Down Expand Up @@ -3246,7 +3246,7 @@ func (s *azblobTestSuite) TestBlobSetMetadataIfNoneMatchFalse() {
validateBlobErrorCode(_require, err, bloberror.ConditionNotMet)
}

//nolint
// nolint
func testBlobServiceClientDeleteImpl(_ *require.Assertions, _ *service.Client) error {
//containerClient := createNewContainer(_require, "gocblobserviceclientdeleteimpl", svcClient)
//defer deleteContainer(_require, containerClient)
Expand Down Expand Up @@ -3432,14 +3432,14 @@ func (s *azblobTestSuite) TestBlobClientPartsSASQueryTimes() {
// // Verify that we can inject errors first.
// reader := resp.Body(InjectErrorInRetryReaderOptions(errors.New("unrecoverable error")))
//
// _, err = ioutil.ReadAll(reader)
// _, err = io.ReadAll(reader)
// _require.NotNil(err)
// _require.Equal(err.Error(), "unrecoverable error")
//
// // Then inject the retryable error.
// reader = resp.Body(InjectErrorInRetryReaderOptions(io.ErrUnexpectedEOF))
//
// buf, err := ioutil.ReadAll(reader)
// buf, err := io.ReadAll(reader)
// _require.Nil(err)
// _require.EqualValues(buf, []byte(blockBlobDefaultData))
//}
Expand Down
26 changes: 13 additions & 13 deletions sdk/storage/azblob/zt_blob_tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/pageblob"
"github.com/stretchr/testify/require"
"io/ioutil"
"io"
"strings"
)

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestSetBlobTags() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -60,7 +60,7 @@ func (s *azblobUnrecordedTestSuite) TestSetBlobTags() {
}
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestSetBlobTagsWithVID() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -117,7 +117,7 @@ func (s *azblobUnrecordedTestSuite) TestSetBlobTagsWithVID() {
_require.Nil(blobGetTagsResponse.BlobTagSet)
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestUploadBlockBlobWithSpecialCharactersInTags() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -157,7 +157,7 @@ func (s *azblobUnrecordedTestSuite) TestUploadBlockBlobWithSpecialCharactersInTa
}
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestStageBlockWithTags() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -200,7 +200,7 @@ func (s *azblobUnrecordedTestSuite) TestStageBlockWithTags() {

contentResp, err := bbClient.Download(ctx, nil)
_require.Nil(err)
contentData, err := ioutil.ReadAll(contentResp.BodyReader(nil))
contentData, err := io.ReadAll(contentResp.BodyReader(nil))
_require.Nil(err)
_require.EqualValues(contentData, []uint8(strings.Join(data, "")))

Expand Down Expand Up @@ -329,7 +329,7 @@ func (s *azblobUnrecordedTestSuite) TestStageBlockWithTags() {
//
// downloadResp, err := destBlob.Download(ctx, nil)
// _require.Nil(err)
// destData, err := ioutil.ReadAll(downloadResp.BodyReader(nil))
// destData, err := io.ReadAll(downloadResp.BodyReader(nil))
// _require.Nil(err)
// _require.EqualValues(destData, sourceData)
//}
Expand Down Expand Up @@ -402,7 +402,7 @@ func (s *azblobUnrecordedTestSuite) TestStageBlockWithTags() {
//
// downloadResp, err := destBlob.Download(ctx, nil)
// _require.Nil(err)
// destData, err := ioutil.ReadAll(downloadresp.BodyReader(nil))
// destData, err := io.ReadAll(downloadresp.BodyReader(nil))
// _require.Nil(err)
// _require.EqualValues(destData, sourceData)
// _require.Equal(*downloadResp.TagCount, int64(1))
Expand All @@ -423,7 +423,7 @@ func (s *azblobUnrecordedTestSuite) TestStageBlockWithTags() {
// // _require.Equal(resp.RawResponse.StatusCode, 202)
//}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestGetPropertiesReturnsTagsCount() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -455,7 +455,7 @@ func (s *azblobUnrecordedTestSuite) TestGetPropertiesReturnsTagsCount() {
_require.Equal(*downloadResp.TagCount, int64(3))
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestSetBlobTagForSnapshot() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -488,7 +488,7 @@ func (s *azblobUnrecordedTestSuite) TestSetBlobTagForSnapshot() {
}

// TODO: Once new pacer is done.
//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestListBlobReturnsTags() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -733,7 +733,7 @@ func (s *azblobUnrecordedTestSuite) TestCreatePageBlobWithTags() {
}
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestPageBlobSetBlobTagForSnapshot() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down Expand Up @@ -769,7 +769,7 @@ func (s *azblobUnrecordedTestSuite) TestPageBlobSetBlobTagForSnapshot() {
}
}

//nolint
// nolint
func (s *azblobUnrecordedTestSuite) TestCreateAppendBlobWithTags() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down
Loading