Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.26k stars 1.94k forks source link

Migrate SDK test recordings to assets repo #33342

Closed samvaity closed 2 months ago

samvaity commented 1 year ago

What is Test-Proxy-Migration

Migration efforts =~ 3-4 dev days.

Steps to integrate with Test Proxy:

  1. Use the latest azure-core-test.
  2. Change the Base type of the respective SDK test class from TestBase to TestProxyTestBase
  3. Run tests in record mode.
  4. Validate recordings are as expected and do not contain secrets. Example updated recording
  5. Run the generate-assets-json.ps1 from sdk\servicedirector\librarylevel directory path - this will move the test recordings to asset repo and create an asset.json file for respective SDK. Detailed steps here
  6. Check in the created asset.json file for each SDK i.e sdk/tables/azure-data-tables/assets.json PR Reference & deleted language repo recordings from your src/test/sessions-records/
  7. Validate changes by running the Live and CI test pipeline

Potential gotchas

Test-Proxy overall progress per language - 2023-08-17

Java 108 81% 81%

Java team SDKs: (April)

Service Library Driver Timeline Status
App Configuration azure-data-appconfiguration @samvaity May Release ✅ #33902 #35167
Container Registry azure-containers-containerregistry @lmolkova May Release ✅ #35282
Text Analytics azure-ai-textanalytics @mssfang May Release ✅ #33931 #35233
Form Recognizer azure-ai-formrecognizer @samvaity May Release ✅ #34436 #35178
Key Vault azure-security-keyvault-secrets @vcolin7 May Release ✅ #34321 #35181
Key Vault azure-security-keyvault-keys @vcolin7 May Release ✅ #34321 #35248
Key Vault azure-security-keyvault-certificates @vcolin7 May Release ✅#34321 #35250
Key Vault azure-security-keyvault-administration @vcolin7 May Release ✅#34321 #35249
Tables azure-data-tables @jairmyree May Release ✅ #34233 #35182
Search azure-search-documents @alzimmermsft May Release ✅ #33952 #35183
Metrics Advisor azure-ai-metricsadvisor @samvaity May Release ✅ #34435 #35179
Azure Monitor Query azure-monitor-query @srnagar May Release ✅ #34542 #35252
Azure Monitor Ingestion azure-monitor-ingestion @srnagar May Release ✅#34415
Event Grid azure-messaging-eventgrid @billwert July Release ✅#36656
Service Bus azure-messaging-servicebus @conniey July Release ✅ #35544
Schema Registry azure-data-schemaregistry @conniey July release ✅ #35570
Storage azure-storage-queue
azure-storage-blob-nio
azure-storage-blob-cryptography
@alzimmermsft May Release ✅ #34494

July - August release SDKs:

Azure Service SDK Driver Status
azure-ai-anomalydetector @alzimmermsft
azure-ai-documenttranslator @alzimmermsft
azure-ai-personalizer @alzimmermsft
azure-ai-translation-text @alzimmermsft
azure-analytics-purview-administration @mssfang
azure-analytics-purview-catalog @mssfang
azure-analytics-purview-scanning @mssfang
azure-analytics-purview-workflow @mssfang
azure-analytics-synapse-artifacts @mssfang
azure-analytics-synapse-spark @mssfang
azure-communication-callautomation @samvaity
azure-communication-callingserver @samvaity ✅ package deprecated
azure-communication-chat @samvaity
azure-communication-email @samvaity
azure-communication-identity @mjafferi-msft
azure-communication-jobrouter @samvaity
azure-communication-networktraversal @samvaity
azure-communication-phonenumbers @samvaity
azure-communication-rooms @minnieliu
azure-communication-sms @samvaity
azure-data-schemaregistry @conniey
azure-data-schemaregistry-apacheavro @conniey
azure-developer-devcenter @samvaity
azure-developer-loadtesting @Harshan01
azure-digitaltwins-core @srnagar - [✅ ]
azure-health-insights-cancerprofiling @srnagar
azure-health-insights-clinicalmatching @srnagar
azure-iot-deviceupdate @g2vinay
azure-iot-modelsrepository @srnagar [✅ ]
azure-maps-elevation @vcolin7 ✅ service deprecated
azure-maps-geolocation @vcolin7
azure-maps-render @vcolin7
azure-maps-route @vcolin7
azure-maps-search @vcolin7
azure-maps-timezone @vcolin7
azure-maps-traffic @vcolin7
azure-maps-weather @vcolin7
azure-messaging-eventgrid @billwert
azure-messaging-eventgrid-cloudnative-cloudevents @billwert ✅ package deprecated
azure-messaging-webpubsub @conniey
azure-messaging-webpubsub-client @conniey
azure-mixedreality-authentication @g2vinay
azure-mixedreality-remoterendering @g2vinay
azure-monitor-opentelemetry-exporter @srnagar
azure-monitor-spring-native-test @jeanbisutti
azure-quantum-jobs @g2vinay
azure-security-attestation @alzimmermsft
azure-security-confidentialledger @conniey
azure-storage-blob @alzimmermsft
azure-storage-blob-changefeed @ibrahimrabab
azure-storage-blob-cryptography @ibrahimrabab
azure-storage-blob-nio @ibrahimrabab/@jairmyree
azure-storage-file-datalake @alzimmermsft
azure-storage-file-share @ibrahimrabab
azure-storage-queue @ibrahimrabab
azure-verticals-agrifood-farming @jairmyree ✅ [service deprecated ]

