|
|
|
@ -3,11 +3,14 @@ package azure |
|
|
|
|
import ( |
|
|
|
|
"bytes" |
|
|
|
|
"context" |
|
|
|
|
"fmt" |
|
|
|
|
"net/http" |
|
|
|
|
"strings" |
|
|
|
|
"testing" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob" |
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
"go.uber.org/atomic" |
|
|
|
|
|
|
|
|
@ -96,3 +99,25 @@ func Test_Hedging(t *testing.T) { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Test_IsObjectNotFoundErr(t *testing.T) { |
|
|
|
|
c, err := NewBlobStorage( |
|
|
|
|
&BlobStorageConfig{ |
|
|
|
|
AccountName: "account", |
|
|
|
|
Environment: azureGlobal, |
|
|
|
|
MaxRetries: 0, |
|
|
|
|
}, |
|
|
|
|
metrics, |
|
|
|
|
hedging.Config{}) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
storageError := azblob.StorageError{ |
|
|
|
|
ErrorCode: azblob.StorageErrorCodeBlobNotFound, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
err = fmt.Errorf("wrapping error %w", &storageError) |
|
|
|
|
require.True(t, c.IsObjectNotFoundErr(err)) |
|
|
|
|
|
|
|
|
|
err = fmt.Errorf("wrapping error %w", storageError) |
|
|
|
|
require.True(t, c.IsObjectNotFoundErr(err)) |
|
|
|
|
} |
|
|
|
|