From 45a3fd3dca4beea01de1fae766187fa2a4a9e612 Mon Sep 17 00:00:00 2001 From: "Ziheng Zhou(MSFT)" Date: Sat, 11 Sep 2021 02:18:01 +0800 Subject: [PATCH] Update search to enable live testing in sovereign clouds for multiple services (#17443) * update to enable live testing in sovereign clouds for search * Update search to enable live testing in sovereign clouds for multiple services * update test-resources.json * update recordedClient.ts --- .../search-documents/test/public/utils/recordedClient.ts | 9 +++++++++ sdk/search/search-documents/tests.yml | 1 + sdk/search/test-resources.json | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sdk/search/search-documents/test/public/utils/recordedClient.ts b/sdk/search/search-documents/test/public/utils/recordedClient.ts index 702b9ced50ca..41ed1516944e 100644 --- a/sdk/search/search-documents/test/public/utils/recordedClient.ts +++ b/sdk/search/search-documents/test/public/utils/recordedClient.ts @@ -53,6 +53,15 @@ export const environmentSetup: RecorderEnvironmentSetup = { }; export function createClients(indexName: string): Clients { + switch (testEnv.AZURE_AUTHORITY_HOST) { + case "https://login.microsoftonline.us": + process.env.ENDPOINT = process.env.ENDPOINT!.toString().replace(".windows.net", ".azure.us"); + break; + case "https://login.chinacloudapi.cn": + process.env.ENDPOINT = process.env.ENDPOINT!.toString().replace(".windows.net", ".azure.cn"); + break; + } + const credential = new AzureKeyCredential(testEnv.SEARCH_API_ADMIN_KEY); const searchClient = new SearchClient(testEnv.ENDPOINT, indexName, credential); const indexClient = new SearchIndexClient(testEnv.ENDPOINT, credential); diff --git a/sdk/search/search-documents/tests.yml b/sdk/search/search-documents/tests.yml index 30e05bbf2df0..82a6b3c683a7 100644 --- a/sdk/search/search-documents/tests.yml +++ b/sdk/search/search-documents/tests.yml @@ -5,3 +5,4 @@ stages: parameters: PackageName: "@azure/search-documents" ServiceDirectory: search + SupportedClouds: 'Public,UsGov,China' diff --git a/sdk/search/test-resources.json b/sdk/search/test-resources.json index a16e676a9489..afc3cead0b9a 100644 --- a/sdk/search/test-resources.json +++ b/sdk/search/test-resources.json @@ -11,9 +11,9 @@ }, "searchSku": { "type": "string", - "defaultValue": "free", + "defaultValue": "basic", "metadata": { - "description": "SKU for search resource. The default is 'free'" + "description": "SKU for search resource. The default is 'basic'" } } },