Management SDKs

https://azure.github.io/azure-sdk/releases/latest/mgmt/java.html

Service SDK Driver Status
azure-resourcemanager-confidentialledger @haolingdong-msft ✅ #34585 #35186
azure-resourcemanager-appplatform https://github.com/Azure/azure-sdk-for-java/pull/36079
azure-resourcemanager-appservice https://github.com/Azure/azure-sdk-for-java/pull/35994
azure-resourcemanager-resources @haolingdong-msft ✅ #35476
azure-resourcemanager https://github.com/Azure/azure-sdk-for-java/pull/36103
azure-resourcemanager-authorization https://github.com/Azure/azure-sdk-for-java/pull/36043
azure-resourcemanager-cdn https://github.com/Azure/azure-sdk-for-java/pull/36079
azure-resourcemanager-compute https://github.com/Azure/azure-sdk-for-java/pull/36069
azure-resourcemanager-containerinstance https://github.com/Azure/azure-sdk-for-java/pull/36009
azure-resourcemanager-containerregistry https://github.com/Azure/azure-sdk-for-java/pull/36013
azure-resourcemanager-containerservice https://github.com/Azure/azure-sdk-for-java/pull/36028
azure-resourcemanager-cosmos https://github.com/Azure/azure-sdk-for-java/pull/36044
azure-resourcemanager-dns https://github.com/Azure/azure-sdk-for-java/pull/36046
azure-resourcemanager-eventhubs https://github.com/Azure/azure-sdk-for-java/pull/36047
azure-resourcemanager-keyvault https://github.com/Azure/azure-sdk-for-java/pull/36048
azure-resourcemanager-monitor https://github.com/Azure/azure-sdk-for-java/pull/36051
azure-resourcemanager-msi https://github.com/Azure/azure-sdk-for-java/pull/36051
azure-resourcemanager-network https://github.com/Azure/azure-sdk-for-java/pull/36079
azure-resourcemanager-privatedns https://github.com/Azure/azure-sdk-for-java/pull/36051
azure-resourcemanager-redis https://github.com/Azure/azure-sdk-for-java/pull/36079
azure-resourcemanager-samples https://github.com/Azure/azure-sdk-for-java/pull/36129
azure-resourcemanager-search https://github.com/Azure/azure-sdk-for-java/pull/36051
azure-resourcemanager-servicebus https://github.com/Azure/azure-sdk-for-java/pull/36051
azure-resourcemanager-sql https://github.com/Azure/azure-sdk-for-java/pull/36079
azure-resourcemanager-storage https://github.com/Azure/azure-sdk-for-java/pull/36055
azure-resourcemanager-trafficmanager https://github.com/Azure/azure-sdk-for-java/pull/36051
joshfree commented 1 year ago

cc: @kurtzeborn as fyi on progress

haolingdong-msft commented 1 year ago

Hi @samvaity, I tried to use TestProxyTestBase to record, but meet issue on connecting to test proxy when start recording,(see below screenshot) I debugged into the code, seems it connects to localhost test proxy server, but I cannot find the steps about setting up the test proxy locally in the migration document. Do we have guidelines on how to record locally?

image

weidongxu-microsoft commented 1 year ago

@haolingdong-msft Please check @BeforeEach of TestBase is invoked. It could be shadowed by the subclass.

samvaity commented 1 year ago

Haoling Dong We could probably add a gotcha in the doc saying: if you meet connection issue, make sure TestProxyBase.setup() is called before running the tests, because it is very likely that subclass named the @BeforeAll method as 'setup' and it will override the super class(i.e. TestProxyBase) setup(i.e. BeforeAll hook). 

This solved the above-mentioned error.