diff --git a/documentation/developer_setup.md b/documentation/developer_setup.md index 2cf8f1fdcc20..7593183070dc 100644 --- a/documentation/developer_setup.md +++ b/documentation/developer_setup.md @@ -161,8 +161,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" ) -var pathToPackage = "sdk/data/aztables/testdata" - func createClientForRecording(t *testing.T, tableName string, serviceURL string, cred SharedKeyCredential) (*Client, error) { transport, err := recording.NewRecordingHTTPClient(t) require.NoError(t, err) @@ -216,7 +214,7 @@ const ( // Test creating a single table func TestCreateTable(t *testing.T) { - err := recording.Start(t, pathToPackage, nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) defer func() { err := recording.Stop(t, nil) @@ -267,15 +265,32 @@ The recording files eventually live in the main repository (`github.com/Azure/az To add a scrubber that replaces the URL of your account use the `TestMain()` function to set sanitizers before you begin running tests. ```go +const recordingDirectory = "/testdata" + func TestMain(m *testing.M) { + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { // Initialize + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + // NOTE: defer should not be used directly within TestMain as it will not be executed due to os.Exit() + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } + + // Set sanitizers in record mode if recording.GetRecordMode() == "record" { - // start all tests with a proxy using it's defaults. - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - vaultUrl := os.Getenv("AZURE_KEYVAULT_URL") err = recording.AddURISanitizer(fakeKvURL, vaultUrl, nil) if err != nil { @@ -283,16 +298,8 @@ func TestMain(m *testing.M) { } } - exitVal := m.Run() - - if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { - // reset the proxy to it's defaults - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - } - + return m.Run() +} ``` Note that removing the names of accounts and other values in your recording can have side effects when running your tests in playback. To take care of this, there are additional methods in the `internal/recording` module for reading environment variables and defaulting to the processed recording value. For example, an `aztables` test for the client constructor and "requiring" the account name to be the same as provided could look like this: diff --git a/sdk/ai/azopenai/ci.yml b/sdk/ai/azopenai/ci.yml index 03e66402c702..50ef67bcddd8 100644 --- a/sdk/ai/azopenai/ci.yml +++ b/sdk/ai/azopenai/ci.yml @@ -32,6 +32,7 @@ stages: TestRunTime: 30m ServiceDirectory: "ai/azopenai" RunLiveTests: true + UsePipelineProxy: false CloudConfig: Public: SubscriptionConfigurations: diff --git a/sdk/ai/azopenai/client_shared_test.go b/sdk/ai/azopenai/client_shared_test.go index 2252a2afe309..6ff39b5aaa8c 100644 --- a/sdk/ai/azopenai/client_shared_test.go +++ b/sdk/ai/azopenai/client_shared_test.go @@ -208,7 +208,7 @@ func newRecordingTransporter(t *testing.T) policy.Transporter { transport, err := recording.NewRecordingHTTPClient(t, nil) require.NoError(t, err) - err = recording.Start(t, "sdk/ai/azopenai/testdata", nil) + err = recording.Start(t, RecordingDirectory, nil) require.NoError(t, err) if recording.GetRecordMode() != recording.PlaybackMode { diff --git a/sdk/ai/azopenai/go.mod b/sdk/ai/azopenai/go.mod index c6fc2b64d1f7..738efba2d933 100644 --- a/sdk/ai/azopenai/go.mod +++ b/sdk/ai/azopenai/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/joho/godotenv v1.3.0 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.8.4 ) require ( @@ -19,9 +19,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/sdk/ai/azopenai/go.sum b/sdk/ai/azopenai/go.sum index 5af46f90f1a5..2b6186e50b5c 100644 --- a/sdk/ai/azopenai/go.sum +++ b/sdk/ai/azopenai/go.sum @@ -2,11 +2,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -24,16 +23,15 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= @@ -41,6 +39,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/ai/azopenai/main_test.go b/sdk/ai/azopenai/main_test.go index 2890ad613e61..39f971160b59 100644 --- a/sdk/ai/azopenai/main_test.go +++ b/sdk/ai/azopenai/main_test.go @@ -4,11 +4,33 @@ package azopenai_test import ( + "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "os" "testing" ) +const RecordingDirectory = "sdk/ai/azopenai/testdata" + func TestMain(m *testing.M) { initEnvVars() - os.Exit(m.Run()) + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(RecordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } + + return m.Run() } diff --git a/sdk/azidentity/cache/go.mod b/sdk/azidentity/cache/go.mod index cca6009a67d7..61ed7da7deab 100644 --- a/sdk/azidentity/cache/go.mod +++ b/sdk/azidentity/cache/go.mod @@ -7,11 +7,11 @@ retract v0.1.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.0-beta.1 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 github.com/google/uuid v1.3.1 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.4 golang.org/x/sys v0.13.0 ) @@ -23,7 +23,7 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/net v0.15.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/azidentity/cache/go.sum b/sdk/azidentity/cache/go.sum index 109c87d88053..a67ffd74c5d9 100644 --- a/sdk/azidentity/cache/go.sum +++ b/sdk/azidentity/cache/go.sum @@ -2,13 +2,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.0-beta.1 h1:H1TQ5NScHE0mQckzLeyjG/+Llrfm6Z2UlYaIO9wOnmc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.0-beta.1/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= 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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -26,17 +25,12 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -45,6 +39,5 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/azidentity/ci.yml b/sdk/azidentity/ci.yml index 9002ea0b0505..d077682c5c2b 100644 --- a/sdk/azidentity/ci.yml +++ b/sdk/azidentity/ci.yml @@ -25,6 +25,7 @@ stages: - template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml parameters: RunLiveTests: true + UsePipelineProxy: false ServiceDirectory: 'azidentity' CloudConfig: Public: diff --git a/sdk/azidentity/go.mod b/sdk/azidentity/go.mod index ced3f5813ec3..f54e3dfeb766 100644 --- a/sdk/azidentity/go.mod +++ b/sdk/azidentity/go.mod @@ -4,20 +4,26 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.2.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 github.com/golang-jwt/jwt/v5 v5.0.0 github.com/google/uuid v1.3.1 + github.com/stretchr/testify v1.8.4 golang.org/x/crypto v0.14.0 ) require ( + github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.2.0 // indirect + github.com/keybase/go-keychain v0.0.0-20230523030712-b5615109f100 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/net v0.15.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/azidentity/go.sum b/sdk/azidentity/go.sum index 55a168c6d5e4..6218f1f45cae 100644 --- a/sdk/azidentity/go.sum +++ b/sdk/azidentity/go.sum @@ -1,7 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5pWFCHtvRpHYC0G/dcA= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.2.0 h1:xZaKaIde2fNBQ6cvgvsdlMMeD4OTpLaOQ1UTVDXGicI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.2.0/go.mod h1:veBEHsnzafwWVNkJ71OdC2tqipKKauNabOxdoi05Mhk= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= 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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -12,25 +16,32 @@ github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJ 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/keybase/go-keychain v0.0.0-20230523030712-b5615109f100 h1:rG3VnJUnAWyiv7qYmmdOdSapzz6HM+zb9/uRFr0T5EM= +github.com/keybase/go-keychain v0.0.0-20230523030712-b5615109f100/go.mod h1:qDHUvIjGZJUtdPtuP4WMu5/U4aVWbFw1MhlkJqCGmCQ= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/azidentity/live_test.go b/sdk/azidentity/live_test.go index 1771b9d3993c..d4b588909dfb 100644 --- a/sdk/azidentity/live_test.go +++ b/sdk/azidentity/live_test.go @@ -57,6 +57,7 @@ var liveUser = struct { } const ( + recordingDirectory = "sdk/azidentity/testdata" azidentityRunManualTests = "AZIDENTITY_RUN_MANUAL_TESTS" fakeClientID = "fake-client-id" fakeResourceID = "/fake/resource/ID" @@ -95,6 +96,8 @@ var ( _, runManualTests = os.LookupEnv(azidentityRunManualTests) ) +var proxy *recording.TestProxyInstance + func setFakeValues() { liveManagedIdentity.clientID = fakeClientID liveManagedIdentity.resourceID = fakeResourceID @@ -124,15 +127,14 @@ func TestMain(m *testing.M) { func run(m *testing.M) int { if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { - // Start from a fresh proxy - err := recording.ResetProxy(nil) + var err error + proxy, err = recording.StartTestProxy(recordingDirectory, nil) if err != nil { panic(err) } - // At the end of testing we want to reset as to not interfere with other tests. defer func() { - err := recording.ResetProxy(nil) + err := recording.StopTestProxy(proxy) if err != nil { panic(err) } @@ -194,7 +196,7 @@ func run(m *testing.M) int { } func initRecording(t *testing.T) (policy.ClientOptions, func()) { - err := recording.Start(t, "sdk/azidentity/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) if err != nil { t.Fatal(err) } @@ -227,7 +229,7 @@ func (p *recordingPolicy) Do(req *policy.Request) (resp *http.Response, err erro r.Header.Set(recording.IDHeader, recording.GetRecordingId(p.t)) r.Header.Set(recording.ModeHeader, mode) r.Header.Set(recording.UpstreamURIHeader, fmt.Sprintf("%s://%s", originalURL.Scheme, originalURL.Host)) - r.Host = "localhost:5001" + r.Host = fmt.Sprintf("localhost:%d", proxy.Options.ProxyPort) r.URL.Host = r.Host r.URL.Scheme = "https" } diff --git a/sdk/cognitiveservices/azopenai/ci.cognitiveservices.yml b/sdk/cognitiveservices/azopenai/ci.cognitiveservices.yml index 90db9512357e..62117f843035 100644 --- a/sdk/cognitiveservices/azopenai/ci.cognitiveservices.yml +++ b/sdk/cognitiveservices/azopenai/ci.cognitiveservices.yml @@ -26,3 +26,4 @@ stages: - template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml parameters: ServiceDirectory: "cognitiveservices/azopenai" + UsePipelineProxy: false diff --git a/sdk/cognitiveservices/azopenai/client_shared_test.go b/sdk/cognitiveservices/azopenai/client_shared_test.go index 1fadc85582f0..4f90b87247f4 100644 --- a/sdk/cognitiveservices/azopenai/client_shared_test.go +++ b/sdk/cognitiveservices/azopenai/client_shared_test.go @@ -124,7 +124,7 @@ func newRecordingTransporter(t *testing.T) policy.Transporter { transport, err := recording.NewRecordingHTTPClient(t, nil) require.NoError(t, err) - err = recording.Start(t, "sdk/cognitiveservices/azopenai/testdata", nil) + err = recording.Start(t, RecordingDirectory, nil) require.NoError(t, err) if recording.GetRecordMode() != recording.PlaybackMode { diff --git a/sdk/cognitiveservices/azopenai/go.mod b/sdk/cognitiveservices/azopenai/go.mod index 2addf4b0b7e7..8cf3dd3be954 100644 --- a/sdk/cognitiveservices/azopenai/go.mod +++ b/sdk/cognitiveservices/azopenai/go.mod @@ -8,9 +8,9 @@ retract [v0.1.0, v0.1.2] // use github.com/Azure/azure-sdk-for-go/sdk/ai/azopena require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/joho/godotenv v1.3.0 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.8.4 ) require ( @@ -22,10 +22,10 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/cognitiveservices/azopenai/go.sum b/sdk/cognitiveservices/azopenai/go.sum index 10901f2ec9f9..027e88ed9eb3 100644 --- a/sdk/cognitiveservices/azopenai/go.sum +++ b/sdk/cognitiveservices/azopenai/go.sum @@ -2,11 +2,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyj github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -24,23 +23,21 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/cognitiveservices/azopenai/main_test.go b/sdk/cognitiveservices/azopenai/main_test.go index 2890ad613e61..8c4a20d248de 100644 --- a/sdk/cognitiveservices/azopenai/main_test.go +++ b/sdk/cognitiveservices/azopenai/main_test.go @@ -4,11 +4,33 @@ package azopenai_test import ( + "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "os" "testing" ) +const RecordingDirectory = "sdk/cognitiveservices/azopenai/testdata" + func TestMain(m *testing.M) { initEnvVars() - os.Exit(m.Run()) + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(RecordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } + + return m.Run() } diff --git a/sdk/containers/azcontainerregistry/ci.yml b/sdk/containers/azcontainerregistry/ci.yml index 858baabf217a..af83077cb76d 100644 --- a/sdk/containers/azcontainerregistry/ci.yml +++ b/sdk/containers/azcontainerregistry/ci.yml @@ -26,6 +26,7 @@ stages: parameters: ServiceDirectory: 'containers/azcontainerregistry' RunLiveTests: true + UsePipelineProxy: false TestRunTime: '30m' SupportedClouds: 'Public,UsGov' EnvVars: diff --git a/sdk/containers/azcontainerregistry/go.mod b/sdk/containers/azcontainerregistry/go.mod index 04f52defc72b..060611d325f5 100644 --- a/sdk/containers/azcontainerregistry/go.mod +++ b/sdk/containers/azcontainerregistry/go.mod @@ -5,24 +5,24 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v0.6.0 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.4 ) require ( github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.0 // indirect + github.com/dnaeon/go-vcr v1.2.0 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/containers/azcontainerregistry/go.sum b/sdk/containers/azcontainerregistry/go.sum index 5a9d60b89904..786bd7ba8294 100644 --- a/sdk/containers/azcontainerregistry/go.sum +++ b/sdk/containers/azcontainerregistry/go.sum @@ -2,17 +2,16 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1 h1:T8quHYlUGyb/oqtSTwqlCr1ilJHrDv+ZtpSfo+hm1BU= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1/go.mod h1:gLa1CL2RNE4s7M3yopJ/p0iq5DdY6Yv5ZUt9MTRZOQM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v0.6.0 h1:Z5/bDxQL2Zc9t6ZDwdRU60bpLHZvoKOeuaM7XVbf2z0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v0.6.0/go.mod h1:0FPu3oDRGPvuX1H8TtHJ5XGA0KrXLunomcixR+PQGGA= github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1 h1:oPdPEZFSbl7oSPEAIPMPBMUmiL+mqgzBJwM/9qYcwNg= github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1/go.mod h1:4qFor3D/HDsvBME35Xy9rwW9DecL+M2sNw1ybjPtwA0= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +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/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= @@ -24,26 +23,20 @@ github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXc github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/containers/azcontainerregistry/utils_test.go b/sdk/containers/azcontainerregistry/utils_test.go index 5539e2914905..9859a34544ee 100644 --- a/sdk/containers/azcontainerregistry/utils_test.go +++ b/sdk/containers/azcontainerregistry/utils_test.go @@ -23,6 +23,8 @@ import ( "time" ) +const recordingDirectory = "sdk/containers/azcontainerregistry/testdata" + // FakeCredential is an empty credential for testing. type FakeCredential struct { } @@ -69,7 +71,7 @@ func getEndpointCredAndClientOptions(t *testing.T) (string, azcore.TokenCredenti // startRecording starts the recording. func startRecording(t *testing.T) { - err := recording.Start(t, "sdk/containers/azcontainerregistry/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) @@ -78,19 +80,26 @@ func startRecording(t *testing.T) { } func TestMain(m *testing.M) { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - if recording.GetRecordMode() == recording.RecordingMode { + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } defer func() { - err := recording.ResetProxy(nil) + err := recording.StopTestProxy(proxy) if err != nil { panic(err) } }() + } + if recording.GetRecordMode() == recording.RecordingMode { // sanitizer for any uuid string, e.g., subscriptionID - err = recording.AddGeneralRegexSanitizer("00000000-0000-0000-0000-000000000000", `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`, nil) + err := recording.AddGeneralRegexSanitizer("00000000-0000-0000-0000-000000000000", `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`, nil) if err != nil { panic(err) } @@ -159,6 +168,5 @@ func TestMain(m *testing.M) { } } } - code := m.Run() - os.Exit(code) + return m.Run() } diff --git a/sdk/data/azappconfig/ci.yml b/sdk/data/azappconfig/ci.yml index 40e528b54916..893940808f07 100644 --- a/sdk/data/azappconfig/ci.yml +++ b/sdk/data/azappconfig/ci.yml @@ -26,3 +26,4 @@ stages: parameters: ServiceDirectory: 'data/azappconfig' RunLiveTests: true + UsePipelineProxy: false diff --git a/sdk/data/azappconfig/go.mod b/sdk/data/azappconfig/go.mod index 22ed101edc1e..9f65ebdfe15f 100644 --- a/sdk/data/azappconfig/go.mod +++ b/sdk/data/azappconfig/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/stretchr/testify v1.8.4 ) @@ -19,7 +19,7 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/net v0.15.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/sdk/data/azappconfig/go.sum b/sdk/data/azappconfig/go.sum index 9498df88d3d2..86e43a9013d0 100644 --- a/sdk/data/azappconfig/go.sum +++ b/sdk/data/azappconfig/go.sum @@ -2,8 +2,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= 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.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= 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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -25,8 +25,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/sdk/data/azappconfig/utils_test.go b/sdk/data/azappconfig/utils_test.go index e977387a3722..ae4f07b53fc0 100644 --- a/sdk/data/azappconfig/utils_test.go +++ b/sdk/data/azappconfig/utils_test.go @@ -16,18 +16,26 @@ import ( "github.com/stretchr/testify/require" ) -const ( - fakeConnStr = "Endpoint=https://contoso.azconfig.io;Id=fake-id:fake-value;Secret=ZmFrZS1zZWNyZXQ=" -) +const recordingDirectory = "sdk/data/azappconfig/testdata" +const fakeConnStr = "Endpoint=https://contoso.azconfig.io;Id=fake-id:fake-value;Secret=ZmFrZS1zZWNyZXQ=" func TestMain(m *testing.M) { os.Exit(run(m)) } func run(m *testing.M) int { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() } switch recording.GetRecordMode() { @@ -39,13 +47,6 @@ func run(m *testing.M) int { } case recording.RecordingMode: - defer func() { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - }() - if err := recording.AddURISanitizer("https://contoso.azconfig.io", `https://\w+\.azconfig\.io`, nil); err != nil { panic(err) } @@ -64,7 +65,7 @@ func NewClientFromConnectionString(t *testing.T) *azappconfig.Client { t.Skip("set APPCONFIGURATION_CONNECTION_STRING to run this test") } - err := recording.Start(t, "sdk/data/azappconfig/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { diff --git a/sdk/data/azcosmos/ci.yml b/sdk/data/azcosmos/ci.yml index 18c6cbc91a53..27c087367b86 100644 --- a/sdk/data/azcosmos/ci.yml +++ b/sdk/data/azcosmos/ci.yml @@ -24,6 +24,7 @@ stages: - template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml parameters: ServiceDirectory: 'data/azcosmos' + UsePipelineProxy: false - stage: Emulator displayName: 'Cosmos Emulator' variables: @@ -72,4 +73,4 @@ stages: Image: $(vm.image) GoVersion: $(go.version) EnvVars: - EMULATOR: 'true' \ No newline at end of file + EMULATOR: 'true' diff --git a/sdk/data/azcosmos/go.mod b/sdk/data/azcosmos/go.mod index d432cb7bf505..7f830eb0a42b 100644 --- a/sdk/data/azcosmos/go.mod +++ b/sdk/data/azcosmos/go.mod @@ -6,8 +6,8 @@ require ( github.com/Azure/azure-sdk-for-go v68.0.0+incompatible github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 - github.com/stretchr/testify v1.7.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 + github.com/stretchr/testify v1.8.4 ) require ( @@ -18,9 +18,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/data/azcosmos/go.sum b/sdk/data/azcosmos/go.sum index 4df567fcae4b..890c686bef36 100644 --- a/sdk/data/azcosmos/go.sum +++ b/sdk/data/azcosmos/go.sum @@ -4,14 +4,13 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= @@ -24,21 +23,19 @@ github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXc github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/data/aztables/ci.yml b/sdk/data/aztables/ci.yml index 6b0fe54e26db..42564d6c34ec 100644 --- a/sdk/data/aztables/ci.yml +++ b/sdk/data/aztables/ci.yml @@ -28,3 +28,4 @@ stages: parameters: ServiceDirectory: 'data/aztables' RunLiveTests: true + UsePipelineProxy: false diff --git a/sdk/data/aztables/go.mod b/sdk/data/aztables/go.mod index 5c250496fd2b..34e7586bfba4 100644 --- a/sdk/data/aztables/go.mod +++ b/sdk/data/aztables/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/stretchr/testify v1.8.4 ) @@ -18,10 +18,10 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/data/aztables/go.sum b/sdk/data/aztables/go.sum index 21fe1367b965..369581bb64ed 100644 --- a/sdk/data/aztables/go.sum +++ b/sdk/data/aztables/go.sum @@ -2,8 +2,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -23,15 +23,15 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb 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.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/data/aztables/proxy_test.go b/sdk/data/aztables/proxy_test.go index 48ea8e81e1ac..c8dd6e9512f7 100644 --- a/sdk/data/aztables/proxy_test.go +++ b/sdk/data/aztables/proxy_test.go @@ -18,7 +18,28 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/data/aztables/testdata" + func TestMain(m *testing.M) { + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } + // 1. Set up session level sanitizers switch recording.GetRecordMode() { case recording.PlaybackMode: @@ -44,23 +65,9 @@ func TestMain(m *testing.M) { } // Run tests - exitVal := m.Run() - - // 3. Reset - // TODO: Add after sanitizer PR - if recording.GetRecordMode() != "live" { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - } - - // 4. Error out if applicable - os.Exit(exitVal) + return m.Run() } -var pathToPackage = "sdk/data/aztables/testdata" - const tableNamePrefix = "tableName" type FakeCredential struct { @@ -140,7 +147,7 @@ func initClientTest(t *testing.T, service string, createTable bool) (*Client, fu require.NoError(t, err) } - err = recording.Start(t, pathToPackage, nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) if createTable { @@ -167,7 +174,7 @@ func initServiceTest(t *testing.T, service string) (*ServiceClient, func()) { require.NoError(t, err) } - err = recording.Start(t, pathToPackage, nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) return client, func() { diff --git a/sdk/data/aztables/service_client_test.go b/sdk/data/aztables/service_client_test.go index dcd6424883fe..fdb4ce1a88d7 100644 --- a/sdk/data/aztables/service_client_test.go +++ b/sdk/data/aztables/service_client_test.go @@ -169,7 +169,7 @@ func TestGetStatistics(t *testing.T) { var cred *SharedKeyCredential var err error - err = recording.Start(t, pathToPackage, nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) stop := func() { err = recording.Stop(t, nil) diff --git a/sdk/data/aztables/shared_access_signature_test.go b/sdk/data/aztables/shared_access_signature_test.go index b7ef674d12ea..faef6a25b024 100644 --- a/sdk/data/aztables/shared_access_signature_test.go +++ b/sdk/data/aztables/shared_access_signature_test.go @@ -57,7 +57,7 @@ func TestSASServiceClient(t *testing.T) { sasUrl, err := serviceClient.GetAccountSASURL(resources, permissions, start, expiry) require.NoError(t, err) - err = recording.Start(t, pathToPackage, nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) svcClient, err := createServiceClientForRecordingWithNoCredential(t, sasUrl) require.NoError(t, err) @@ -104,7 +104,7 @@ func TestSASClient(t *testing.T) { sasUrl, err := c.GetTableSASURL(permissions, start, expiry) require.NoError(t, err) - err = recording.Start(t, pathToPackage, nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) client, err := createClientForRecordingWithNoCredential(t, "", sasUrl) require.NoError(t, err) @@ -159,7 +159,7 @@ func TestSASClientReadOnly(t *testing.T) { sasUrl, err := c.GetTableSASURL(permissions, start, expiry) require.NoError(t, err) - err = recording.Start(t, pathToPackage, nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) client, err = createClientForRecordingWithNoCredential(t, "", sasUrl) require.NoError(t, err) @@ -229,7 +229,7 @@ func TestSASCosmosClientReadOnly(t *testing.T) { sasUrl, err := c.GetTableSASURL(permissions, start, expiry) require.NoError(t, err) - err = recording.Start(t, pathToPackage, nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) client, err = createClientForRecordingWithNoCredential(t, "", sasUrl) require.NoError(t, err) diff --git a/sdk/data/aztables/testdata/perf/go.mod b/sdk/data/aztables/testdata/perf/go.mod index f53ffcae69c6..f24d5e4a05de 100644 --- a/sdk/data/aztables/testdata/perf/go.mod +++ b/sdk/data/aztables/testdata/perf/go.mod @@ -5,15 +5,15 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/testify v1.8.4 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/data/aztables/testdata/perf/go.sum b/sdk/data/aztables/testdata/perf/go.sum index 99148cc519b7..b60d22eef265 100644 --- a/sdk/data/aztables/testdata/perf/go.sum +++ b/sdk/data/aztables/testdata/perf/go.sum @@ -1,8 +1,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8u3fcIHyqkLjcFpNRHQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= 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= @@ -15,12 +15,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb 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.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/sdk/internal/recording/README.md b/sdk/internal/recording/README.md index 55650b63a524..e7dc40e55e28 100644 --- a/sdk/internal/recording/README.md +++ b/sdk/internal/recording/README.md @@ -21,22 +21,31 @@ $ENV:PROXY_CERT="C:/ /azure-sdk-for-go/eng/common/testproxy/dotne Recording and playing back tests relies on the [Test Proxy](https://github.com/Azure/azure-sdk-tools/blob/main/tools/test-proxy/Azure.Sdk.Tools.TestProxy/README.md) to intercept traffic. The recording package can automatically install and run an instance of the test-proxy server per package. The below code needs to be added to test setup and teardown in order to achieve this. The service directory value should correspond to the `testdata` directory within the directory containing the [assets.json](https://github.com/Azure/azure-sdk-tools/blob/main/tools/assets-automation/asset-sync/README.md#assetsjson-discovery) config, see [examples](https://github.com/search?q=repo%3AAzure%2Fazure-sdk-for-go+assets.json+language%3AJSON&type=code&l=JSON). ```golang -func TestMain(m *testing.M) { - proxy, err := recording.StartTestProxy("/testdata", nil) - if err != nil { - panic(err) - } - - ... all other test code, including proxy recording setup ... +const recordingDirectory = "/testdata" - code := m.Run() +func TestMain(m *testing.M) { + code := run(m) + os.Exit(code) +} - err = recording.StopTestProxy(proxy) - if err != nil { - panic(err) - } +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + // NOTE: defer should not be used directly within TestMain as it will not be executed due to os.Exit() + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } - os.Exit(code) + ... all other test code, including proxy recording setup ... + return m.Run() } ``` @@ -47,9 +56,6 @@ The first step in instrumenting a client to interact with recorded tests is to d The snippet below demonstrates an example test policy: ```go -// This should be a 'testdata' directory in your module. `testdata` is ignored by the go tool, making it perfect for ancillary data -var pathToPackage = "sdk/data/aztables/testdata" - type recordingPolicy struct { options recording.RecordingOptions t *testing.T @@ -109,8 +115,8 @@ func TestSomething(t *testing.T) { To start and stop your tests use the `recording.Start` and `recording.Stop` (make sure to use `defer recording.Stop` to ensure the proxy cleans up your test on failure) methods: ```go func TestSomething(t *testing.T) { - err := recording.Start(nil) - defer recording.Stop(nil) + err := recording.Start(t, recordingDirectory, nil) + defer recording.Stop(t, recordingDirectory, nil) // Continue test } @@ -126,8 +132,8 @@ func TestSomething(t *testing.T) { // To remove the sanitizer after this test use the following: defer recording.ResetSanitizers(nil) - err := recording.Start(nil) - defer recording.Stop(nil) + err := recording.Start(t, recordingDirectory, nil) + defer recording.Stop(t, recordingDirectory, nil) // Continue test } diff --git a/sdk/messaging/azeventgrid/ci.yml b/sdk/messaging/azeventgrid/ci.yml index ee4ef0cbf4e3..28025cce8b8a 100644 --- a/sdk/messaging/azeventgrid/ci.yml +++ b/sdk/messaging/azeventgrid/ci.yml @@ -27,6 +27,7 @@ stages: parameters: ServiceDirectory: "messaging/azeventgrid" RunLiveTests: true + UsePipelineProxy: false Location: westus2 EnvVars: AZURE_CLIENT_ID: $(AZEVENTGRID_CLIENT_ID) diff --git a/sdk/messaging/azeventgrid/go.mod b/sdk/messaging/azeventgrid/go.mod index 514174abf537..cb34897eecbd 100644 --- a/sdk/messaging/azeventgrid/go.mod +++ b/sdk/messaging/azeventgrid/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/joho/godotenv v1.5.1 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.8.4 ) require ( @@ -19,9 +19,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/sdk/messaging/azeventgrid/go.sum b/sdk/messaging/azeventgrid/go.sum index 87380e1f90f4..3611a614baa6 100644 --- a/sdk/messaging/azeventgrid/go.sum +++ b/sdk/messaging/azeventgrid/go.sum @@ -2,11 +2,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= 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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -24,16 +23,15 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= @@ -41,6 +39,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/messaging/azeventgrid/main_test.go b/sdk/messaging/azeventgrid/main_test.go index 4d9abe295190..d70e5d6b1d82 100644 --- a/sdk/messaging/azeventgrid/main_test.go +++ b/sdk/messaging/azeventgrid/main_test.go @@ -15,14 +15,30 @@ import ( "github.com/joho/godotenv" ) +const recordingDirectory = "sdk/messaging/azeventgrid/testdata" + func TestMain(m *testing.M) { - if err := recording.ResetProxy(nil); err != nil { - panic(err) - } + code := run(m) + os.Exit(code) +} +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } if err := godotenv.Load(); err != nil { log.Printf("Failed to load .env file, no integration tests will run: %s", err) } - os.Exit(m.Run()) + return m.Run() } diff --git a/sdk/messaging/azeventgrid/publisher/main_test.go b/sdk/messaging/azeventgrid/publisher/main_test.go index e9a7d8f3b9c7..172ce969b9fa 100644 --- a/sdk/messaging/azeventgrid/publisher/main_test.go +++ b/sdk/messaging/azeventgrid/publisher/main_test.go @@ -15,14 +15,31 @@ import ( "github.com/joho/godotenv" ) +const recordingDirectory = "sdk/messaging/azeventgrid/testdata" + func TestMain(m *testing.M) { - if err := recording.ResetProxy(nil); err != nil { - panic(err) + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() } if err := godotenv.Load("../.env"); err != nil { log.Printf("Failed to load .env file, no integration tests will run: %s", err) } - os.Exit(m.Run()) + return m.Run() } diff --git a/sdk/messaging/azeventgrid/shared_test.go b/sdk/messaging/azeventgrid/shared_test.go index 98c3227e6979..3c19a1194622 100644 --- a/sdk/messaging/azeventgrid/shared_test.go +++ b/sdk/messaging/azeventgrid/shared_test.go @@ -144,7 +144,7 @@ func newRecordingTransporter(t *testing.T, testVars testVars) policy.Transporter transport, err := recording.NewRecordingHTTPClient(t, nil) require.NoError(t, err) - err = recording.Start(t, "sdk/messaging/azeventgrid/testdata", nil) + err = recording.Start(t, recordingDirectory, nil) require.NoError(t, err) // err = recording.ResetProxy(nil) diff --git a/sdk/monitor/azingest/ci.yml b/sdk/monitor/azingest/ci.yml index 74d82d89824f..ceb0d5a10814 100644 --- a/sdk/monitor/azingest/ci.yml +++ b/sdk/monitor/azingest/ci.yml @@ -27,4 +27,5 @@ stages: parameters: ServiceDirectory: 'monitor/azingest' RunLiveTests: true - SupportedClouds: 'Public,UsGov,China' \ No newline at end of file + UsePipelineProxy: false + SupportedClouds: 'Public,UsGov,China' diff --git a/sdk/monitor/azingest/go.mod b/sdk/monitor/azingest/go.mod index cb9f29fb2376..abc58b52da5e 100644 --- a/sdk/monitor/azingest/go.mod +++ b/sdk/monitor/azingest/go.mod @@ -5,8 +5,8 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 - github.com/stretchr/testify v1.7.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 + github.com/stretchr/testify v1.8.4 ) require ( @@ -18,10 +18,10 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/monitor/azingest/go.sum b/sdk/monitor/azingest/go.sum index 78ec1d5d94d6..54319a3794c0 100644 --- a/sdk/monitor/azingest/go.sum +++ b/sdk/monitor/azingest/go.sum @@ -2,11 +2,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyj github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -22,23 +21,21 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/monitor/azingest/utils_test.go b/sdk/monitor/azingest/utils_test.go index 1b5cc3b3fe90..a10286610847 100644 --- a/sdk/monitor/azingest/utils_test.go +++ b/sdk/monitor/azingest/utils_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/monitor/azingest/testdata" const fakeEndpoint = "https://test.eastus-1.ingest.monitor.azure.com" const fakeRuleID = "Custom-TestTable_CL" const fakeStreamName = "dcr-testing" @@ -36,16 +37,32 @@ var ( ) func TestMain(m *testing.M) { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() } + if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantID := lookupEnvVar("AZINGEST_TENANT_ID") clientID := lookupEnvVar("AZINGEST_CLIENT_ID") secret := lookupEnvVar("AZINGEST_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) if err != nil { panic(err) @@ -63,12 +80,11 @@ func TestMain(m *testing.M) { ruleID = getEnvVar("AZURE_MONITOR_DCR_ID", fakeRuleID) streamName = getEnvVar("AZURE_MONITOR_STREAM_NAME", fakeStreamName) - code := m.Run() - os.Exit(code) + return m.Run() } func startRecording(t *testing.T) { - err := recording.Start(t, "sdk/monitor/azingest/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/monitor/azquery/ci.yml b/sdk/monitor/azquery/ci.yml index 1040bbb8248e..8ac0dc0a315e 100644 --- a/sdk/monitor/azquery/ci.yml +++ b/sdk/monitor/azquery/ci.yml @@ -27,9 +27,10 @@ stages: parameters: ServiceDirectory: 'monitor/azquery' RunLiveTests: true + UsePipelineProxy: false SupportedClouds: 'Public,UsGov,China' EnvVars: AZURE_CLIENT_ID: $(AZQUERY_CLIENT_ID) AZURE_TENANT_ID: $(AZQUERY_TENANT_ID) AZURE_CLIENT_SECRET: $(AZQUERY_CLIENT_SECRET) - AZURE_SUBSCRIPTION_ID: $(AZQUERY_SUBSCRIPTION_ID) \ No newline at end of file + AZURE_SUBSCRIPTION_ID: $(AZQUERY_SUBSCRIPTION_ID) diff --git a/sdk/monitor/azquery/go.mod b/sdk/monitor/azquery/go.mod index 1b3d0d6d04f9..81a65d95675d 100644 --- a/sdk/monitor/azquery/go.mod +++ b/sdk/monitor/azquery/go.mod @@ -5,23 +5,23 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 - github.com/stretchr/testify v1.7.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 + github.com/stretchr/testify v1.8.4 ) require ( github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.0 // indirect + github.com/dnaeon/go-vcr v1.2.0 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/monitor/azquery/go.sum b/sdk/monitor/azquery/go.sum index 342569ba6411..8ca65351a4b3 100644 --- a/sdk/monitor/azquery/go.sum +++ b/sdk/monitor/azquery/go.sum @@ -2,15 +2,14 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +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 v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= @@ -24,23 +23,21 @@ github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXc github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/monitor/azquery/utils_test.go b/sdk/monitor/azquery/utils_test.go index cb27571509dd..f09fda381939 100644 --- a/sdk/monitor/azquery/utils_test.go +++ b/sdk/monitor/azquery/utils_test.go @@ -27,6 +27,7 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/monitor/azquery/testdata" const fakeWorkspaceID = "32d1e136-gg81-4b0a-b647-260cdc471f68" const fakeWorkspaceID2 = "asdjkfj8k20-gg81-4b0a-9fu2-260c09fn1f68" const fakeResourceURI = "/subscriptions/faa080af-c1d8-40ad-9cce-e1a451va7b87/resourceGroups/rg-example/providers/Microsoft.AppConfiguration/configurationStores/example" @@ -40,6 +41,23 @@ var ( ) func TestMain(m *testing.M) { + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } if recording.GetRecordMode() == recording.LiveMode || recording.GetRecordMode() == recording.RecordingMode { workspaceID, workspaceID2, resourceURI = os.Getenv("WORKSPACE_ID"), os.Getenv("WORKSPACE_ID2"), os.Getenv("RESOURCE_URI") } @@ -61,16 +79,13 @@ func TestMain(m *testing.M) { } resourceURI = fakeResourceURI } - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantID := lookupEnvVar("AZQUERY_TENANT_ID") clientID := lookupEnvVar("AZQUERY_CLIENT_ID") secret := lookupEnvVar("AZQUERY_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) if err != nil { panic(err) @@ -99,19 +114,12 @@ func TestMain(m *testing.M) { if err != nil { panic(err) } - defer func() { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - }() } - code := m.Run() - os.Exit(code) + return m.Run() } func startRecording(t *testing.T) { - err := recording.Start(t, "sdk/monitor/azquery/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/security/keyvault/azadmin/backup/utils_test.go b/sdk/security/keyvault/azadmin/backup/utils_test.go index cc543336ae83..95bb84ee1ada 100644 --- a/sdk/security/keyvault/azadmin/backup/utils_test.go +++ b/sdk/security/keyvault/azadmin/backup/utils_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/security/keyvault/azadmin/testdata" const fakeHsmURL = "https://fakehsm.managedhsm.azure.net/" const fakeBlobURL = "https://fakestorageaccount.blob.core.windows.net/backup" const fakeToken = "fakeSasToken" @@ -35,16 +36,32 @@ var ( ) func TestMain(m *testing.M) { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() } + if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantID := lookupEnvVar("AZADMIN_TENANT_ID") clientID := lookupEnvVar("AZADMIN_CLIENT_ID") secret := lookupEnvVar("AZADMIN_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) if err != nil { panic(err) @@ -56,17 +73,17 @@ func TestMain(m *testing.M) { token = getEnvVar("BLOB_STORAGE_SAS_TOKEN", fakeToken) if recording.GetRecordMode() == recording.RecordingMode { - err = recording.AddBodyRegexSanitizer(fakeToken, `sv=[^"]*`, nil) + err := recording.AddBodyRegexSanitizer(fakeToken, `sv=[^"]*`, nil) if err != nil { panic(err) } } - code := m.Run() - os.Exit(code) + + return m.Run() } func startRecording(t *testing.T) { - err := recording.Start(t, "sdk/security/keyvault/azadmin/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/security/keyvault/azadmin/ci.yml b/sdk/security/keyvault/azadmin/ci.yml index 41d0baa11619..c3e32e426de0 100644 --- a/sdk/security/keyvault/azadmin/ci.yml +++ b/sdk/security/keyvault/azadmin/ci.yml @@ -27,6 +27,7 @@ stages: TimeoutInMinutes: 120 ServiceDirectory: 'security/keyvault/azadmin' RunLiveTests: true + UsePipelineProxy: false MatrixConfigs: - Name: keyvault_test_matrix_addons Path: sdk/security/keyvault/azadmin/platform-matrix.json diff --git a/sdk/security/keyvault/azadmin/go.mod b/sdk/security/keyvault/azadmin/go.mod index c0b9a8d3d577..7f2259963b29 100644 --- a/sdk/security/keyvault/azadmin/go.mod +++ b/sdk/security/keyvault/azadmin/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 github.com/google/uuid v1.3.0 @@ -20,10 +20,10 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.12.0 // indirect - golang.org/x/net v0.14.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/security/keyvault/azadmin/go.sum b/sdk/security/keyvault/azadmin/go.sum index d979b1e49895..cf1a3e8a063c 100644 --- a/sdk/security/keyvault/azadmin/go.sum +++ b/sdk/security/keyvault/azadmin/go.sum @@ -2,8 +2,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 h1:/iHxaJhsFr0+xVFfbMr5vxz84 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0 h1:yfJe15aSwEQ6Oo6J+gdfdulPNoZ3TEhmbhLIoxZcA+U= github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0/go.mod h1:Q28U+75mpCaSCDowNEmhIo/rmgdkqmkmzI7N6TGR4UY= github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 h1:D3occbWoio4EBLkbkevetNMAVX197GkzbUMtqjGWn80= @@ -27,15 +27,15 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb 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.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/security/keyvault/azadmin/rbac/utils_test.go b/sdk/security/keyvault/azadmin/rbac/utils_test.go index 81acfeb04da0..989276452b89 100644 --- a/sdk/security/keyvault/azadmin/rbac/utils_test.go +++ b/sdk/security/keyvault/azadmin/rbac/utils_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/security/keyvault/azadmin/testdata" const fakeHsmURL = "https://fakehsm.managedhsm.azure.net/" var ( @@ -31,16 +32,32 @@ var ( ) func TestMain(m *testing.M) { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() } + if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantID := lookupEnvVar("AZADMIN_TENANT_ID") clientID := lookupEnvVar("AZADMIN_CLIENT_ID") secret := lookupEnvVar("AZADMIN_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) if err != nil { panic(err) @@ -49,12 +66,11 @@ func TestMain(m *testing.M) { hsmURL = getEnvVar("AZURE_MANAGEDHSM_URL", fakeHsmURL) - code := m.Run() - os.Exit(code) + return m.Run() } func startRecording(t *testing.T) { - err := recording.Start(t, "sdk/security/keyvault/azadmin/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/security/keyvault/azadmin/settings/utils_test.go b/sdk/security/keyvault/azadmin/settings/utils_test.go index 94d282e7edae..b92f6651f7bc 100644 --- a/sdk/security/keyvault/azadmin/settings/utils_test.go +++ b/sdk/security/keyvault/azadmin/settings/utils_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/security/keyvault/azadmin/testdata" const fakeHsmURL = "https://fakehsm.managedhsm.azure.net/" var ( @@ -31,16 +32,32 @@ var ( ) func TestMain(m *testing.M) { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() } + if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantID := lookupEnvVar("AZADMIN_TENANT_ID") clientID := lookupEnvVar("AZADMIN_CLIENT_ID") secret := lookupEnvVar("AZADMIN_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) if err != nil { panic(err) @@ -49,12 +66,11 @@ func TestMain(m *testing.M) { hsmURL = getEnvVar("AZURE_MANAGEDHSM_URL", fakeHsmURL) - code := m.Run() - os.Exit(code) + return m.Run() } func startRecording(t *testing.T) { - err := recording.Start(t, "sdk/security/keyvault/azadmin/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/security/keyvault/azcertificates/utils_test.go b/sdk/security/keyvault/azcertificates/utils_test.go index 35c45a5b7ec0..274ef7be882a 100644 --- a/sdk/security/keyvault/azcertificates/utils_test.go +++ b/sdk/security/keyvault/azcertificates/utils_test.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/security/keyvault/azcertificates/testdata" const fakeVaultURL = "https://fakevault.local" var ( @@ -37,6 +38,25 @@ var ( ) func TestMain(m *testing.M) { + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } + vaultURL = strings.TrimSuffix(recording.GetEnvVariable("AZURE_KEYVAULT_URL", fakeVaultURL), "/") if vaultURL == "" { if recording.GetRecordMode() != recording.PlaybackMode { @@ -44,29 +64,20 @@ func TestMain(m *testing.M) { } vaultURL = fakeVaultURL } - proxy, err := recording.StartTestProxy("sdk/security/keyvault/azcertificates/testdata", nil) - if err != nil { - panic(err) - } if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantId := lookupEnvVar("AZCERTIFICATES_TENANT_ID") clientId := lookupEnvVar("AZCERTIFICATES_CLIENT_ID") secret := lookupEnvVar("AZCERTIFICATES_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantId, clientId, secret, nil) if err != nil { panic(err) } } if recording.GetRecordMode() == recording.RecordingMode { - defer func() { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - }() - err = recording.AddURISanitizer(fakeVaultURL, vaultURL, nil) + err := recording.AddURISanitizer(fakeVaultURL, vaultURL, nil) if err != nil { panic(err) } @@ -110,15 +121,11 @@ func TestMain(m *testing.M) { } } - err = recording.StopTestProxy(proxy) - if err != nil { - panic(err) - } - os.Exit(code) + return code } func startTest(t *testing.T) *azcertificates.Client { - err := recording.Start(t, "sdk/security/keyvault/azcertificates/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/security/keyvault/azkeys/utils_test.go b/sdk/security/keyvault/azkeys/utils_test.go index 9b4f426b76a9..66f1b9b27e0c 100644 --- a/sdk/security/keyvault/azkeys/utils_test.go +++ b/sdk/security/keyvault/azkeys/utils_test.go @@ -29,11 +29,10 @@ import ( "github.com/stretchr/testify/require" ) -const ( - fakeAttestationUrl = "https://fakeattestation" - fakeMHSMURL = "https://fakemhsm.local" - fakeVaultURL = "https://fakevault.local" -) +const recordingDirectory = "sdk/security/keyvault/azkeys/testdata" +const fakeAttestationUrl = "https://fakeattestation" +const fakeMHSMURL = "https://fakemhsm.local" +const fakeVaultURL = "https://fakevault.local" var ( keysToPurge = struct { @@ -49,6 +48,25 @@ var ( ) func TestMain(m *testing.M) { + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } + attestationURL = strings.TrimSuffix(recording.GetEnvVariable("AZURE_KEYVAULT_ATTESTATION_URL", fakeAttestationUrl), "/") mhsmURL = strings.TrimSuffix(recording.GetEnvVariable("AZURE_MANAGEDHSM_URL", fakeMHSMURL), "/") vaultURL = strings.TrimSuffix(recording.GetEnvVariable("AZURE_KEYVAULT_URL", fakeVaultURL), "/") @@ -59,28 +77,19 @@ func TestMain(m *testing.M) { vaultURL = fakeVaultURL } enableHSM = mhsmURL != fakeMHSMURL - proxy, err := recording.StartTestProxy("sdk/security/keyvault/azkeys/testdata", nil) - if err != nil { - panic(err) - } if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantId := lookupEnvVar("AZKEYS_TENANT_ID") clientId := lookupEnvVar("AZKEYS_CLIENT_ID") secret := lookupEnvVar("AZKEYS_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantId, clientId, secret, nil) if err != nil { panic(err) } } if recording.GetRecordMode() == recording.RecordingMode { - defer func() { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - }() for _, URI := range []struct{ real, fake string }{ {attestationURL, fakeAttestationUrl}, {mhsmURL, fakeMHSMURL}, @@ -100,7 +109,7 @@ func TestMain(m *testing.M) { } } for _, path := range []string{"$.error.message", "$.key.kid", "$.recoveryId"} { - err = recording.AddBodyKeySanitizer(path, fakeVaultURL, vaultURL, nil) + err := recording.AddBodyKeySanitizer(path, fakeVaultURL, vaultURL, nil) if err != nil { panic(err) } @@ -112,7 +121,7 @@ func TestMain(m *testing.M) { // these values aren't secret but we redact them anyway to avoid // alerts from automation scanning for JWTs or "token" values for _, attestation := range []string{"$.target", "$.token"} { - err = recording.AddBodyKeySanitizer(attestation, "redacted", "", nil) + err := recording.AddBodyKeySanitizer(attestation, "redacted", "", nil) if err != nil { panic(err) } @@ -120,7 +129,7 @@ func TestMain(m *testing.M) { // we need to replace release policy data because it has the attestation service URL encoded // into it and therefore won't match in playback, when we don't have the URL used while recording fakePolicyData := base64.RawStdEncoding.EncodeToString(getMarshalledReleasePolicy(fakeAttestationUrl)) - err = recording.AddBodyKeySanitizer("$.release_policy.data", fakePolicyData, "", nil) + err := recording.AddBodyKeySanitizer("$.release_policy.data", fakePolicyData, "", nil) if err != nil { panic(err) } @@ -158,19 +167,14 @@ func TestMain(m *testing.M) { } } - err = recording.StopTestProxy(proxy) - if err != nil { - panic(err) - } - - os.Exit(code) + return code } func startTest(t *testing.T, MHSMtest bool) *azkeys.Client { if recording.GetRecordMode() != recording.PlaybackMode && MHSMtest && !enableHSM { t.Skip("set AZURE_MANAGEDHSM_URL to run this test") } - err := recording.Start(t, "sdk/security/keyvault/azkeys/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/security/keyvault/azsecrets/utils_test.go b/sdk/security/keyvault/azsecrets/utils_test.go index e154e0ac9e15..8d657e0a29dc 100644 --- a/sdk/security/keyvault/azsecrets/utils_test.go +++ b/sdk/security/keyvault/azsecrets/utils_test.go @@ -27,6 +27,7 @@ import ( "github.com/stretchr/testify/require" ) +const recordingDirectory = "sdk/security/keyvault/azsecrets/testdata" const fakeVaultURL = "https://fakevault.local" var ( @@ -40,6 +41,25 @@ var ( ) func TestMain(m *testing.M) { + code := run(m) + os.Exit(code) +} + +func run(m *testing.M) int { + if recording.GetRecordMode() == recording.PlaybackMode || recording.GetRecordMode() == recording.RecordingMode { + proxy, err := recording.StartTestProxy(recordingDirectory, nil) + if err != nil { + panic(err) + } + + defer func() { + err := recording.StopTestProxy(proxy) + if err != nil { + panic(err) + } + }() + } + vaultURL = fakeVaultURL if recording.GetRecordMode() != recording.PlaybackMode { if u, ok := os.LookupEnv("AZURE_KEYVAULT_URL"); ok && u != "" { @@ -48,16 +68,13 @@ func TestMain(m *testing.M) { panic("no value for AZURE_KEYVAULT_URL") } } - proxy, err := recording.StartTestProxy("sdk/security/keyvault/azsecrets/testdata", nil) - if err != nil { - panic(err) - } if recording.GetRecordMode() == recording.PlaybackMode { credential = &FakeCredential{} } else { tenantID := lookupEnvVar("AZSECRETS_TENANT_ID") clientID := lookupEnvVar("AZSECRETS_CLIENT_ID") secret := lookupEnvVar("AZSECRETS_CLIENT_SECRET") + var err error credential, err = azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) if err != nil { panic(err) @@ -76,12 +93,6 @@ func TestMain(m *testing.M) { if err != nil { panic(err) } - defer func() { - err := recording.ResetProxy(nil) - if err != nil { - panic(err) - } - }() } code := m.Run() if recording.GetRecordMode() != recording.PlaybackMode { @@ -110,15 +121,11 @@ func TestMain(m *testing.M) { } } - err = recording.StopTestProxy(proxy) - if err != nil { - panic(err) - } - os.Exit(code) + return code } func startTest(t *testing.T) *azsecrets.Client { - err := recording.Start(t, "sdk/security/keyvault/azsecrets/testdata", nil) + err := recording.Start(t, recordingDirectory, nil) require.NoError(t, err) t.Cleanup(func() { err := recording.Stop(t, nil) diff --git a/sdk/storage/azblob/appendblob/client_test.go b/sdk/storage/azblob/appendblob/client_test.go index c72e2dcac258..43ca90400ffe 100644 --- a/sdk/storage/azblob/appendblob/client_test.go +++ b/sdk/storage/azblob/appendblob/client_test.go @@ -53,6 +53,14 @@ func Test(t *testing.T) { } } +func (s *AppendBlobRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *AppendBlobRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *AppendBlobRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -71,6 +79,7 @@ func (s *AppendBlobUnrecordedTestsSuite) AfterTest(suite string, test string) { type AppendBlobRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type AppendBlobUnrecordedTestsSuite struct { diff --git a/sdk/storage/azblob/blob/client_test.go b/sdk/storage/azblob/blob/client_test.go index f59a1aa2306b..43eb8180cae7 100644 --- a/sdk/storage/azblob/blob/client_test.go +++ b/sdk/storage/azblob/blob/client_test.go @@ -50,6 +50,14 @@ func Test(t *testing.T) { } } +func (s *BlobRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *BlobRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *BlobRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -68,6 +76,7 @@ func (s *BlobUnrecordedTestsSuite) AfterTest(suite string, test string) { type BlobRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type BlobUnrecordedTestsSuite struct { diff --git a/sdk/storage/azblob/blockblob/client_test.go b/sdk/storage/azblob/blockblob/client_test.go index 8f5b8ce65c8d..e514397a945e 100644 --- a/sdk/storage/azblob/blockblob/client_test.go +++ b/sdk/storage/azblob/blockblob/client_test.go @@ -60,6 +60,14 @@ func Test(t *testing.T) { } } +func (s *BlockBlobRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *BlockBlobRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *BlockBlobRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -78,6 +86,7 @@ func (s *BlockBlobUnrecordedTestsSuite) AfterTest(suite string, test string) { type BlockBlobRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type BlockBlobUnrecordedTestsSuite struct { diff --git a/sdk/storage/azblob/ci.yml b/sdk/storage/azblob/ci.yml index f5100e131137..03035033891f 100644 --- a/sdk/storage/azblob/ci.yml +++ b/sdk/storage/azblob/ci.yml @@ -26,6 +26,7 @@ stages: parameters: ServiceDirectory: 'storage/azblob' RunLiveTests: true + UsePipelineProxy: false EnvVars: AZURE_CLIENT_ID: $(AZBLOB_CLIENT_ID) AZURE_TENANT_ID: $(AZBLOB_TENANT_ID) diff --git a/sdk/storage/azblob/client_test.go b/sdk/storage/azblob/client_test.go index 904063f5d18d..2bcf3400527d 100644 --- a/sdk/storage/azblob/client_test.go +++ b/sdk/storage/azblob/client_test.go @@ -35,6 +35,7 @@ var ctx = context.Background() type AZBlobRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type AZBlobUnrecordedTestsSuite struct { @@ -55,6 +56,14 @@ func Test(t *testing.T) { } } +func (s *AZBlobRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *AZBlobRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *AZBlobRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } diff --git a/sdk/storage/azblob/container/client_test.go b/sdk/storage/azblob/container/client_test.go index 54466fb7f126..b8d162f4740f 100644 --- a/sdk/storage/azblob/container/client_test.go +++ b/sdk/storage/azblob/container/client_test.go @@ -46,6 +46,14 @@ func Test(t *testing.T) { } } +func (s *ContainerRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *ContainerRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *ContainerRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -64,6 +72,7 @@ func (s *ContainerUnrecordedTestsSuite) AfterTest(suite string, test string) { type ContainerRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type ContainerUnrecordedTestsSuite struct { diff --git a/sdk/storage/azblob/go.mod b/sdk/storage/azblob/go.mod index 79e976b21b9b..a80b9d694d38 100644 --- a/sdk/storage/azblob/go.mod +++ b/sdk/storage/azblob/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.4 ) require ( @@ -19,10 +19,10 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/storage/azblob/go.sum b/sdk/storage/azblob/go.sum index c5df56945436..53be3aecf0cd 100644 --- a/sdk/storage/azblob/go.sum +++ b/sdk/storage/azblob/go.sum @@ -2,15 +2,14 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 h1:Ma67P/GGprNwsslzEH6+Kb8nybI8jpDTm4Wmzu2ReK8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0/go.mod h1:c+Lifp3EDEamAkPVzMooRNOK6CZjNSdEnf1A7jsI9u4= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -26,23 +25,21 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/storage/azblob/internal/testcommon/common.go b/sdk/storage/azblob/internal/testcommon/common.go index 51feff01abdd..013d4028ff6e 100644 --- a/sdk/storage/azblob/internal/testcommon/common.go +++ b/sdk/storage/azblob/internal/testcommon/common.go @@ -31,9 +31,11 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared" "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" ) const ( + RecordingDirectory = "sdk/storage/azblob/testdata" ContainerPrefix = "goc" BlobPrefix = "gotestblob" BlockBlobDefaultData = "GoBlockBlobData" @@ -184,6 +186,22 @@ func GetRequiredEnv(name string) (string, error) { } } +func SetupSuite(suite *suite.Suite) *recording.TestProxyInstance { + proxy, err := recording.StartTestProxy(RecordingDirectory, nil) + if err != nil { + suite.T().Fatal(err) + } + + return proxy +} + +func TearDownSuite(suite *suite.Suite, proxy *recording.TestProxyInstance) { + err := recording.StopTestProxy(proxy) + if err != nil { + suite.T().Fatal(err) + } +} + func BeforeTest(t *testing.T, suite string, test string) { const urlRegex = `https://\S+\.blob\.core\.windows\.net` const tokenRegex = `(?:Bearer\s).*` @@ -199,7 +217,7 @@ func BeforeTest(t *testing.T, suite string, test string) { // TODO: more freezing //testframework.AddBodyRegexSanitizer("RequestId:00000000-0000-0000-0000-000000000000", `RequestId:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}`, nil) //testframework.AddBodyRegexSanitizer("Time:2022-08-11T00:21:56.4562741Z", `Time:\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d*)?Z`, nil) - require.NoError(t, recording.Start(t, "sdk/storage/azblob/testdata", nil)) + require.NoError(t, recording.Start(t, RecordingDirectory, nil)) } func AfterTest(t *testing.T, suite string, test string) { diff --git a/sdk/storage/azblob/lease/client_test.go b/sdk/storage/azblob/lease/client_test.go index a6bde57c7796..7ea40f1488df 100644 --- a/sdk/storage/azblob/lease/client_test.go +++ b/sdk/storage/azblob/lease/client_test.go @@ -33,6 +33,14 @@ func Test(t *testing.T) { } } +func (s *LeaseRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *LeaseRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *LeaseRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -51,6 +59,7 @@ func (s *LeaseUnrecordedTestsSuite) AfterTest(suite string, test string) { type LeaseRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type LeaseUnrecordedTestsSuite struct { diff --git a/sdk/storage/azblob/pageblob/client_test.go b/sdk/storage/azblob/pageblob/client_test.go index 2e6b7b1887b5..afe536f74bb5 100644 --- a/sdk/storage/azblob/pageblob/client_test.go +++ b/sdk/storage/azblob/pageblob/client_test.go @@ -47,6 +47,14 @@ func Test(t *testing.T) { } } +func (s *PageBlobRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *PageBlobRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *PageBlobRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -65,6 +73,7 @@ func (s *PageBlobUnrecordedTestsSuite) AfterTest(suite string, test string) { type PageBlobRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type PageBlobUnrecordedTestsSuite struct { diff --git a/sdk/storage/azblob/service/client_test.go b/sdk/storage/azblob/service/client_test.go index e25c74f4e1e5..78c7b6c0ff88 100644 --- a/sdk/storage/azblob/service/client_test.go +++ b/sdk/storage/azblob/service/client_test.go @@ -46,6 +46,14 @@ func Test(t *testing.T) { } } +func (s *ServiceRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *ServiceRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *ServiceRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -64,6 +72,7 @@ func (s *ServiceUnrecordedTestsSuite) AfterTest(suite string, test string) { type ServiceRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type ServiceUnrecordedTestsSuite struct { diff --git a/sdk/storage/azblob/testdata/perf/go.mod b/sdk/storage/azblob/testdata/perf/go.mod index 6450502a3b95..838afcc77c00 100644 --- a/sdk/storage/azblob/testdata/perf/go.mod +++ b/sdk/storage/azblob/testdata/perf/go.mod @@ -4,13 +4,13 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 ) require ( - golang.org/x/net v0.10.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/text v0.13.0 // indirect ) replace github.com/Azure/azure-sdk-for-go/sdk/storage/azblob => ../../. diff --git a/sdk/storage/azblob/testdata/perf/go.sum b/sdk/storage/azblob/testdata/perf/go.sum index 8c0458dc68dc..828fba8f59d2 100644 --- a/sdk/storage/azblob/testdata/perf/go.sum +++ b/sdk/storage/azblob/testdata/perf/go.sum @@ -1,8 +1,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8u3fcIHyqkLjcFpNRHQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 h1:Ma67P/GGprNwsslzEH6+Kb8nybI8jpDTm4Wmzu2ReK8= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -12,12 +12,12 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/storage/azdatalake/ci.yml b/sdk/storage/azdatalake/ci.yml index de528ef7b660..5f7bdcd55678 100644 --- a/sdk/storage/azdatalake/ci.yml +++ b/sdk/storage/azdatalake/ci.yml @@ -26,8 +26,9 @@ stages: parameters: ServiceDirectory: 'storage/azdatalake' RunLiveTests: true + UsePipelineProxy: false EnvVars: AZURE_CLIENT_ID: $(AZDATALAKE_CLIENT_ID) AZURE_TENANT_ID: $(AZDATALAKE_TENANT_ID) AZURE_CLIENT_SECRET: $(AZDATALAKE_CLIENT_SECRET) - AZURE_SUBSCRIPTION_ID: $(AZDATALAKE_SUBSCRIPTION_ID) \ No newline at end of file + AZURE_SUBSCRIPTION_ID: $(AZDATALAKE_SUBSCRIPTION_ID) diff --git a/sdk/storage/azdatalake/directory/client_test.go b/sdk/storage/azdatalake/directory/client_test.go index 5cf6419b6426..cc2f7bab8ee0 100644 --- a/sdk/storage/azdatalake/directory/client_test.go +++ b/sdk/storage/azdatalake/directory/client_test.go @@ -38,6 +38,14 @@ func Test(t *testing.T) { } } +func (s *RecordedTestSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *RecordedTestSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *RecordedTestSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -56,6 +64,7 @@ func (s *UnrecordedTestSuite) AfterTest(suite string, test string) { type RecordedTestSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type UnrecordedTestSuite struct { diff --git a/sdk/storage/azdatalake/file/client_test.go b/sdk/storage/azdatalake/file/client_test.go index 9f020f148fe9..7294f001d8c4 100644 --- a/sdk/storage/azdatalake/file/client_test.go +++ b/sdk/storage/azdatalake/file/client_test.go @@ -48,6 +48,14 @@ func Test(t *testing.T) { } } +func (s *RecordedTestSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *RecordedTestSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *RecordedTestSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -66,6 +74,7 @@ func (s *UnrecordedTestSuite) AfterTest(suite string, test string) { type RecordedTestSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type UnrecordedTestSuite struct { diff --git a/sdk/storage/azdatalake/filesystem/client_test.go b/sdk/storage/azdatalake/filesystem/client_test.go index cdebc5639752..c5bad8f0628a 100644 --- a/sdk/storage/azdatalake/filesystem/client_test.go +++ b/sdk/storage/azdatalake/filesystem/client_test.go @@ -39,6 +39,14 @@ func Test(t *testing.T) { } } +func (s *RecordedTestSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *RecordedTestSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *RecordedTestSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -57,6 +65,7 @@ func (s *UnrecordedTestSuite) AfterTest(suite string, test string) { type RecordedTestSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type UnrecordedTestSuite struct { diff --git a/sdk/storage/azdatalake/go.mod b/sdk/storage/azdatalake/go.mod index e909b1dc0a62..32183804dae3 100644 --- a/sdk/storage/azdatalake/go.mod +++ b/sdk/storage/azdatalake/go.mod @@ -5,24 +5,24 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.4 ) require ( github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.0 // indirect + github.com/dnaeon/go-vcr v1.2.0 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/storage/azdatalake/go.sum b/sdk/storage/azdatalake/go.sum index eafa822d8fa4..6712a77cdedc 100644 --- a/sdk/storage/azdatalake/go.sum +++ b/sdk/storage/azdatalake/go.sum @@ -2,17 +2,16 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 h1:u/LLAOFgsMv7HmNL4Qufg58y+qElGOt5qv0z1mURkRY= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0/go.mod h1:2e8rMJtl2+2j+HXbTBwnyGpm5Nou7KhvSfxOq8JpTag= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +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 v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= @@ -26,23 +25,21 @@ github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXc github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/storage/azdatalake/internal/testcommon/common.go b/sdk/storage/azdatalake/internal/testcommon/common.go index 6eac28c17cb4..c8738d31fa43 100644 --- a/sdk/storage/azdatalake/internal/testcommon/common.go +++ b/sdk/storage/azdatalake/internal/testcommon/common.go @@ -20,9 +20,11 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/datalakeerror" "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" ) const ( + RecordingDirectory = "sdk/storage/azdatalake/testdata" FileSystemPrefix = "gofs" FilePrefix = "gotestfile" DirPrefix = "gotestdir" @@ -46,6 +48,22 @@ func GenerateEntityName(testName string) string { return strings.ReplaceAll(strings.ReplaceAll(strings.ToLower(testName), "/", ""), "test", "") } +func SetupSuite(suite *suite.Suite) *recording.TestProxyInstance { + proxy, err := recording.StartTestProxy(RecordingDirectory, nil) + if err != nil { + suite.T().Fatal(err) + } + + return proxy +} + +func TearDownSuite(suite *suite.Suite, proxy *recording.TestProxyInstance) { + err := recording.StopTestProxy(proxy) + if err != nil { + suite.T().Fatal(err) + } +} + func BeforeTest(t *testing.T, suite string, test string) { const blobURLRegex = `https://\S+\.blob\.core\.windows\.net` const dfsURLRegex = `https://\S+\.dfs\.core\.windows\.net` @@ -64,7 +82,7 @@ func BeforeTest(t *testing.T, suite string, test string) { // TODO: more freezing //testframework.AddBodyRegexSanitizer("RequestId:00000000-0000-0000-0000-000000000000", `RequestId:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}`, nil) //testframework.AddBodyRegexSanitizer("Time:2022-08-11T00:21:56.4562741Z", `Time:\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d*)?Z`, nil) - require.NoError(t, recording.Start(t, "sdk/storage/azdatalake/testdata", nil)) + require.NoError(t, recording.Start(t, RecordingDirectory, nil)) } func AfterTest(t *testing.T, suite string, test string) { diff --git a/sdk/storage/azdatalake/lease/client_test.go b/sdk/storage/azdatalake/lease/client_test.go index 5fb2961f0bb7..5acf28e8d8b5 100644 --- a/sdk/storage/azdatalake/lease/client_test.go +++ b/sdk/storage/azdatalake/lease/client_test.go @@ -33,6 +33,14 @@ func Test(t *testing.T) { } } +func (s *LeaseRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *LeaseRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *LeaseRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -51,6 +59,7 @@ func (s *LeaseUnrecordedTestsSuite) AfterTest(suite string, test string) { type LeaseRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type LeaseUnrecordedTestsSuite struct { diff --git a/sdk/storage/azdatalake/service/client_test.go b/sdk/storage/azdatalake/service/client_test.go index 94e5baf47ab0..d84ff8ca9383 100644 --- a/sdk/storage/azdatalake/service/client_test.go +++ b/sdk/storage/azdatalake/service/client_test.go @@ -39,6 +39,14 @@ func Test(t *testing.T) { } } +func (s *ServiceRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *ServiceRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *ServiceRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -57,6 +65,7 @@ func (s *ServiceUnrecordedTestsSuite) AfterTest(suite string, test string) { type ServiceRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type ServiceUnrecordedTestsSuite struct { diff --git a/sdk/storage/azfile/ci.yml b/sdk/storage/azfile/ci.yml index 4978a37820df..ef32e13b49a2 100644 --- a/sdk/storage/azfile/ci.yml +++ b/sdk/storage/azfile/ci.yml @@ -26,6 +26,7 @@ stages: parameters: ServiceDirectory: 'storage/azfile' RunLiveTests: true + UsePipelineProxy: false EnvVars: AZURE_CLIENT_ID: $(AZFILE_CLIENT_ID) AZURE_TENANT_ID: $(AZFILE_TENANT_ID) diff --git a/sdk/storage/azfile/directory/client_test.go b/sdk/storage/azfile/directory/client_test.go index 789b536f501c..fe4475d706be 100644 --- a/sdk/storage/azfile/directory/client_test.go +++ b/sdk/storage/azfile/directory/client_test.go @@ -39,24 +39,33 @@ func Test(t *testing.T) { } } -func (d *DirectoryRecordedTestsSuite) BeforeTest(suite string, test string) { - testcommon.BeforeTest(d.T(), suite, test) +func (s *DirectoryRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) } -func (d *DirectoryRecordedTestsSuite) AfterTest(suite string, test string) { - testcommon.AfterTest(d.T(), suite, test) +func (s *DirectoryRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) } -func (d *DirectoryUnrecordedTestsSuite) BeforeTest(suite string, test string) { +func (s *DirectoryRecordedTestsSuite) BeforeTest(suite string, test string) { + testcommon.BeforeTest(s.T(), suite, test) +} + +func (s *DirectoryRecordedTestsSuite) AfterTest(suite string, test string) { + testcommon.AfterTest(s.T(), suite, test) +} + +func (s *DirectoryUnrecordedTestsSuite) BeforeTest(suite string, test string) { } -func (d *DirectoryUnrecordedTestsSuite) AfterTest(suite string, test string) { +func (s *DirectoryUnrecordedTestsSuite) AfterTest(suite string, test string) { } type DirectoryRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type DirectoryUnrecordedTestsSuite struct { diff --git a/sdk/storage/azfile/file/client_test.go b/sdk/storage/azfile/file/client_test.go index 33911f4099f0..da8bc55e1fdd 100644 --- a/sdk/storage/azfile/file/client_test.go +++ b/sdk/storage/azfile/file/client_test.go @@ -51,24 +51,33 @@ func Test(t *testing.T) { } } -func (f *FileRecordedTestsSuite) BeforeTest(suite string, test string) { - testcommon.BeforeTest(f.T(), suite, test) +func (s *FileRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) } -func (f *FileRecordedTestsSuite) AfterTest(suite string, test string) { - testcommon.AfterTest(f.T(), suite, test) +func (s *FileRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) } -func (f *FileUnrecordedTestsSuite) BeforeTest(suite string, test string) { +func (s *FileRecordedTestsSuite) BeforeTest(suite string, test string) { + testcommon.BeforeTest(s.T(), suite, test) +} + +func (s *FileRecordedTestsSuite) AfterTest(suite string, test string) { + testcommon.AfterTest(s.T(), suite, test) +} + +func (s *FileUnrecordedTestsSuite) BeforeTest(suite string, test string) { } -func (f *FileUnrecordedTestsSuite) AfterTest(suite string, test string) { +func (s *FileUnrecordedTestsSuite) AfterTest(suite string, test string) { } type FileRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type FileUnrecordedTestsSuite struct { diff --git a/sdk/storage/azfile/go.mod b/sdk/storage/azfile/go.mod index ade59ea80920..9aa8e6cb197b 100644 --- a/sdk/storage/azfile/go.mod +++ b/sdk/storage/azfile/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.4 ) require ( @@ -19,10 +19,10 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.12.0 // indirect - golang.org/x/net v0.14.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/storage/azfile/go.sum b/sdk/storage/azfile/go.sum index 6accb0ecfd58..c6584882cf00 100644 --- a/sdk/storage/azfile/go.sum +++ b/sdk/storage/azfile/go.sum @@ -2,14 +2,13 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 h1:t5+QXLCK9SVi0PPdaY0PrFvYU github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 h1:Ma67P/GGprNwsslzEH6+Kb8nybI8jpDTm4Wmzu2ReK8= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 h1:nVocQV40OQne5613EeLayJiRAJuKlBGy+m22qWG+WRg= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0/go.mod h1:7QJP7dr2wznCMeqIrhMgWGf7XpAQnVrJqDm9nvV3Cu4= 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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -25,23 +24,21 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/storage/azfile/internal/testcommon/common.go b/sdk/storage/azfile/internal/testcommon/common.go index c706fd6d4557..7103753a042c 100644 --- a/sdk/storage/azfile/internal/testcommon/common.go +++ b/sdk/storage/azfile/internal/testcommon/common.go @@ -15,6 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/storage/azfile/fileerror" "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" "io" "os" "strconv" @@ -23,10 +24,11 @@ import ( ) const ( - SharePrefix = "gos" - DirectoryPrefix = "godir" - FilePrefix = "gotestfile" - FileDefaultData = "GoFileDefaultData" + RecordingDirectory = "sdk/storage/azfile/testdata" + SharePrefix = "gos" + DirectoryPrefix = "godir" + FilePrefix = "gotestfile" + FileDefaultData = "GoFileDefaultData" ) func GenerateShareName(testName string) string { @@ -94,6 +96,22 @@ func GetRequiredEnv(name string) (string, error) { } } +func SetupSuite(suite *suite.Suite) *recording.TestProxyInstance { + proxy, err := recording.StartTestProxy(RecordingDirectory, nil) + if err != nil { + suite.T().Fatal(err) + } + + return proxy +} + +func TearDownSuite(suite *suite.Suite, proxy *recording.TestProxyInstance) { + err := recording.StopTestProxy(proxy) + if err != nil { + suite.T().Fatal(err) + } +} + func BeforeTest(t *testing.T, suite string, test string) { const urlRegex = `https://\S+\.file\.core\.windows\.net` const tokenRegex = `(?:Bearer\s).*` @@ -110,7 +128,7 @@ func BeforeTest(t *testing.T, suite string, test string) { // TODO: more freezing //testframework.AddBodyRegexSanitizer("RequestId:00000000-0000-0000-0000-000000000000", `RequestId:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}`, nil) //testframework.AddBodyRegexSanitizer("Time:2022-08-11T00:21:56.4562741Z", `Time:\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d*)?Z`, nil) - require.NoError(t, recording.Start(t, "sdk/storage/azfile/testdata", nil)) + require.NoError(t, recording.Start(t, RecordingDirectory, nil)) } func AfterTest(t *testing.T, suite string, test string) { diff --git a/sdk/storage/azfile/lease/client_test.go b/sdk/storage/azfile/lease/client_test.go index 8ea8587e16ac..a0a16e14ed51 100644 --- a/sdk/storage/azfile/lease/client_test.go +++ b/sdk/storage/azfile/lease/client_test.go @@ -33,24 +33,33 @@ func Test(t *testing.T) { } } -func (l *LeaseRecordedTestsSuite) BeforeTest(suite string, test string) { - testcommon.BeforeTest(l.T(), suite, test) +func (s *LeaseRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) } -func (l *LeaseRecordedTestsSuite) AfterTest(suite string, test string) { - testcommon.AfterTest(l.T(), suite, test) +func (s *LeaseRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) } -func (l *LeaseUnrecordedTestsSuite) BeforeTest(suite string, test string) { +func (s *LeaseRecordedTestsSuite) BeforeTest(suite string, test string) { + testcommon.BeforeTest(s.T(), suite, test) +} + +func (s *LeaseRecordedTestsSuite) AfterTest(suite string, test string) { + testcommon.AfterTest(s.T(), suite, test) +} + +func (s *LeaseUnrecordedTestsSuite) BeforeTest(suite string, test string) { } -func (l *LeaseUnrecordedTestsSuite) AfterTest(suite string, test string) { +func (s *LeaseUnrecordedTestsSuite) AfterTest(suite string, test string) { } type LeaseRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type LeaseUnrecordedTestsSuite struct { diff --git a/sdk/storage/azfile/service/client_test.go b/sdk/storage/azfile/service/client_test.go index 2aac3b0791ed..9f0521dd6e0f 100644 --- a/sdk/storage/azfile/service/client_test.go +++ b/sdk/storage/azfile/service/client_test.go @@ -36,6 +36,14 @@ func Test(t *testing.T) { } } +func (s *ServiceRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *ServiceRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *ServiceRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -54,6 +62,7 @@ func (s *ServiceUnrecordedTestsSuite) AfterTest(suite string, test string) { type ServiceRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type ServiceUnrecordedTestsSuite struct { diff --git a/sdk/storage/azfile/share/client_test.go b/sdk/storage/azfile/share/client_test.go index 1639450d18af..9d86d5d9a46e 100644 --- a/sdk/storage/azfile/share/client_test.go +++ b/sdk/storage/azfile/share/client_test.go @@ -36,6 +36,14 @@ func Test(t *testing.T) { } } +func (s *ShareRecordedTestsSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *ShareRecordedTestsSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *ShareRecordedTestsSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -54,6 +62,7 @@ func (s *ShareUnrecordedTestsSuite) AfterTest(suite string, test string) { type ShareRecordedTestsSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type ShareUnrecordedTestsSuite struct { diff --git a/sdk/storage/azqueue/ci.yml b/sdk/storage/azqueue/ci.yml index 678839955e2c..813c16b59d9b 100644 --- a/sdk/storage/azqueue/ci.yml +++ b/sdk/storage/azqueue/ci.yml @@ -26,3 +26,4 @@ stages: parameters: ServiceDirectory: 'storage/azqueue' RunLiveTests: true + UsePipelineProxy: false diff --git a/sdk/storage/azqueue/go.mod b/sdk/storage/azqueue/go.mod index 71326b314675..e01a1db1186c 100644 --- a/sdk/storage/azqueue/go.mod +++ b/sdk/storage/azqueue/go.mod @@ -5,23 +5,23 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 - github.com/stretchr/testify v1.7.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 + github.com/stretchr/testify v1.8.4 ) require ( github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.0 // indirect + github.com/dnaeon/go-vcr v1.2.0 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/storage/azqueue/go.sum b/sdk/storage/azqueue/go.sum index 342569ba6411..8ca65351a4b3 100644 --- a/sdk/storage/azqueue/go.sum +++ b/sdk/storage/azqueue/go.sum @@ -2,15 +2,14 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +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 v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= @@ -24,23 +23,21 @@ github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXc github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/storage/azqueue/internal/testcommon/common.go b/sdk/storage/azqueue/internal/testcommon/common.go index 8ea5ddac88eb..b3f3768089ef 100644 --- a/sdk/storage/azqueue/internal/testcommon/common.go +++ b/sdk/storage/azqueue/internal/testcommon/common.go @@ -20,11 +20,13 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/storage/azqueue/queueerror" "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" ) const ( - QueuePrefix = "goq" - QueueDefaultData = "this is some default data" + RecordingDirectory = "sdk/storage/azqueue/testdata" + QueuePrefix = "goq" + QueueDefaultData = "this is some default data" ) func GenerateQueueName(testName string) string { @@ -75,6 +77,22 @@ func GetRequiredEnv(name string) (string, error) { } } +func SetupSuite(suite *suite.Suite) *recording.TestProxyInstance { + proxy, err := recording.StartTestProxy(RecordingDirectory, nil) + if err != nil { + suite.T().Fatal(err) + } + + return proxy +} + +func TearDownSuite(suite *suite.Suite, proxy *recording.TestProxyInstance) { + err := recording.StopTestProxy(proxy) + if err != nil { + suite.T().Fatal(err) + } +} + func BeforeTest(t *testing.T, suite string, test string) { const urlRegex = `https://\S+\.queue\.core\.windows\.net` require.NoError(t, recording.AddURISanitizer(FakeStorageURL, urlRegex, nil)) @@ -86,7 +104,7 @@ func BeforeTest(t *testing.T, suite string, test string) { // TODO: more freezing //testframework.AddBodyRegexSanitizer("RequestId:00000000-0000-0000-0000-000000000000", `RequestId:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}`, nil) //testframework.AddBodyRegexSanitizer("Time:2022-08-11T00:21:56.4562741Z", `Time:\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d*)?Z`, nil) - require.NoError(t, recording.Start(t, "sdk/storage/azqueue/testdata", nil)) + require.NoError(t, recording.Start(t, RecordingDirectory, nil)) } func AfterTest(t *testing.T, suite string, test string) { diff --git a/sdk/storage/azqueue/service_client_test.go b/sdk/storage/azqueue/service_client_test.go index d303cb2f6d9e..7bd10ee035f4 100644 --- a/sdk/storage/azqueue/service_client_test.go +++ b/sdk/storage/azqueue/service_client_test.go @@ -37,6 +37,14 @@ func Test(t *testing.T) { } } +func (s *RecordedTestSuite) SetupSuite() { + s.proxy = testcommon.SetupSuite(&s.Suite) +} + +func (s *RecordedTestSuite) TearDownSuite() { + testcommon.TearDownSuite(&s.Suite, s.proxy) +} + func (s *RecordedTestSuite) BeforeTest(suite string, test string) { testcommon.BeforeTest(s.T(), suite, test) } @@ -55,6 +63,7 @@ func (s *UnrecordedTestSuite) AfterTest(suite string, test string) { type RecordedTestSuite struct { suite.Suite + proxy *recording.TestProxyInstance } type UnrecordedTestSuite struct { diff --git a/sdk/tracing/azotel/go.mod b/sdk/tracing/azotel/go.mod index cf6d0ad76154..40270cc543a8 100644 --- a/sdk/tracing/azotel/go.mod +++ b/sdk/tracing/azotel/go.mod @@ -6,7 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/jaeger v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 @@ -14,7 +14,7 @@ require ( ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect @@ -25,9 +25,9 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/tracing/azotel/go.sum b/sdk/tracing/azotel/go.sum index 17287ff286b0..82d873eeefbb 100644 --- a/sdk/tracing/azotel/go.sum +++ b/sdk/tracing/azotel/go.sum @@ -2,8 +2,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 h1:ODs3brnqQM99Tq1Pff github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= @@ -30,8 +30,8 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzL 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/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/exporters/jaeger v1.16.0 h1:YhxxmXZ011C0aDZKoNw+juVWAmEfv/0W2XBOv9aHTaA= @@ -42,13 +42,13 @@ go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiM go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=