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

Revert test change - new file handle open on downloadfile #22373

Merged
merged 5 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/storage/azdatalake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Escape paths for NewDirectoryClient and NewFileClient in a file system. Fixes [#22281](https://github.com/Azure/azure-sdk-for-go/issues/22281).

### Other Changes
* Updated version of azblob to `1.3.0`
* Updated azcore version to `1.9.2` and azidentity version to `1.5.1`.

## 1.1.0-beta.1 (2024-01-10)

Expand Down
80 changes: 25 additions & 55 deletions sdk/storage/azdatalake/file/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4144,6 +4144,10 @@ func (s *UnrecordedTestSuite) TestFileDownloadFile() {
err = os.Remove(name)
_require.NoError(err)
}(destFileName)
defer func(destFile *os.File) {
err = destFile.Close()
_require.NoError(err)
}(destFile)

cnt, err := fClient.DownloadFile(context.Background(), destFile, &file.DownloadFileOptions{
ChunkSize: 10 * 1024 * 1024,
Expand All @@ -4152,18 +4156,8 @@ func (s *UnrecordedTestSuite) TestFileDownloadFile() {
_require.NoError(err)
_require.Equal(cnt, fileSize)

err = destFile.Close()
_require.NoError(err)

newDestFileHandle, err := os.Open(destFileName)
_require.NoError(err)
defer func(file *os.File) {
err = file.Close()
_require.NoError(err)
}(newDestFileHandle)

hash := md5.New()
_, err = io.Copy(hash, newDestFileHandle)
_, err = io.Copy(hash, destFile)
_require.NoError(err)
downloadedContentMD5 := hash.Sum(nil)

Expand Down Expand Up @@ -4229,6 +4223,10 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFile() {
err = os.Remove(name)
_require.NoError(err)
}(destFileName)
defer func(destFile *os.File) {
err = destFile.Close()
_require.NoError(err)
}(destFile)

cnt, err := fClient.DownloadFile(context.Background(), destFile, &file.DownloadFileOptions{
ChunkSize: 2 * 1024,
Expand All @@ -4237,18 +4235,8 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFile() {
_require.NoError(err)
_require.Equal(cnt, fileSize)

err = destFile.Close()
tanyasethi-msft marked this conversation as resolved.
Show resolved Hide resolved
_require.NoError(err)

newDestFileHandle, err := os.Open(destFileName)
_require.NoError(err)
defer func(file *os.File) {
err = file.Close()
_require.NoError(err)
}(newDestFileHandle)

destHash := md5.New()
_, err = io.Copy(destHash, newDestFileHandle)
_, err = io.Copy(destHash, destFile)
_require.NoError(err)
downloadedContentMD5 := destHash.Sum(nil)

Expand Down Expand Up @@ -4315,6 +4303,10 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFileWithRange() {
err = os.Remove(name)
_require.NoError(err)
}(destFileName)
defer func(destFile *os.File) {
err = destFile.Close()
_require.NoError(err)
}(destFile)

cnt, err := fClient.DownloadFile(context.Background(), destFile, &file.DownloadFileOptions{
ChunkSize: 2 * 1024,
Expand All @@ -4327,18 +4319,8 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFileWithRange() {
_require.NoError(err)
_require.Equal(cnt, fileSize)

err = destFile.Close()
_require.NoError(err)

newDestFileHandle, err := os.Open(destFileName)
_require.NoError(err)
defer func(file *os.File) {
err = file.Close()
_require.NoError(err)
}(newDestFileHandle)

destHash := md5.New()
_, err = io.Copy(destHash, newDestFileHandle)
_, err = io.Copy(destHash, destFile)
_require.NoError(err)
downloadedContentMD5 := destHash.Sum(nil)

Expand Down Expand Up @@ -4405,6 +4387,10 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFileWithAccessConditions(
err = os.Remove(name)
_require.NoError(err)
}(destFileName)
defer func(destFile *os.File) {
err = destFile.Close()
_require.NoError(err)
}(destFile)

cnt, err := fClient.DownloadFile(context.Background(), destFile, &file.DownloadFileOptions{
ChunkSize: 2 * 1024,
Expand All @@ -4422,18 +4408,8 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFileWithAccessConditions(
_require.NoError(err)
_require.Equal(cnt, fileSize)

err = destFile.Close()
_require.NoError(err)

newDestFileHandle, err := os.Open(destFileName)
_require.NoError(err)
defer func(file *os.File) {
err = file.Close()
_require.NoError(err)
}(newDestFileHandle)

destHash := md5.New()
_, err = io.Copy(destHash, newDestFileHandle)
_, err = io.Copy(destHash, destFile)
_require.NoError(err)
downloadedContentMD5 := destHash.Sum(nil)

Expand Down Expand Up @@ -4502,6 +4478,10 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFileWithCPK() {
err = os.Remove(name)
_require.NoError(err)
}(destFileName)
defer func(destFile *os.File) {
err = destFile.Close()
_require.NoError(err)
}(destFile)

cnt, err := fClient.DownloadFile(context.Background(), destFile, &file.DownloadFileOptions{
ChunkSize: 2 * 1024,
Expand All @@ -4515,18 +4495,8 @@ func (s *RecordedTestSuite) TestFileUploadDownloadSmallFileWithCPK() {
_require.NoError(err)
_require.Equal(cnt, fileSize)

err = destFile.Close()
_require.NoError(err)

newDestFileHandle, err := os.Open(destFileName)
_require.NoError(err)
defer func(file *os.File) {
err = file.Close()
_require.NoError(err)
}(newDestFileHandle)

destHash := md5.New()
_, err = io.Copy(destHash, newDestFileHandle)
_, err = io.Copy(destHash, destFile)
_require.NoError(err)
downloadedContentMD5 := destHash.Sum(nil)

Expand Down
22 changes: 11 additions & 11 deletions sdk/storage/azdatalake/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ module github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake
go 1.18

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0-beta.1
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0
tanyasethi-msft marked this conversation as resolved.
Show resolved Hide resolved
github.com/stretchr/testify v1.8.4
)

require (
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dnaeon/go-vcr v1.2.0 // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
46 changes: 23 additions & 23 deletions sdk/storage/azdatalake/go.sum
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 h1:lGlwhPtrX6EVml1hO0ivjkUxsSyl4dsiw9qcA1k/3IQ=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 h1:6oNBlSdi1QqM1PNW7FPA6xOGA5UNsXnkaYZz9vdPGhA=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0 h1:AifHbc4mg0x9zW52WOpKbsHaDKuRhlI7TVl47thgQ70=
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0-beta.1 h1:tAJ+HBDRqjXv0TC2qVCk/FWezBU8OKifQ19cUeNXM9M=
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0-beta.1/go.mod h1:uwfk06ZBcvL/g4VHNjurPfVln9NMbsk2XIZxJ+hu81k=
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk=
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0 h1:IfFdxTUDiV58iZqPKgyWiz4X4fCxZeQ1pTQPImLYXpY=
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0/go.mod h1:SUZc9YRRHfx2+FAQKNDGrssXehqLpxmwRv2mC/5ntj4=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
Loading